Class TBGRACustomFontRenderer

Unit

Declaration

type TBGRACustomFontRenderer = class(TObject)

Description

Abstract class for all font renderers

Hierarchy

Overview

Fields

Protected FFontEmHeightF: single;
Public FontName: string;
Public FontOrientation: integer;
Public FontQuality: TBGRAFontQuality;
Public FontStyle: TFontStyles;

Methods

Public function FontExists(AName: string): boolean; virtual; abstract;
Public function GetFontPixelMetric: TFontPixelMetric; virtual; abstract;
Public function GetFontPixelMetricF: TFontPixelMetricF; virtual;
Public function HandlesTextPath: boolean; virtual;
Public function TextFitInfo(sUTF8: string; AMaxWidth: integer): integer; virtual; abstract;
Public function TextFitInfoF(sUTF8: string; AMaxWidthF: single): integer; virtual;
Public function TextSize(sUTF8: string; AMaxWidth: integer; ARightToLeft: boolean): TSize; overload; virtual; abstract;
Public function TextSize(sUTF8: string): TSize; overload; virtual; abstract;
Public function TextSizeAngle(sUTF8: string; orientationTenthDegCCW: integer): TSize; virtual;
Public function TextSizeAngleF(sUTF8: string; orientationTenthDegCCW: integer): TPointF; virtual;
Public function TextSizeF(sUTF8: string): TPointF; overload; virtual;
Public function TextSizeF(sUTF8: string; AMaxWidthF: single; ARightToLeft: boolean): TPointF; overload; virtual;
Public function TextVisible(const AColor: TBGRAPixel): boolean; virtual;
Protected function GetFontEmHeight: integer;
Public procedure CopyTextPathTo(ADest: IBGRAPath; x, y: single; s: string; align: TAlignment); virtual;
Public procedure CopyTextPathTo(ADest: IBGRAPath; x, y: single; s: string; align: TAlignment; ARightToLeft: boolean); virtual;
Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment; ARightToLeft: boolean); overload; virtual;
Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment; ARightToLeft: boolean); overload; virtual;
Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment); overload; virtual; abstract;
Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment); overload; virtual; abstract;
Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment; ARightToLeft: boolean); overload; virtual;
Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment; ARightToLeft: boolean); overload; virtual;
Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment); overload; virtual; abstract;
Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment); overload; virtual; abstract;
Public procedure TextRect(ADest: TBGRACustomBitmap; ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; c: TBGRAPixel); overload; virtual; abstract;
Public procedure TextRect(ADest: TBGRACustomBitmap; ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; texture: IBGRAScanner); overload; virtual; abstract;
Protected procedure SetFontEmHeight(AValue: integer);

Properties

Public property FontEmHeight: integer read GetFontEmHeight write SetFontEmHeight;
Public property FontEmHeightF: single read FFontEmHeightF write FFontEmHeightF;

Description

Fields

Protected FFontEmHeightF: single;

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

Public FontName: string;

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

Public FontOrientation: integer;

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

Public FontQuality: TBGRAFontQuality;

Specifies the quality of rendering. Default value is fqSystem

Public FontStyle: TFontStyles;

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

Methods

Public function FontExists(AName: string): boolean; virtual; abstract;

Checks whether a font exists

Public function GetFontPixelMetric: TFontPixelMetric; virtual; abstract;

Returns measurement for the current font in pixels

Public function GetFontPixelMetricF: TFontPixelMetricF; virtual;

Returns measurement for the current font in fractional pixels

Public function HandlesTextPath: boolean; virtual;

Check whether the renderer can produce text path

Public function TextFitInfo(sUTF8: string; AMaxWidth: integer): integer; virtual; abstract;

Returns the number of Unicode characters that fit into the specified size

Public function TextFitInfoF(sUTF8: string; AMaxWidthF: single): integer; virtual;

Returns the number of Unicode characters that fit into the specified floating-point size

Public function TextSize(sUTF8: string; AMaxWidth: integer; ARightToLeft: boolean): TSize; overload; virtual; abstract;

