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_typeFontType读取获取字体类型。
font_namestr读取获取字体名称。
font_familystr读取获取字体族。
font_stylestr读取获取字体样式。
num_glyphsint读取获取字形数量。
metricsFontMetrics读取获取度量。
encoding``读取获取编码。
glyph_accessorGlyphAccessor读取获取字形访问器。
top_dictTopDict读取获取顶层字典。
private_dictPrivateDict读取获取私有 dict。
charstringsCffIndex读取获取字符字符串。
global_subrsCffIndex读取获取全局子例程。
local_subrsCffIndex读取获取本地子例程。
charsetCffCharset读取获取字符集。
string_indexCffIndex读取获取字符串索引。

方法

签名描述
__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: FontTypeNone)→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 对象,以请求的目标格式实例化,支持在保存前进行内存中的格式转换

另请参阅

 中文