用于ttf/otf字体的LaTex样式生成器。支持Smufl。
genst的Python项目详细描述
氏族
GenSty是一个用于OpenType字体(otf/ttf)的乳胶式包生成器,它 支持W3C SMuFL表示法。有了gensty,你可以生成你的乳胶包 基于任何OpenType字体;生成器解析ttf/otf文件并创建LaTeX 用于所有Unicode符号的命令。对于SMuFL字体,还可以包括 这个字形名称.json文件,因此它将创建更友好的名称并包括 “私用”符号。在
安装
使用包管理器pip安装foobar。在
pip install gensty
安装(手动)
克隆存储库
^{pr2}$然后从顶部文件夹使用。例如
python3 -m gensty -h
使用
如上所述,该包可以直接使用,从pip安装,并作为 一个模块。对于命令行,可以使用脚本:
gensty -husage: genSty [-h] [--version] [--all] [--smufl SMUFL] [--one-package ONE_PACKAGE] [--author AUTHOR] [--ver VER] pathLaTeX Style file generator for fontspositional arguments: path Font(s) path. It can be either a directory in case of multiple fonts or file path.optional arguments: -h, --help show this help message and exit --version, -v show program's version number and exit --all, -a If choosed genSty will generate LaTeX Styles for all fonts in directory --smufl SMUFL, -s SMUFL If choosed genSty will generate LaTeX Styles for all fonts in directory based on glyphnames provided. --one-package ONE_PACKAGE Creates one package with name provided by this argument. --author AUTHOR Author's name. --ver VER LaTeX package version.
用作模块
使用该模块创建LaTeXstyle实例并处理生成的latex代码 你自己。在
importgensty# Generate LaTeXstyle instance from font file:latexObj=font.LaTeXstyle(author,version,"path/to/font.otf",smufl)# then you can get for latexObj,Header(), DefCommands(), Commands() or File()
使用它们模块在文件系统中创建LaTeX包。在
importgensty# Use the same functions as gensty CLI and handle both folder or font file# input (path can be either font file or folder including fonts).# Then using savePackage you can save the generated output to disk# accorndingly.# smufl is the path to glyphnames.json which is defined according to W3C# Specifications https://www.w3.org/2019/03/smufl13/specification/glyphnames.html# prepare fonts. author, version and smuf, can be None.fonts=prepareFonts(path,version,author,smufl)# packageName and forcedCommand can be None. They are used to force LaTeX# pacakage name and commands respectively.fontnames,fontfiles,files=makePackage(fonts,packageName,forcedCommand)# creates font package in file system.savePackage(fontnames,fontfiles,files,packageName)
贡献
欢迎拉取请求。如需重大更改,请先将问题打开到 讨论你想改变什么。在
- 项目
标签: