Font Property
Class THtml5Canvas2D
The Font property sets or returns the current font object for text content on the canvas.
Tip:
Use the
CreateFont method to create a font object.
Note:
Appearance of the predefined "TCanvasFontMode" fonts can differ (depending on the browser). For a consistent appearance use
TCanvasFont instead.
Property Values
A font object used for the text content.
A predefined font. Possible values:
cfmCaption
Use the font captioned controls.
cfmIcon
Use the font used to label icons.
cfmMenu
Use the font used in menus.
cfmMessageBox
Use the font used in dialog boxes.
cfmSmallCaption
Use the font used for labeling small controls.
cfmStatusBar
Use the fonts used in window status bar.
Examples:
Write a 30px high text on the canvas, using the font "Verdana":
var
Font: TCanvasFont;
Font := Canvas.CreateFont;
Font.Family := 'Verdana';
Font.Size := 30;
Canvas.Font := Font;
Canvas.FillText('Hello World',10,50);
Write text on the canvas, using the predefined font "cfpIcon":
Canvas.Font := cfmIcon;
Canvas.FillText('Hello World',10,35);