Font class

Font style support for size, family, weight, style, variant, and lineheight.

Constructors

Font({num? size, List<String>? family, int? weight, String? style, String? variant, LineHeight? lineHeight})
Create a font using size of font in pixels, family name of font(s) using FontFamily, style of the font using FontStyle, variant using FontVariant, and lineHeight extra space (leading) around the font in pixels, if not specified it's 1.2 the font size.
const

Properties

cssExpression String
Shorthand CSS format for font is:
no setter
family List<String>?
Family specifies a list of fonts, the browser will sequentially select the the first known/supported font. There are two types of font families the family-name (e.g., arial, times, courier, etc) or the generic-family (e.g., serif, sans-seric, etc.)
final
hashCode int
The hash code for this object.
no setteroverride
lineHeight LineHeight?
final
lineHeightInPixels num?
The lineHeight, provides an indirect means to specify the leading. The leading is the difference between the font-size height and the (used) value of line height in pixels. If lineHeight is not specified it's automatically computed as 1.2 of the font size. Firefox is 1.2, Safari is ~1.2, and CSS suggest a ration from 1 to 1.2 of the font-size when computing line-height. The Font class constructor has the computation for _lineHeight.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size num?
Font size in pixels.
final
style String?
Style of a font normal, italic, oblique.
final
variant String?
Font variant NORMAL (default) or SMALL_CAPS. Different set of font glyph lower case letters designed to have to fit within the font-height and weight of the corresponding lowercase letters.
final
weight int?
Font weight from 100, 200, 300, 400, 500, 600, 700, 800, 900
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(num ratio) Font
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

merge(Font? a, Font? b) Font?
Merge the two fonts and return the result. See Style.merge for more information.

Constants

cursive → const List<String>
Collection of most common cursive fonts in order.
fantasy → const List<String>
Collection of most common fantasy fonts in order.
monospace → const List<String>
Collection of most common monospace fonts in order.
sansSerif → const List<String>
Collection of most common sans-serif fonts in order.
serif → const List<String>
Collection of most common serif fonts in order.