Unit BGRAText

Description

Base implementation of system text rendering.

This unit provides basic text rendering functions using system renderer (LCL or MSEgui).

Text functions use a temporary bitmap where the operating system text drawing is used. Then it is scaled down (if antialiasing is activated) and colored.

These routines are rather slow, so you may use other font renderers like TBGRATextEffectFontRenderer in BGRATextFX if you want to use LCL fonts, or, if you have TrueType fonts files, you may use TBGRAFreeTypeFontRenderer in BGRAFreeType.

Font rendering units : BGRAText, BGRATextFX, BGRAVectorize, BGRAFreeType

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TBGRASystemFontRenderer Font renderer using system rendering (LCL, mseGUI).
Class TMSEFontRenderer Font renderer using MSE calls to the operating system

Functions and Procedures

procedure BGRAFillClearTypeGrayscaleMask(dest: TBGRACustomBitmap; x,y: integer; xThird: integer; mask: TGrayscaleMask; color: TBGRAPixel; texture: IBGRAScanner = nil; RGBOrder: boolean=true);
procedure BGRAFillClearTypeMask(dest: TBGRACustomBitmap; x,y: integer; xThird: integer; mask: TBGRACustomBitmap; color: TBGRAPixel; texture: IBGRAScanner = nil; RGBOrder: boolean=true);
procedure BGRAFillClearTypeRGBMask(dest: TBGRACustomBitmap; x,y: integer; mask: TBGRACustomBitmap; color: TBGRAPixel; texture: IBGRAScanner = nil; KeepRGBOrder: boolean=true);
function BGRAOriginalTextSize(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: integer): TSize;
function BGRAOriginalTextSizeAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer): TSize;
function BGRAOriginalTextSizeEx(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; out actualAntialiasingLevel: integer; out extraVerticalMarginDueToRotation: integer): TSize;
function BGRAOriginalTextSizeExAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; out actualAntialiasingLevel: integer; out extraVerticalMarginDueToRotation: integer): TSize;
function BGRATextFitInfo(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; AMaxWidth: integer): integer;
function BGRATextFitInfoAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; AMaxWidth: integer): integer;
procedure BGRATextOut(bmp: TBGRACustomBitmap; Font: TFont; Quality: TBGRAFontQuality; xf, yf: single; sUTF8: string; c: TBGRAPixel; tex: IBGRAScanner; align: TAlignment; CustomAntialiasingLevel: Integer = 0; ShowPrefix: boolean = false; RightToLeft: boolean = false);
procedure BGRATextOutAngle(bmp: TBGRACustomBitmap; Font: TFont; Quality: TBGRAFontQuality; xf, yf: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; tex: IBGRAScanner; align: TAlignment; CustomAntialiasingLevel: Integer = 0);
procedure BGRATextRect(bmp: TBGRACustomBitmap; Font: TFont; Quality: TBGRAFontQuality; ARect: TRect; xf, yf: single; sUTF8: string; style: TTextStyle; c: TBGRAPixel; tex: IBGRAScanner; CustomAntialiasingLevel: Integer = 0);
function BGRATextSize(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer): TSize;
function BGRATextSizeAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer): TSize;
function BGRATextStrikeOut(ATopLeft: TPointF; AWidth: Single; AMetrics: TFontPixelMetric): ArrayOfTPointF; overload;
function BGRATextStrikeOut(ATopLeft: TPointF; AWidth: Single; ABaseline, AEmHeight, AXHeight: single): ArrayOfTPointF; overload;
function BGRATextUnderline(ATopLeft: TPointF; AWidth: Single; AMetrics: TFontPixelMetric): ArrayOfTPointF; overload;
function BGRATextUnderline(ATopLeft: TPointF; AWidth: Single; ABaseline, AEmHeight: single): ArrayOfTPointF; overload;
procedure BitmapFillRect(ABitmap: TBitmap; ARect: TRect; AColor: TColor);
function BitmapTextExtent(ABitmap: TBitmap; AText: string): TSize;
function BitmapTextExtentAngle(ABitmap: TBitmap; AText: string; AOrientation: integer): TSize;
function BitmapTextFitInfo(ABitmap: TBitmap; AText: string; AMaxWidth: integer): integer;
function BitmapTextFitInfoAngle(ABitmap: TBitmap; AText: string; AMaxWidth: integer; AOrientation: integer): integer;
procedure BitmapTextOut(ABitmap: TBitmap; ACoord: TPoint; AText: string);
procedure BitmapTextOutAngle(ABitmap: TBitmap; ACoord: TPoint; AText: string; AOrientation: integer);
procedure BitmapTextRect(ABitmap: TBitmap; ARect: TRect; ACoord: TPoint; AText: string; const AStyle: TTextStyle);
function CleanTextOutString(s: string): string;
function FixSystemFontFullHeight(AFontName: string; AFontHeight: integer): integer;
function FontEmHeightSign: integer;
function FontFullHeightSign: integer;
function GetFineClearTypeAuto: TBGRAFontQuality;
function GetFontHeightSign: integer;
function GetLCLFontPixelMetric(AFont: TFont): TFontPixelMetric;
function RemoveLineEnding(var s: string; indexByte: integer): boolean;
function RemoveLineEndingUTF8(var sUTF8: string; indexUTF8: integer): boolean;
function SystemFontAvailable: boolean;

