TextRenderer
TextRenderer
Overview
TextRenderer 是Python的Aspose.Font FOSS中的一个类.
使用字体的符号计数和可选核对来布置文本.
这个类提供了在Python程序中与TextRenderer对象工作的5种方法. 有的方法包括: layout, layout_glyphs, render_png, render_rgb, render_svg. 在安装Python包的Aspose.Font FOSS后,所有公众成员都可以访问任何 Python 应用程序.
Methods
| Signature | Description |
|---|---|
layout(font: Font, text: str, size: float, kern: bool) → TextLayout | 解析文本到 GlyphIds 然后调用 layout_glyphs. |
layout_glyphs(font: Font, glyph_ids: list[GlyphId], size: float, kern: bool) → TextLayout | 设置预先解决的字符标识. |
| `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 |
render_png(font: Font, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int, antialias: bool) → bytes | 通过软件格化将单行文本转换为PNG字节. |
render_svg(font: Font, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int) → bytes | 使用向量轮将单行文本转换为SVG字节. |