svg - 是否可以从命令行从 SVG 创建字体 (TTF)?

标签 svg fonts font-face font-awesome fontforge

我有一组 SVG,我想将其转换为字体 (TTF) - 但必须以自动方式完成 - 这可能吗?

似乎 fontforge 等都需要一些人机交互。

最佳答案

使用 fontforge 是可能的:

import fontforge

# create an empty font in memory
font = fontforge.font()

# Create a char in the unicode 41 pos (an "A")
glyph = font.createChar(41, 'A')

# Import the glyph info
glyph.importOutlines('/path/to/svg/foo.svg')

# Write the font from memory to a TTF file
font.generate('/output/math/foo.ttf')

关于svg - 是否可以从命令行从 SVG 创建字体 (TTF)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25271219/

相关文章:

css - 网页裁剪界面

css - 为什么这些字体不能跨服务器加载?

css - 在 VueJS 中导入带有字体的 CSS 文件

css - compass 字体输出错误的字体文件路径

ios - 你如何让 Font-Face 在 iOS 上加载字体?

html - 非拉丁字符不适用于@font-face

node.js - 使用 highcharts 在服务器端生成 svg

angular - 如何在 Angular 模块中嵌入 mat-icon svg 图标源(没有额外的 Http 请求)

html - 如何使 SVG 图像动态匹配高度(1em)和周围文本的基线?

html - 我可以在 HTML 代码中使用替代字形吗?