Types

TWordBreakHandler = BGRABitmapTypes.TWordBreakHandler;

Constants

FontAntialiasingLevel = 3;
FontDefaultQuality = fqAntialiased;
IsLclFontRendererFine = true;
RenderTextOnBitmap = true;

Variables

BGRATextOutImproveReadabilityProc: procedure(bmp: TBGRACustomBitmap; AFont: TFont; xf,yf: single; text: string; color: TBGRAPixel; tex: IBGRAScanner; align: TAlignment; mode : TBGRATextOutImproveReadabilityMode);

Description

Functions and Procedures

procedure BGRAFillClearTypeGrayscaleMask(dest: TBGRACustomBitmap; x,y: integer; xThird: integer; mask: TGrayscaleMask; color: TBGRAPixel; texture: IBGRAScanner = nil; RGBOrder: boolean=true);

This item has no description.

procedure BGRAFillClearTypeMask(dest: TBGRACustomBitmap; x,y: integer; xThird: integer; mask: TBGRACustomBitmap; color: TBGRAPixel; texture: IBGRAScanner = nil; RGBOrder: boolean=true);

This item has no description.

procedure BGRAFillClearTypeRGBMask(dest: TBGRACustomBitmap; x,y: integer; mask: TBGRACustomBitmap; color: TBGRAPixel; texture: IBGRAScanner = nil; KeepRGBOrder: boolean=true);

This item has no description.

function BGRAOriginalTextSize(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: integer): TSize;

This item has no description.

function BGRAOriginalTextSizeAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer): TSize;

This item has no description.

function BGRAOriginalTextSizeEx(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; out actualAntialiasingLevel: integer; out extraVerticalMarginDueToRotation: integer): TSize;

This item has no description.

function BGRAOriginalTextSizeExAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; out actualAntialiasingLevel: integer; out extraVerticalMarginDueToRotation: integer): TSize;

This item has no description.

function BGRATextFitInfo(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; AMaxWidth: integer): integer;

This item has no description.

function BGRATextFitInfoAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer; AMaxWidth: integer): integer;

This item has no description.

procedure BGRATextOut(bmp: TBGRACustomBitmap; Font: TFont; Quality: TBGRAFontQuality; xf, yf: single; sUTF8: string; c: TBGRAPixel; tex: IBGRAScanner; align: TAlignment; CustomAntialiasingLevel: Integer = 0; ShowPrefix: boolean = false; RightToLeft: boolean = false);

This item has no description.

procedure BGRATextOutAngle(bmp: TBGRACustomBitmap; Font: TFont; Quality: TBGRAFontQuality; xf, yf: single; orientationTenthDegCCW: integer; sUTF8: string; c: TBGRAPixel; tex: IBGRAScanner; align: TAlignment; CustomAntialiasingLevel: Integer = 0);

