THPDFPage.SetTextRenderingMode

THPDFPage

 

顶部  上一页  下一页

决定文本渲染模式

 

TPDFTextRenderingMode = (trFill, trStroke, trFillThenStroke, trInvisible, trFillClipping, trStrokeClipping, trFillStrokeClipping, trClipping);

 

Delphi 语法:

procedure SetTextRenderingMode( Mode: TPDFTextRenderingMode );

 

C++ 语法:

void __fastcall SetTextRenderingMode ( TPDFTextRenderingMode Mode );

 

说明:

决定文本显示时字形轮廓是被描边、填充、用作裁剪边界,还是三者的某种组合

 

代码示例

program TextRender;
{$APPTYPE CONSOLE}
uses
    SysUtils, Graphics, Classes, HPDFDoc;
var
    HPDF: THotPDF;
begin
    HPDF := THotPDF.Create(nil);
    try
        HPDF.AutoLaunch := true;                                      // PDF file will be shown automatically
        HPDF.FileName := '.\TextRender.pdf';                          // Set PDF filename
        HPDF.BeginDoc;                                                // Create PDF file

        HPDF.CurrentPage.SetRGBStrokeColor( clRed );                  // Set stroke color
        HPDF.CurrentPage.SetRGBFillColor( clYellow );                 // Set fill color
        HPDF.CurrentPage.SetTextRenderingMode( trFillThenStroke );    // Set fill and stroke rendering mode
        HPDF.CurrentPage.TextOut( 10, 10, 0, 'Fill and stroke text'); // Print text
        HPDF.EndDoc;                                                  // Close PDF file
    finally
        HPDF.Free;
    end;
end.

 

Value                Meaning


 

trFill

 

填充文本

 

Fill text rendering diagram

 

trStroke

 

描边文本

 

Stroke text rendering diagram

 

trFillThenStroke

 

先填充文本,再 stroke 文本,并将其添加到 path 用于 clipping

 

Fill and stroke text rendering diagram

 

trInvisible

 

 

既不填充也不描边文本(不可见)

 

 

 

trFillClipping

 

填充文本并加入裁剪路径

 

Fill text and add to path rendering diagram

 

trStrokeClipping

 

描边文本并加入裁剪路径

 

Stroke text and add to path rendering diagram

 

trFillStrokeClipping

 

先填充文本,再 stroke 文本,并将其添加到 path 用于 clipping

 

Fill and stroke text rendering with path addition diagram

 

trClipping

 

把文本加入裁剪路径

 

Stroke text clipping rendering diagram