字符/字形支持分析工具
项目描述
pyfontaine分析字体以确定其语言和字符/字形集支持。
它具有简单的Pythonic集合定义格式
在安装过程中,从Extensis、font-config和Unicode网站下载了附加定义,并且可以在不重新安装的情况下更新。
添加自己的定义非常简单。所有位于内部目录下的文件都会被自动检测,所以只需将定义文件添加到那里即可。
安装
首先,安装Python和pip Python包管理器。这通常是随homebrew Python默认安装的,所以先安装homebrew,然后按照以下步骤安装pip
brew install python; brew install icu4c;
在Mac OS X上,按照以下步骤安装pyicu依赖项
CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu;
使用pip轻松安装最新版本
sudo pip install fontaine
要安装最新开发版本
sudo pip install https://github.com/googlefonts/pyfontaine/archive/master.zip;
用法
给定一个由空格分隔的字体文件名列表,它将返回一个包含一些通用元数据和语言支持分析的报告
pyfontaine font.ttf;
给定一个由空格分隔的Unicode字符列表或Unicode值,它将返回包含该字符的字符集列表
pyfontaine 0x0061; pyfontaine ğ ø ∂;
同样,你也可以通过提供文件名来查找字体是否支持特定字符
pyfontaine U+C480 U+C481 font.ttf;
以各种格式输出字体报告
pyfontaine --xml font.ttf; pyfontaine --json font.ttf; pyfontaine --csv font.ttf; pyfontaine --wiki font.ttf;
–wiki格式生成MediaWiki表格(示例)
仅显示来自不同集合的字符集
pyfontaine --collections all font.ttf; # default pyfontaine --collections pyfontaine font.ttf; pyfontaine --collections uniblocks font.ttf; pyfontaine --collections extensis font.ttf; pyfontaine --collections fontconfig font.ttf; pyfontaine --collections cldr font.ttf; pyfontaine --collections subsets font.ttf;
仅显示特定的字符集
pyfontaine --set africaan,adobe_latin_3 font.ttf;
打印每个集合中所有缺失的Unicode值的列表
pyfontaine --missing --set adobe_latin_3 font.ttf; To output visualisations of the coverage using `Hilbert curves <http://en.wikipedia.org/wiki/Hilbert_curve>`__ (thanks for the idea, `Øyvind 'pippin' Kolås <http://github.com/hodefoting>`__!): pyfontaine --show_hilbert font.ttf; ls -l coverage_pngs/; The PNG files are stored in a new directory, ``coverage_pngs``, under the current directory.
更新集合数据
当您在线时,您可以更新远程集合数据
pyfontaine --update-data 1;
Python模块
它有一个名为fontaine的Python模块
在PyPI上发布
要在PyPI上发布新版本,请创建并推送一个带有版本号的新git标签,该版本号遵循[semver](https://www.semver.org)版本控制方案。
然后设置一个~/.pypirc文件
[distutils] index-servers=pypi [pypi] repository = https://pypi.python.org/pypi [server-login] username = user password = password
然后运行
python setup.py build; python setup.py sdist upload;
贡献
欢迎您在GPLv3许可证下做出贡献!
pyfontaine是Ed Trager编写的Fontaine的Python重新实现,由Vitaly Volkov、Dave Crossland、Mikhail Kashkin和Felipe Sanches制作。
感谢
我们感谢一些上游项目,它们使pyfontaine更加有用
Unicode联盟提供的Unicode块
依赖项
Mac OS X需要安装XCode命令行工具
fonttools(通用)或freetype-py(快速)
fontaine-1.4.0-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 3c1ab64e7581d90922526cf50f527c38ca4d19a07bca06f618e053cdada2610b |
|
MD5 | 5ea6fd944c25f913b7bbc28b78b53708 |
|
BLAKE2b-256 | 163288c6e98ed1d29c34212f59308139018c0f6d63d8d86659c0bc6a8ad4ad2a |