This item has no description.

procedure BGRATextRect(bmp: TBGRACustomBitmap; Font: TFont; Quality: TBGRAFontQuality; ARect: TRect; xf, yf: single; sUTF8: string; style: TTextStyle; c: TBGRAPixel; tex: IBGRAScanner; CustomAntialiasingLevel: Integer = 0);

This item has no description.

function BGRATextSize(Font: TFont; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer): TSize;

This item has no description.

function BGRATextSizeAngle(Font: TFont; AOrientation: integer; Quality: TBGRAFontQuality; sUTF8: string; CustomAntialiasingLevel: Integer): TSize;

This item has no description.

function BGRATextStrikeOut(ATopLeft: TPointF; AWidth: Single; AMetrics: TFontPixelMetric): ArrayOfTPointF; overload;

This item has no description.

function BGRATextStrikeOut(ATopLeft: TPointF; AWidth: Single; ABaseline, AEmHeight, AXHeight: single): ArrayOfTPointF; overload;

This item has no description.

function BGRATextUnderline(ATopLeft: TPointF; AWidth: Single; AMetrics: TFontPixelMetric): ArrayOfTPointF; overload;

This item has no description.

function BGRATextUnderline(ATopLeft: TPointF; AWidth: Single; ABaseline, AEmHeight: single): ArrayOfTPointF; overload;

This item has no description.

procedure BitmapFillRect(ABitmap: TBitmap; ARect: TRect; AColor: TColor);

This item has no description.

function BitmapTextExtent(ABitmap: TBitmap; AText: string): TSize;

This item has no description.

function BitmapTextExtentAngle(ABitmap: TBitmap; AText: string; AOrientation: integer): TSize;

This item has no description.

function BitmapTextFitInfo(ABitmap: TBitmap; AText: string; AMaxWidth: integer): integer;

This item has no description.

function BitmapTextFitInfoAngle(ABitmap: TBitmap; AText: string; AMaxWidth: integer; AOrientation: integer): integer;

This item has no description.

procedure BitmapTextOut(ABitmap: TBitmap; ACoord: TPoint; AText: string);

This item has no description.

procedure BitmapTextOutAngle(ABitmap: TBitmap; ACoord: TPoint; AText: string; AOrientation: integer);

This item has no description.

procedure BitmapTextRect(ABitmap: TBitmap; ARect: TRect; ACoord: TPoint; AText: string; const AStyle: TTextStyle);

This item has no description.

function CleanTextOutString(s: string): string;

This item has no description.

function FixSystemFontFullHeight(AFontName: string; AFontHeight: integer): integer;

This item has no description.

function FontEmHeightSign: integer;

This item has no description.

function FontFullHeightSign: integer;

This item has no description.

function GetFineClearTypeAuto: TBGRAFontQuality;

This item has no description.

function GetFontHeightSign: integer;

This item has no description.

function GetLCLFontPixelMetric(AFont: TFont): TFontPixelMetric;

This item has no description.

function RemoveLineEnding(var s: string; indexByte: integer): boolean;

this works with UTF8 strings as well

function RemoveLineEndingUTF8(var sUTF8: string; indexUTF8: integer): boolean;

this works with UTF8 strings however the index is the byte index

function SystemFontAvailable: boolean;

This item has no description.

Types

TWordBreakHandler = BGRABitmapTypes.TWordBreakHandler;

This item has no description.

Constants

FontAntialiasingLevel = 3;

This item has no description.

FontDefaultQuality = fqAntialiased;

This item has no description.

IsLclFontRendererFine = true;

This item has no description.

RenderTextOnBitmap = true;

This item has no description.

Variables

BGRATextOutImproveReadabilityProc: procedure(bmp: TBGRACustomBitmap; AFont: TFont; xf,yf: single; text: string; color: TBGRAPixel; tex: IBGRAScanner; align: TAlignment; mode : TBGRATextOutImproveReadabilityMode);

This item has no description.