Returns the total size of the string provided given a maximum width and RTL mode, using the current font. Orientation is not taken into account, so that the width is along the text

Public function TextSize(sUTF8: string): TSize; overload; virtual; abstract;

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

Public function TextSizeAngle(sUTF8: string; orientationTenthDegCCW: integer): TSize; virtual;

Returns the total size of the string provided using the current font, with the given orientation in tenth of degrees CCW, along the text

Public function TextSizeAngleF(sUTF8: string; orientationTenthDegCCW: integer): TPointF; virtual;

Returns the total floating-point size of the string provided using the current font, with the given orientation, along the text

Public function TextSizeF(sUTF8: string): TPointF; overload; virtual;

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

Public function TextSizeF(sUTF8: string; AMaxWidthF: single; ARightToLeft: boolean): TPointF; overload; virtual;

Returns the total floating point size of the string provided given a maximum width and RTL mode, using the current font. Orientation is not taken into account, so that the width is along the text

Public function TextVisible(const AColor: TBGRAPixel): boolean; virtual;

Checks if any text would be visible using the specified color

Protected function GetFontEmHeight: integer;

Retrieves the em-height of the font

Public procedure CopyTextPathTo(ADest: IBGRAPath; x, y: single; s: string; align: TAlignment); virtual;

Copy the path for the UTF8 encoded string into ADest. If align is taLeftJustify, (x, y) is the top-left corner. If align is taCenter, (x, y) is at the top and middle of the text. If align is taRightJustify, (x, y) is the top-right corner.

Public procedure CopyTextPathTo(ADest: IBGRAPath; x, y: single; s: string; align: TAlignment; ARightToLeft: boolean); virtual;

Same as above but with given RTL mode

Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment; ARightToLeft: boolean); overload; virtual;

Same as above but with given RTL mode

Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment; ARightToLeft: boolean); overload; virtual;

Same as above but with given RTL mode

Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; c: TBGRAPixel; align: TAlignment); overload; virtual; abstract;

Draws the UTF8 encoded string, with color c. If align is taLeftJustify, (x, y) is the top-left corner. If align is taCenter, (x, y) is at the top and middle of the text. If align is taRightJustify, (x, y) is the top-right corner. The value of FontOrientation is taken into account, so that the text may be rotated

Public procedure TextOut(ADest: TBGRACustomBitmap; x, y: single; sUTF8: string; texture: IBGRAScanner; align: TAlignment); overload; virtual; abstract;

Same as above functions, except that the text is filled using texture. The value of FontOrientation is taken into account, so that the text may be rotated

Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment; ARightToLeft: boolean); overload; virtual;

Same as above but with given RTL mode

Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment; ARightToLeft: boolean); overload; virtual;

Same as above but with given RTL mode

Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; align: TAlignment); overload; virtual; abstract;

Same as above, except that the orientation is specified in tenth of degrees CCW, overriding the value of the property FontOrientation

Public procedure TextOutAngle(ADest: TBGRACustomBitmap; x, y: single; orientationTenthDegCCW: integer; sUTF8: string; texture: IBGRAScanner; align: TAlignment); overload; virtual; abstract;

Same as above, except that the orientation is specified, overriding the value of the property FontOrientation

Public procedure TextRect(ADest: TBGRACustomBitmap; ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; c: TBGRAPixel); overload; virtual; abstract;

Draw the UTF8 encoded string at the coordinate (x, y), clipped inside the rectangle ARect. Additional style information is provided by the style parameter. The color c is used to fill the text. No rotation is applied.

Public procedure TextRect(ADest: TBGRACustomBitmap; ARect: TRect; x, y: integer; sUTF8: string; style: TTextStyle; texture: IBGRAScanner); overload; virtual; abstract;

Same as above except a texture is used to fill the text

Protected procedure SetFontEmHeight(AValue: integer);

Sets the font height as em-height

Properties

Public property FontEmHeight: integer read GetFontEmHeight write SetFontEmHeight;

Font em-height as an integer

Public property FontEmHeightF: single read FFontEmHeightF write FFontEmHeightF;

Font em-height as a single-precision floating point value