SkFont Reference


SkFont controls options applied when drawing and measuring text.


Whether edge pixels draw opaque or with partial transparency.

Constants

Example

See Also

incomplete


Amount of font hinting applied to glyph outlines.

Constants

Example

See Also

incomplete


Constructs SkFont with default values.

Return Value

default initialized SkFont

Example

See Also

incomplete


Constructs SkFont with default values with SkTypeface and size in points.

Parameters

Return Value

initialized SkFont

Example

See Also

incomplete


Constructs SkFont with default values with SkTypeface and size in points, horizontal scale, and horizontal skew. Horizontal scale emulates condensed and expanded fonts. Horizontal skew emulates oblique fonts.

Parameters

Return Value

initialized SkFont

Example

See Also

incomplete


Compares SkFont and font, and returns true if they are equivalent. May return false if SkTypeface has identical contents but different pointers.

Parameters

Return Value

true if SkFont pair are equivalent

Example

See Also

incomplete


If true, instructs the font manager to always hint glyphs. Returned value is only meaningful if platform uses FreeType as the font manager.

Return Value

true if all glyphs are hinted

Example

See Also

incomplete


Returns true if font engine may return glyphs from font bitmaps instead of from outlines.

Return Value

true if glyphs may be font bitmaps

Example

See Also

incomplete


Returns true if glyphs at different sub-pixel positions may differ on pixel edge coverage.

Return Value

true if glyph positioned in pixel using transparency

Example

See Also

incomplete


Returns true if text is converted to SkPath before drawing and measuring.

Return Value

true glyph hints are never applied

Example

See Also

incomplete


Returns true if bold is approximated by increasing the stroke width when creating glyph bitmaps from outlines.

Return Value

bold is approximated through stroke width

Example

See Also

incomplete


Sets whether to always hint glyphs. If forceAutoHinting is set, instructs the font manager to always hint glyphs.

Only affects platforms that use FreeType as the font manager.

Parameters

Example

See Also

incomplete


Requests, but does not require, to use bitmaps in fonts instead of outlines.

Parameters

Example

See Also

incomplete


Requests, but does not require, that glyphs respect sub-pixel positioning.

Parameters

Example

See Also

incomplete


Requests, but does not require, that glyphs are converted to SkPath before drawing and measuring.

Parameters

Example

See Also

incomplete


Increases stroke width when creating glyph bitmaps to approximate a bold typeface.

Parameters

Example

See Also

incomplete


Whether edge pixels draw opaque or with partial transparency.

Return Value

one of: Edging::kAlias, Edging::kAntiAlias, Edging::kSubpixelAntiAlias

Example

See Also

incomplete


Requests, but does not require, that edge pixels draw opaque or with partial transparency.

Parameters

Example

See Also

incomplete


Sets level of glyph outline adjustment. Does not check for valid values of hintingLevel.

Parameters

SkFontHinting::kNormal, SkFontHinting::kFull

Example

See Also

incomplete


Returns level of glyph outline adjustment.

Return Value

one of: SkFontHinting::kNone, SkFontHinting::kSlight, SkFontHinting::kNormal,

SkFontHinting::kFull

Example

See Also

incomplete


Returns a font with the same attributes of this font, but with the specified size. Returns nullptr if size is less than zero, infinite, or NaN.

Parameters

Return Value

initialized SkFont

Example

See Also

incomplete


Returns SkTypeface if set, or nullptr. Does not alter SkTypeface SkRefCnt.

Return Value

SkTypeface if previously set, nullptr otherwise

Example

See Also

incomplete


Returns text size in points.

Return Value

typographic height of text

Example

See Also

incomplete


Returns text scale on x-axis. Default value is 1.

Return Value

text horizontal scale

Example

See Also

incomplete


Returns text skew on x-axis. Default value is zero.

Return Value

additional shear on x-axis relative to y-axis

Example

See Also

incomplete


Increases SkTypeface SkRefCnt by one.

Return Value

SkTypeface if previously set, nullptr otherwise

Example

See Also

incomplete


Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface. Pass nullptr to clear SkTypeface and use the default typeface. Increments tf SkRefCnt by one.

Parameters

Example

See Also

incomplete


Sets text size in points. Has no effect if textSize is not greater than or equal to zero.

Parameters

Example

See Also

incomplete


Sets text scale on x-axis. Default value is 1.

Parameters

Example

See Also

incomplete


Sets text skew on x-axis. Default value is zero.

Parameters

Example

See Also

incomplete


Converts text into glyph indices. Returns the number of glyph indices represented by text. SkTextEncoding specifies how text represents characters or glyphs. glyphs may be nullptr, to compute the glyph count.

Does not check text for valid character codes or valid glyph indices.

If byteLength equals zero, returns zero. If byteLength includes a partial character, the partial character is ignored.

If encoding is kUTF8_SkTextEncoding and text contains an invalid UTF-8 sequence, zero is returned.

If maxGlyphCount is not sufficient to store all the glyphs, no glyphs are copied. The total glyph count is returned for subsequent buffer reallocation.

Parameters

kUTF32_SkTextEncoding, kGlyphID_SkTextEncoding

Parameters

Return Value

number of glyphs represented by text of length byteLength

Example

See Also

incomplete


Returns glyph index for Unicode character.

Parameters

Return Value

glyph index

Example

See Also

incomplete


Returns number of glyphs represented by text.

Parameters

kUTF32_SkTextEncoding, kGlyphID_SkTextEncoding

Return Value

number of glyphs represented by text of length byteLength

Example

See Also

incomplete


Returns true if all text corresponds to a non-zero glyph index. Returns false if any characters in text are not supported in SkTypeface.

If SkTextEncoding is kGlyphID_SkTextEncoding, returns true if all glyph indices in text are non-zero; does not check to see if text contains valid glyph indices for SkTypeface.

Returns true if byteLength is zero.

Parameters

Return Value

true if all text corresponds to a non-zero glyph index

Example

See Also

incomplete


Returns the advance width of text. The advance is the normal distance to move before drawing additional text. Returns the bounding box of text if bounds is not nullptr.

Parameters

kUTF32_SkTextEncoding, kGlyphID_SkTextEncoding

Parameters

Return Value

number of glyphs represented by text of length byteLength

Example

See Also

incomplete


Returns path corresponding to glyph outline. If glyph has an outline, copies outline to path and returns true. path returned may be empty. If glyph is described by a bitmap, returns false and ignores path parameter.

Parameters

Return Value

true if glyphID is described by path

Example

See Also

incomplete


Returns path corresponding to glyph array.

Parameters

Example

See Also

incomplete


Returns SkFontMetrics associated with SkTypeface. The return value is the recommended spacing between lines: the sum of metrics descent, ascent, and leading. If metrics is not nullptr, SkFontMetrics is copied to metrics. Results are scaled by text size but does not take into account dimensions required by text scale, text skew, fake bold, style stroke, and SkPathEffect.

Parameters

Return Value

recommended spacing between lines

Example

See Also

incomplete


Returns the recommended spacing between lines: the sum of metrics descent, ascent, and leading. Result is scaled by text size but does not take into account dimensions required by stroking and SkPathEffect. Returns the same result as getMetrics().

Return Value

recommended spacing between lines

Example

See Also

incomplete