Skip to content

Instantly share code, notes, and snippets.

@mandel59
Created April 11, 2021 02:24
Show Gist options
  • Save mandel59/10d63c54db75d429049ed664a8f9a58e to your computer and use it in GitHub Desktop.
Save mandel59/10d63c54db75d429049ed664a8f9a58e to your computer and use it in GitHub Desktop.
フォント名とグリフ名とUnicodeコードポイントとグリフ幅を出力するだけのスクリプト
import sys
import fontforge
def processFont(filename):
font = fontforge.open(filename)
try:
for glyph in font.glyphs():
if glyph.unicode != -1:
print("%s,%s,%d,%d" % (filename, glyph.glyphname, glyph.unicode, glyph.width))
else:
print("%s,%s,,%d" % (filename, glyph.glyphname, glyph.width))
finally:
font.close()
def main():
if len(sys.argv) < 2:
exit(1)
for filename in sys.argv[1:]:
processFont(filename)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment