安装
pip install font2img
使用
from font2img import ParseTTFFont
p = ParseTTFont("font_file.woff") # 载入当前目录下的 font_file.woff 字体文件
glyphnames = p.get_glyphnames() # 获取字体文件中所有有效字形的代号
# im 类型为 PIL.Image
im = p.one_to_image(glphnames[10]) # 获取第 11 个字形的图像
im.show()
# 将所有字形整合成一张图像, 所有图像类型为 PIL.Image
# image: 包含所有字形的图形
# name_list: 包含所有字形的代号
# image_dict: 各字形图像同其代号的字典
image, name_list, image_dict = p.all_to_image()
Release files for font2img 2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| font2img-2.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / font2img-2.2-py3-none-any.whl
| Download URL | font2img-2.2-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87ef303204243d39a15fa8044608797cd19b1b9273d1599e83711e853d7999a2
|
|
BLAKE2b-256 checksum How to use checksums |
cde7d6a6230a5ee7b486f441b9f0a2db84295fd7a8c68bee8ceb8239b4da50a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|