Describes a font using with size, family, style, weight, and line spacing.
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'
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.view.Font
See Also
Constructors
Font
(fontFamily?: string, fontSize?: number, fontStyle?: FontStyle, fontWeight?: FontWeight, lineSpacing?: number, textDecoration?: TextDecoration)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
A map of options to pass to the method.
- fontFamily - string
- A comma separated list of font-family names.
- fontSize - number
- The font size in px.
- fontStyle - FontStyle
- The font style.
- fontWeight - FontWeight
- The font weight.
- lineSpacing - number
- The line spacing which is interpreted as additional spacing of the line height.
- textDecoration - TextDecoration
- The text decoration.
See Also
Properties
Gets the font family.
Remarks
Gets the font style.
Gets the font weight.
Gets the text decoration.
Methods
Assigns the text properties of this instance to the given text element.
Parameters
A map of options to pass to the method.
- textElement - SVGTextElement
- The text element to assign set the Font on.
createCopy
(fontFamily?: string, fontSize?: number, fontStyle?: FontStyle, fontWeight?: FontWeight, lineSpacing?: number, textDecoration?: TextDecoration) : FontCreates a copy with the values of this instance or optionally the explicitly specified values.
Parameters
A map of options to pass to the method.
- 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 - FontWeight
- The font weight to use for the copy.
- lineSpacing - number
- The line spacing to use for the copy.
- textDecoration - TextDecoration
- The text decoration to use for the copy.
Returns
Static Methods
Creates a Font instance from the given font-like object by performing automatic type conversion.