Describes a font using with size, family, style, weight, and line spacing.
Inheritance Hierarchy
Remarks
This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.
CSS font shorthand strings are converted to Fonts. For example:
'bold 16px sans-serif'
'italic Tahoma'
'normal xx-large Arial'See Also
Developer's Guide
Members
No filters for this type
Constructors
Initializes a new instance of the Font class with size 10, "Arial" family, normal weight and style and line spacing 0.5, or the given values.
Initializes a new instance of the Font class with size 10, "Arial" family, normal weight and style and line spacing
0.5, or the given values.Parameters
- fontFamily?: string
- A comma separated list of font-family names.
- fontSize?: number
- The font size in px.
- fontStyle?: FontStyle
- The font style.
- fontWeight?: any
- The font weight.
- lineSpacing?: number
- The line spacing which is interpreted as additional spacing of the line height.
- textDecoration?: TextDecorations
- The text decoration.
See Also
API
- createCopy
Properties
If the given font family string contains quotation marks, it is assumed to follow the W3C fontFamily value specification regarding additional quotes, listing multiple font family names or using generic family names. Otherwise, non-generic font family names will be automatically quoted in order to avoid invalid font family name tokens.
readonlyfinal
Property Value
The font family.
The font size is interpreted as px.
readonlyfinal
Property Value
The size of the font.
Gets the font style.
Gets the font style.
readonlyfinal
Property Value
The font style.
The value is interpreted as a fraction of the line height in EM values.
readonlyfinal
Property Value
The line spacing in EM.
Gets the text decoration.
Gets the text decoration.
readonlyfinal
Property Value
The text decoration.
Methods
Creates a copy with the values of this instance or optionally the explicitly specified values.
Creates a copy with the values of this instance or optionally the explicitly specified values.
final
Parameters
- fontFamily?: string
- The font family to use for the copy.
- fontSize?: number
- The font size to use for the copy.
- fontStyle?: FontStyle
- The font style to use for the copy.
- fontWeight?: any
- The font weight to use for the copy.
- lineSpacing?: number
- The line spacing to use for the copy.
- textDecoration?: TextDecorations
- The text decoration to use for the copy.
Return Value
final
Parameters
- other: any
- Another object to compare to.
Return Value
- boolean
- true if
otherand this instance are the same type and represent the same values; otherwise, false.
The hash code is a numeric value that can be used to treat this object as a key in a hash table or similar data structure.
Two objects that are considered equal must have the same hash code. However, the reverse does not hold and two objects having the same hash code don't have to be equal. Ideally, the hash code should be roughly uniformly-distributed to prevent hash tables from performing poorly. Calculating the hash code is also a potentially frequent operation and should therefore be fast.
final
Return Value
- number
- the hash code for this object