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

SignatureDescription
layout(font: Font, text: str, size: float, kern: bool)TextLayoutResolve text to GlyphIds then call layout_glyphs.
layout_glyphs(font: Font, glyph_ids: list[GlyphId], size: float, kern: bool)TextLayoutLay 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)bytesRender 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)bytesRender single-line text to SVG bytes using vector outlines.