FontMetrics
- class FontMetrics
The metrics of an
Font
.The metric values are consistent with the Skia y-down coordinate system.
Classes
FontMetricsFlags indicate when certain metrics are valid; the underline or
Methods
Returns true if
FontMetrics
has a valid strikeout position, and sets position to that value.Returns true if
FontMetrics
has a valid strikeout thickness, and sets thickness to that value.Returns true if
FontMetrics
has a valid underline position, and sets position to that value.Returns true if
FontMetrics
has a valid underline thickness, and sets thickness to that value.Attributes
distance to reserve above baseline, typically negative
average character width, zero if unknown
greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable fonts
height of an upper-case letter, zero if unknown, typically negative
distance to reserve below baseline, typically positive
FontMetricsFlags indicating which metrics are valid.
distance to add between lines, typically positive or zero
maximum character width, zero if unknown
distance from baseline to bottom of stroke, typically negative
strikeout thickness
greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable fonts
distance from baseline to top of stroke, typically positive
underline thickness
height of lower-case 'x', zero if unknown, typically negative
greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts
greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts
Methods
- FontMetrics.__init__(self: skia.FontMetrics) None
- FontMetrics.hasStrikeoutPosition(self: skia.FontMetrics, position: float) bool
Returns true if
FontMetrics
has a valid strikeout position, and sets position to that value.If the underline position is not valid, return false, and ignore position.
- Parameters:
position (float) – storage for strikeout position
- Returns:
true if font specifies strikeout position
- FontMetrics.hasStrikeoutThickness(self: skia.FontMetrics, thickness: float) bool
Returns true if
FontMetrics
has a valid strikeout thickness, and sets thickness to that value.If the underline thickness is not valid, return false, and ignore thickness.
- Parameters:
thickness (float) – storage for strikeout width
- Returns:
true if font specifies strikeout width
- FontMetrics.hasUnderlinePosition(self: skia.FontMetrics, position: float) bool
Returns true if
FontMetrics
has a valid underline position, and sets position to that value.If the underline position is not valid, return false, and ignore position.
- Parameters:
position (float) – storage for underline position
- Returns:
true if font specifies underline position
- FontMetrics.hasUnderlineThickness(self: skia.FontMetrics, thickness: float) bool
Returns true if
FontMetrics
has a valid underline thickness, and sets thickness to that value.If the underline thickness is not valid, return false, and ignore thickness.
- Parameters:
thickness – storage for underline width
- Returns:
true if font specifies underline width
Attributes
- FontMetrics.fAscent
distance to reserve above baseline, typically negative
- FontMetrics.fAvgCharWidth
average character width, zero if unknown
- FontMetrics.fBottom
greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable fonts
- FontMetrics.fCapHeight
height of an upper-case letter, zero if unknown, typically negative
- FontMetrics.fDescent
distance to reserve below baseline, typically positive
- FontMetrics.fFlags
FontMetricsFlags indicating which metrics are valid.
- FontMetrics.fLeading
distance to add between lines, typically positive or zero
- FontMetrics.fMaxCharWidth
maximum character width, zero if unknown
- FontMetrics.fStrikeoutPosition
distance from baseline to bottom of stroke, typically negative
- FontMetrics.fStrikeoutThickness
strikeout thickness
- FontMetrics.fTop
greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable fonts
- FontMetrics.fUnderlinePosition
distance from baseline to top of stroke, typically positive
- FontMetrics.fUnderlineThickness
underline thickness
- FontMetrics.fXHeight
height of lower-case ‘x’, zero if unknown, typically negative
- FontMetrics.fXMax
greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts
- FontMetrics.fXMin
greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts
- FontMetrics.kStrikeoutPositionIsValid_Flag = <FontMetricsFlags.kStrikeoutPositionIsValid_Flag: 8>
- FontMetrics.kStrikeoutThicknessIsValid_Flag = <FontMetricsFlags.kStrikeoutThicknessIsValid_Flag: 4>
- FontMetrics.kUnderlinePositionIsValid_Flag = <FontMetricsFlags.kUnderlinePositionIsValid_Flag: 2>
- FontMetrics.kUnderlineThicknessIsValid_Flag = <FontMetricsFlags.kUnderlineThicknessIsValid_Flag: 1>