TextRenderer
Overview
TextRenderer is a class in Aspose.Font FOSS for Python.
Lays out text using a font’s glyph metrics and optional kern pairs.
Methods
| Signature | Description |
|---|---|
layout(font: Font, text: str, size: float, kern: bool) → TextLayout | Resolve text to GlyphIds then call layout_glyphs. |
layout_glyphs(font: Font, glyph_ids: list[GlyphId], size: float, kern: bool) → TextLayout | Lay out pre-resolved glyph IDs. |
render_rgb(font: Font, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int, antialias: bool, _fixed_canvas: tuple[int, int] | None, _fixed_baseline: float | None) → tuple[int, int, bytes] | Render single-line text to an RGB byte buffer via software rasterization. |
render_png(font: Font, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int, antialias: bool) → bytes | Render single-line text to PNG bytes via software rasterization. |
render_svg(font: Font, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int) → bytes | Render single-line text to SVG bytes using vector outlines. |