Difference between revisions of "TBGRABitmap text functions"

From Lazarus wiki
Jump to navigationJump to search
(→‎Measuring: orientation)
Line 7: Line 7:
 
Specifies the set of styles to be applied to the font. These can be ''fsBold'', ''fsItalic'', ''fsStrikeOut'', ''fsUnderline''. So the value ''[fsBold,fsItalic]'' means that the font must be bold and italic.
 
Specifies the set of styles to be applied to the font. These can be ''fsBold'', ''fsItalic'', ''fsStrikeOut'', ''fsUnderline''. So the value ''[fsBold,fsItalic]'' means that the font must be bold and italic.
 
<syntaxhighlight>  property FontOrientation: integer; read write;</syntaxhighlight>
 
<syntaxhighlight>  property FontOrientation: integer; read write;</syntaxhighlight>
Specifies the rotation of the text, for functions that support text rotation.
+
Specifies the rotation of the text, for functions that support text rotation. It is expressed in tenth of degrees, positive values going counter-clockwise.
 
<syntaxhighlight>  property FontHeight: integer; read write;</syntaxhighlight>
 
<syntaxhighlight>  property FontHeight: integer; read write;</syntaxhighlight>
 
Specifies the height of the font without taking into account additional line spacing. A negative value means that it is the full height instead (see below).
 
Specifies the height of the font without taking into account additional line spacing. A negative value means that it is the full height instead (see below).

Revision as of 02:30, 24 March 2015

Here are the text functions the TBGRABitmap class.

Font name and style

  property FontName: string; read write;

Specifies the font to use. Unless the font renderer accept otherwise, the name is in human readable form, like 'Arial', 'Times New Roman', ...

  property FontStyle: TFontStyles; read write;

Specifies the set of styles to be applied to the font. These can be fsBold, fsItalic, fsStrikeOut, fsUnderline. So the value [fsBold,fsItalic] means that the font must be bold and italic.

  property FontOrientation: integer; read write;

Specifies the rotation of the text, for functions that support text rotation. It is expressed in tenth of degrees, positive values going counter-clockwise.

  property FontHeight: integer; read write;

Specifies the height of the font without taking into account additional line spacing. A negative value means that it is the full height instead (see below).

  property FontFullHeight: integer; read write;

Specifies the height of the font, taking into account the additional line spacing defined for the font.

Font quality

  property FontQuality : TBGRAFontQuality; read write;

Specifies the quality of rendering. The following values are possible :

- fqSystem: use system rendering. It is fast however it may be not be smoothed.

- fqSystemClearType: use system rendering with ClearType. This quality is of course better than fqSystem however it may not be much smoother.

- fqFineAntialiasing: garanties a high quality antialiasing. This is slower.

- fqFineClearTypeRGB: garanties a high quality antialiasing with ClearType. The order of the color in the LCD screen is supposed to be un red/green/blue order.

- fqFineClearTypeBGR: same as above, except the color of the LCD screen is supposed to be in blue/green/red order.

  property FontAntialias: Boolean; read write;

Simplified version to specify the quality.

  property FontRenderer: TBGRACustomFontRenderer; read write;

Specifies the font renderer. By default it is an instance of TLCLFontRenderer of unit BGRAText. Other renderers are provided in BGRATextFX unit and BGRAVectorize unit.

Drawing

  procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment);
  procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment);
  procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment);
  procedure TextOutAngle(x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment);
  procedure TextOut(x, y: single; sUTF8: string; c: TBGRAPixel);
  procedure TextOut(x, y: single; sUTF8: string; c: TColor);
  procedure TextOut(x, y: single; sUTF8: string; texture: IBGRAScanner);
  procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; c: TBGRAPixel);
  procedure TextRect(ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; texture: IBGRAScanner);
  procedure TextRect(ARect: TRect; sUTF8: string; halign: TAlignment; valign: TTextLayout; c: TBGRAPixel);
  procedure TextRect(ARect: TRect; sUTF8: string; halign: TAlignment; valign: TTextLayout; texture: IBGRAScanner);

Measuring

  function TextSize(sUTF8: string): TSize;

Returns the total size of the string provided using the current font. Orientation is not taken into account, so that the width is along the text.

  property FontPixelMetric: TFontPixelMetric;

Returns measurement for the current font in pixels.