查看uni.ttf字体图标对应的Unicode编码

该网站提供了一个在线平台,允许用户上传TrueType Font (TTF)文件进行编辑和管理。这个功能对于设计师和开发者来说是一个方便的工具,可以方便地处理和预览字体。

上传ttf文件到此网站 http://fontstore.baidu.com/static/editor/

关于CMD 命令已经解决,现在的问题是我将已经生成的SVG图片合成到一个ttf中,其中俩个的SVG合到了一个key 0074。下面是合成的代码# -*- coding: utf-8 -*- """ This script can NOT run directly, use the following command in cmd: `fontforge.exe -script xxx.py param1 param2 ...` """ import os import sys import fontforge def get_files(path, extensions): files = [] for name in os.listdir(path): fullname = os.path.join(path, name) if os.path.isfile(fullname): ext = os.path.splitext(name)[-1].lower()[1:] if (ext == '') or (ext in extensions): files.append(fullname) return files def svg2ttf(folder, out_file): if not os.path.isdir(folder): raise ValueError("%s is NOT a directory!" % folder) svg_files = get_files(folder, ['svg']) infos = [] for svg_file in svg_files: char = os.path.splitext(svg_file)[0][-1] decimal_unicode = ord(char) hex_unicode = "uni" + hex(decimal_unicode)[2:].zfill(4) infos.append([char, decimal_unicode, hex_unicode, svg_file]) # sort infos by decimal_unicode in ascend order infos.sort(key=lambda x: (x[1])) ff_font = fontforge.font() ff_font.fontname = "fontname" ff_font.fullname = "fullname" ff_font.familyname = "familyname" ff_font.encoding = "Unicode" for info in infos: char, dec_code, hex_code, svg_file = info glyph = ff_font.createChar(dec_code) glyph.width = 1000 glyph.importOutlines(svg_file) # Make the glyph lay on the baseline. ymin = glyph.boundingBox()[1] glyph.transform([1, 0, 0, 1, 0, -ymin]) ff_font.generate(out_file) ff_font.close() if __name__ == '__main__': # the sys.argv[0] is python scripts itself, # sys.argv[1] is first param, sys.argv[2] is second param and so on # & "C:\Program Files\FontForgeBuilds\bin\fontforge.exe" -script svgTottf.py FZSTK_SVG FZSTK_new.ttf folder = sys.argv[1] if len(sys.argv) == 3: out_file = sys.argv[2] else: out_file = folder + '.ttf' svg2ttf(folder, out_file)
最新发布
11-06
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值