Woff2Font
概述
Woff2Font 是 Aspose.Font FOSS 中用于 Python 的一个类。继承自:Font。
Woff2Font.to_bytes(font_type) 将 WOFF2 字体序列化为指定 font_type 的 bytes 对象。
此类在 Python 程序中提供了用于处理 Woff2Font 对象的 14 个方法。可用的方法包括:__init__、convert、encoding、font_family、font_name、font_style、font_type、get_kern_pairs、glyph_accessor、metrics、num_glyphs、save,以及另外 2 个方法。安装 Aspose.Font FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性:encoding、font_family、font_name、font_style、font_type、glyph_accessor,以及另外 4 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
font_type | FontType | 读取 | 获取字体类型。 |
font_name | str | 读取 | 获取字体名称。 |
font_family | str | 读取 | 获取字体族。 |
font_style | str | 读取 | 获取字体样式。 |
num_glyphs | int | 读取 | 获取字形数量。 |
metrics | FontMetrics | 读取 | 获取度量。 |
encoding | FontEncoding | 读取 | 获取编码。 |
glyph_accessor | GlyphAccessor | 读取 | 获取字形访问器。 |
metadata_xml | str | 读取 | 获取元数据 xml。 |
inner_font | TtfFont | 读取 | 获取内部字体。 |
方法
| 签名 | 描述 |
|---|---|
__init__(inner: TtfFont, metadata_xml: str) | Calls init 在此 Woff2Font 实例上。 |
get_kern_pairs() → list[KernPair] | 返回字距对。 |
| `to_bytes(font_type: FontType | None)→bytes` |
font_type() → FontType | 返回此 Woff2Font 实例的 FontType |
font_name() → str | 在此 Woff2Font 实例上调用 font_name。 |
font_family() → str | 属性保存字体的 family name 字符串 |
font_style() → str | 属性保存字体的样式描述符字符串 |
num_glyphs() → int | 属性保存总字形计数(整数) |
metrics() → FontMetrics | 返回一个包含字体度量的 FontMetrics 对象 |
encoding() → FontEncoding | 属性保存一个描述字体编码的 FontEncoding 实例 |
glyph_accessor() → GlyphAccessor | 属性持有一个用于字形操作的 GlyphAccessor |
save(path: str) | 在此 Woff2Font 实例上调用 save。 |
save_to_format(font_type: FontType, path: str) | 在此 Woff2Font 实例上调用 save_to_format。 |
convert(target: FontType) → Font | 返回请求的目标格式的 Font 对象,使得能够将 WOFF2 字体转换为任何其他受支持的格式,如 TTF 或 OTF。 |