animator.skia.Font

class animator.skia.Font

Bases: pybind11_builtins.pybind11_object

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: animator.skia.Font) -> None

  2. __init__(self: animator.skia.Font, typeface: animator.skia.Typeface, size: float) -> None

  3. __init__(self: animator.skia.Font, typeface: animator.skia.Typeface) -> None

  4. __init__(self: animator.skia.Font, typeface: animator.skia.Typeface, size: float, scaleX: float, skewX: float) -> None

Methods

__init__(*args, **kwargs)

Overloaded function.

countText(self, text, encoding)

Returns number of glyphs represented by text.

dump(self)

getBounds(self, glyphs[, paint])

Returns the bounds for each glyph in glyphs with optional paint.

getEdging(self)

getHinting(self)

getIntercepts(self, glyphs, pos, top, bottom)

Returns intervals [start, end] describing lines parallel to the advance that intersect with the glyphs.

getMetrics(self)

Returns a tuple of (font metrics, line spacing).

getPath(self, glyphID)

Returns path to be the outline of the glyph or None if the glyph has no outline.

getPaths(self, glyphIDs)

Returns a list of paths to be the outlines of the glyphs.

getPos(self, glyphs, origin)

Returns the positions for each glyph, beginning at the specified origin.

getScaleX(self)

getSize(self)

getSkewX(self)

getSpacing(self)

getTypeface(self)

getTypefaceOrDefault(self)

getWidths(self, glyphs)

Returns the advance for each glyph in glyphs.

getWidthsBounds(self, glyphs[, paint])

Returns the advance and bounds for each glyph in glyphs with optional paint.

getXPos(self, glyphs[, origin])

Returns the x-positions for each glyph, beginning at the specified origin.

isBaselineSnap(self)

isEmbeddedBitmaps(self)

isEmbolden(self)

isForceAutoHinting(self)

isLinearMetrics(self)

isSubpixel(self)

makeWithSize(self, size)

measureText(self, text, encoding, paint)

Returns a tuple of (advance width of text, bounding box relative to (0, 0)).

refTypeface(self)

refTypefaceOrDefault(self)

setBaselineSnap(self, baselineSnap)

setEdging(self, edging)

setEmbeddedBitmaps(self, embeddedBitmaps)

setEmbolden(self, embolden)

setForceAutoHinting(self, forceAutoHinting)

setHinting(self, hintingLevel)

setLinearMetrics(self, linearMetrics)

setScaleX(self, scaleX)

setSize(self, textSize)

setSkewX(self, skewX)

setSubpixel(self, subpixel)

setTypeface(self, tf)

textToGlyphs(self, text, encoding)

Converts text into glyph indices and returns them.

unicharToGlyph(self, uni)

unicharsToGlyphs(self, uni)

Attributes

defaultSize

class Edging

Bases: pybind11_builtins.pybind11_object

Members:

kAlias

kAntiAlias

kSubpixelAntiAlias

property name
countText(self: animator.skia.Font, text: str, encoding: animator.skia.TextEncoding = <TextEncoding.kUTF8: 0>) int

Returns number of glyphs represented by text.

dump(self: animator.skia.Font) None
getBounds(self: animator.skia.Font, glyphs: List[int], paint: SkPaint = None) List[animator.skia.Rect]

Returns the bounds for each glyph in glyphs with optional paint.

getEdging(self: animator.skia.Font) animator.skia.Font.Edging
getHinting(self: animator.skia.Font) animator.skia.FontHinting
getIntercepts(self: animator.skia.Font, glyphs: List[int], pos: List[animator.skia.Point], top: float, bottom: float, paint: SkPaint = None) List[float]

Returns intervals [start, end] describing lines parallel to the advance that intersect with the glyphs.

getMetrics(self: animator.skia.Font) tuple

Returns a tuple of (font metrics, line spacing).

Return type

Tuple[FontMetrics, float]

getPath(self: animator.skia.Font, glyphID: int) Optional[SkPath]

Returns path to be the outline of the glyph or None if the glyph has no outline.

Rtpye

Path | None

getPaths(self: animator.skia.Font, glyphIDs: List[int]) list

Returns a list of paths to be the outlines of the glyphs. Some elements may be None if the glyph has no outline.

getPos(self: animator.skia.Font, glyphs: List[int], origin: animator.skia.Point = <animator.skia.Point object at 0x7f20529a9db0>) List[animator.skia.Point]

Returns the positions for each glyph, beginning at the specified origin.

getScaleX(self: animator.skia.Font) float
getSize(self: animator.skia.Font) float
getSkewX(self: animator.skia.Font) float
getSpacing(self: animator.skia.Font) float
getTypeface(self: animator.skia.Font) animator.skia.Typeface
getTypefaceOrDefault(self: animator.skia.Font) animator.skia.Typeface
getWidths(self: animator.skia.Font, glyphs: List[int]) List[float]

Returns the advance for each glyph in glyphs.

getWidthsBounds(self: animator.skia.Font, glyphs: List[int], paint: SkPaint = None) tuple

Returns the advance and bounds for each glyph in glyphs with optional paint.

Rtpye

Tuple[List[float], List[Rect]]

getXPos(self: animator.skia.Font, glyphs: List[int], origin: float = 0) List[float]

Returns the x-positions for each glyph, beginning at the specified origin.

isBaselineSnap(self: animator.skia.Font) bool
isEmbeddedBitmaps(self: animator.skia.Font) bool
isEmbolden(self: animator.skia.Font) bool
isForceAutoHinting(self: animator.skia.Font) bool
isLinearMetrics(self: animator.skia.Font) bool
isSubpixel(self: animator.skia.Font) bool
makeWithSize(self: animator.skia.Font, size: float) animator.skia.Font
measureText(self: animator.skia.Font, text: str, encoding: animator.skia.TextEncoding = <TextEncoding.kUTF8: 0>, paint: SkPaint = None) tuple

Returns a tuple of (advance width of text, bounding box relative to (0, 0)).

Parameters
  • text – The text to measure.

  • encoding – The encoding of the text.

  • paint – The paint to use for the text.

Rtpye

Tuple[float, Rect]

refTypeface(self: animator.skia.Font) animator.skia.Typeface
refTypefaceOrDefault(self: animator.skia.Font) animator.skia.Typeface
setBaselineSnap(self: animator.skia.Font, baselineSnap: bool) None
setEdging(self: animator.skia.Font, edging: animator.skia.Font.Edging) None
setEmbeddedBitmaps(self: animator.skia.Font, embeddedBitmaps: bool) None
setEmbolden(self: animator.skia.Font, embolden: bool) None
setForceAutoHinting(self: animator.skia.Font, forceAutoHinting: bool) None
setHinting(self: animator.skia.Font, hintingLevel: animator.skia.FontHinting) None
setLinearMetrics(self: animator.skia.Font, linearMetrics: bool) None
setScaleX(self: animator.skia.Font, scaleX: float) None
setSize(self: animator.skia.Font, textSize: float) None
setSkewX(self: animator.skia.Font, skewX: float) None
setSubpixel(self: animator.skia.Font, subpixel: bool) None
setTypeface(self: animator.skia.Font, tf: animator.skia.Typeface) None
textToGlyphs(self: animator.skia.Font, text: str, encoding: animator.skia.TextEncoding = <TextEncoding.kUTF8: 0>) List[int]

Converts text into glyph indices and returns them.

unicharToGlyph(self: animator.skia.Font, uni: int) int
unicharsToGlyphs(self: animator.skia.Font, uni: List[int]) List[int]