CffFont
概述
CffFont 是 Aspose.Font FOSS 中用于 Python 的一个类。继承自:Font。
CffFont.get_kern_pairs() 返回一个 KernPair 对象列表,表示字体中定义的字距调整。
此类在 Python 程序中提供了用于操作 CffFont 对象的 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 应用程序均可访问。属性:charset、charstrings、encoding、font_family、font_name、font_style,以及另外 9 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
font_type | FontType | 读取 | 获取字体类型。 |
font_name | str | 读取 | 获取字体名称。 |
font_family | str | 读取 | 获取字体族。 |
font_style | str | 读取 | 获取字体样式。 |
num_glyphs | int | 读取 | 获取字形数量。 |
metrics | FontMetrics | 读取 | 获取度量。 |
encoding | `` | 读取 | 获取编码。 |
glyph_accessor | GlyphAccessor | 读取 | 获取字形访问器。 |
top_dict | TopDict | 读取 | 获取顶层字典。 |
private_dict | PrivateDict | 读取 | 获取私有 dict。 |
charstrings | CffIndex | 读取 | 获取字符字符串。 |
global_subrs | CffIndex | 读取 | 获取全局子例程。 |
local_subrs | CffIndex | 读取 | 获取本地子例程。 |
charset | CffCharset | 读取 | 获取字符集。 |
string_index | CffIndex | 读取 | 获取字符串索引。 |
方法
| 签名 | 描述 |
|---|---|
__init__(data: bytes, top_dict: TopDict, private_dict: PrivateDict, charset: CffCharset, encoding: CffEncoding, charstrings: CffIndex, global_subrs: CffIndex, local_subrs: CffIndex, string_index: CffIndex) | Calls init 在此 CffFont 实例上。 |
get_kern_pairs() → list[KernPair] | 返回字距对。 |
| `to_bytes(font_type: FontType | None)→bytes` |
font_type() → FontType | 属性提供 CFF 字体的 FontType |
font_name() → str | 返回字体的名称字符串 |
font_family() → str | 返回字体的族名称 |
font_style() → str | 返回样式描述符(例如 Regular、Bold) |
num_glyphs() → int | 返回字体中字形的总数 |
metrics() → FontMetrics | 返回一个包含字体度量数据的 FontMetrics 对象 |
encoding() → FontEncoding | 返回一个 FontEncoding 对象,描述字体的字符编码 |
glyph_accessor() → GlyphAccessor | 返回一个 GlyphAccessor 用于访问单个字形数据 |
save(path: str) | 将字体写入指定的文件系统路径 |
save_to_format(font_type: FontType, path: str) | 将字体以给定的 FontType 保存到提供的路径 |
convert(target: FontType) → Font | 返回一个新 Font 对象,以请求的目标格式实例化,支持在保存前进行内存中的格式转换 |