TW3CustomFont



TW3CustomFont

Unit: SmartCL.Fonts.pas

Hierarchy
TObject
TW3CustomFont
Properties
Property-icon.png Color
Property-icon.png Name
Property-icon.png Size
Property-icon.png Weight
Methods
Method-icon.png toCssStyle
Events
Event-icon.png OnChanged

Properties

Property-icon.png Color

Specifies color of Font (color attribute of DOM object).

property Color: TColor read getColor write setColor;

Examples:

W3Button1.Font.Color:= $00ff0000; // RGB order, not BGR like in Delphi
W3Button1.Font.Color:= clRed;
W3Button1.Font.Color:= StrToColor('#ff0000'); // From web color

Property-icon.png Name

Specifies name of Font (fontFamily attribute) of control.

property Name: String read getName write setName;

Examples:

W3Button1.Font.Name:= 'Verdana';
W3Button1.Font.Name:= 'Verdana, Tahoma'; // "backup" 
fontsW3Button1.Font.Name:= 'Verdana, "Segoe UI"'; // spaces in name

Property-icon.png Size

Specifies font size (fontSize DOM attribute) in pixels.

property Size: Integer read getSize write setSize;

Property-icon.png Weight

Specifies fontWeight attribute of DOM object.

property Weight: String read getWeight write setWeight;

List of values that may be set:

ValueDescription
normalDefines normal characters.
boldDefines thick characters.
bolderDefines thicker characters.
lighterDefines lighter characters
100,200,300,400,500,600,700,800,900Defines from thin to thick characters. 400 is the same as normal, and 700 is the same as bold
inheritSpecifies that the font weight should be inherited from the parent element
Note-icon.png Not all values are supported by all browsers.

Methods

Method-icon.png toCssStyle

Computes all properties into single property value suitable for font CSS attribute.

function toCssStyle: String; virtual;

Example:

W3Panel1.InnerText:= W3Button1.Font.toCssStyle;

Events

Event-icon.png OnChanged

Occur after any of properties is changed.

property OnChanged: TNotifyEvent read FOnChange write FOnChange;