Skip to main content

Drawing glyph in font file (woff, tff ..)

Project description

安装

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() 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

font2img-2.2-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page