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

Uploaded Python 3

File details

Details for the file font2img-2.2-py3-none-any.whl.

File metadata

  • Download URL: font2img-2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for font2img-2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 87ef303204243d39a15fa8044608797cd19b1b9273d1599e83711e853d7999a2
MD5 747acc4eb77a954b9554062d859e7c58
BLAKE2b-256 cde7d6a6230a5ee7b486f441b9f0a2db84295fd7a8c68bee8ceb8239b4da50a4

See more details on using hashes here.

Supported by

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