matplotlib._type1font
#
表示 Type 1 字体的一个类。
此版本读取 pfa 和 pfb 文件,并将其分割以便嵌入 PDF 文件中。它还支持 SlantFont 和 ExtendFont 变换,类似于 pdfTeX 及其相关工具。目前尚不支持子集化。
用法
font = Type1Font(filename)
clear_part, encrypted_part, finale = font.parts
slanted_font = font.transform({'slant': 0.167})
extended_font = font.transform({'extend': 1.2})
来源
Adobe 技术说明 #5040, 支持可下载的 PostScript 语言字体。
Adobe Type 1 字体格式,Adobe 系统公司,第三版,v1.1,1993。ISBN 0-201-57044-0。
- class matplotlib._type1font.Type1Font(input)[source]#
基类:
object
一个表示 Type-1 字体,供后端使用的类。
- 属性:
- parts元组
一个包含明文部分、加密部分和末尾零的 3 元素元组。
- decrypted字节
parts[1]
的解密形式。- propdict[str, Any]
字体属性的字典。值得注意的键包括:
FontName: 字体的 PostScript 名称
Encoding: 从数字编码到字形名称的字典
FontMatrix: 编码矩阵的字节对象
UniqueID: 可选字体标识符,修改字体时会丢弃
CharStrings: 从字形名称到字节码的字典
Subrs: 字节码子例程数组
OtherSubrs: 编码一些 PostScript 代码的字节对象
初始化一个 Type-1 字体。
- 参数:
- inputstr 或 3 元素元组
一个 pfb 文件名,或一个已解码的 Type-1 字体
parts
的 3 元素元组。
- decrypted#
- parts#
- prop#