tooling update
This commit is contained in:
parent
d5165bc671
commit
2b53ffc2fb
4 changed files with 9 additions and 17 deletions
|
|
@ -3,8 +3,6 @@
|
||||||
#
|
#
|
||||||
# Generates JSON-encoded information about fonts
|
# Generates JSON-encoded information about fonts
|
||||||
#
|
#
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
||||||
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
||||||
|
|
@ -343,7 +341,7 @@ def genFontInfo(fontpath, outputType, withGlyphs=True):
|
||||||
|
|
||||||
if 'panose' in os2:
|
if 'panose' in os2:
|
||||||
panose = {}
|
panose = {}
|
||||||
for k,v in sstructTableToDict(os2['panose'], panoseFormat).iteritems():
|
for k,v in sstructTableToDict(os2['panose'], panoseFormat).items():
|
||||||
if k[0:1] == 'b' and k[1].isupper():
|
if k[0:1] == 'b' and k[1].isupper():
|
||||||
k = k[1].lower() + k[2:]
|
k = k[1].lower() + k[2:]
|
||||||
# bFooBar => fooBar
|
# bFooBar => fooBar
|
||||||
|
|
@ -369,7 +367,7 @@ def genFontInfo(fontpath, outputType, withGlyphs=True):
|
||||||
|
|
||||||
if 'meta' in tt:
|
if 'meta' in tt:
|
||||||
meta = {}
|
meta = {}
|
||||||
for k,v in tt['meta'].data.iteritems():
|
for k,v in tt['meta'].data.items():
|
||||||
try:
|
try:
|
||||||
v.decode('utf8')
|
v.decode('utf8')
|
||||||
meta[k] = v
|
meta[k] = v
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
#
|
#
|
||||||
# Grab http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
|
# Grab http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
|
||||||
#
|
#
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
||||||
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
||||||
|
|
@ -14,7 +12,7 @@ import json, re
|
||||||
import time
|
import time
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from ConfigParser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
# from robofab.objects.objectsRF import OpenFont
|
# from robofab.objects.objectsRF import OpenFont
|
||||||
from unicode_util import parseUnicodeDataFile
|
from unicode_util import parseUnicodeDataFile
|
||||||
from defcon import Font
|
from defcon import Font
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
#
|
#
|
||||||
# Sync glyph shapes between SVG and UFO, creating a bridge between UFO and Figma.
|
# Sync glyph shapes between SVG and UFO, creating a bridge between UFO and Figma.
|
||||||
#
|
#
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
||||||
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
||||||
|
|
@ -293,8 +291,8 @@ svgtext = '\n'.join(svgLines)
|
||||||
glyphsHtmlFilename = os.path.join(BASEDIR, 'docs', 'glyphs', 'index.html')
|
glyphsHtmlFilename = os.path.join(BASEDIR, 'docs', 'glyphs', 'index.html')
|
||||||
|
|
||||||
html = u''
|
html = u''
|
||||||
with open(glyphsHtmlFilename, 'r') as f:
|
with open(glyphsHtmlFilename, 'r', encoding="utf-8") as f:
|
||||||
html = f.read().decode('utf8')
|
html = f.read()
|
||||||
|
|
||||||
startMarker = u'<div id="svgs">'
|
startMarker = u'<div id="svgs">'
|
||||||
startPos = html.find(startMarker)
|
startPos = html.find(startMarker)
|
||||||
|
|
@ -317,17 +315,17 @@ metaJson += '"kerning":' + fmtJsonList(kerning) + '\n'
|
||||||
metaJson += '}'
|
metaJson += '}'
|
||||||
# metaHtml = '<script>var fontMetaData = ' + metaJson + ';</script>'
|
# metaHtml = '<script>var fontMetaData = ' + metaJson + ';</script>'
|
||||||
|
|
||||||
html = html[:startPos + len(startMarker)] + '\n' + svgtext.decode('utf8') + '\n' + html[endPos:]
|
html = html[:startPos + len(startMarker)] + '\n' + svgtext + '\n' + html[endPos:]
|
||||||
|
|
||||||
print('write', relfilename)
|
print('write', relfilename)
|
||||||
with open(glyphsHtmlFilename, 'w') as f:
|
with open(glyphsHtmlFilename, 'w', encoding="utf-8") as f:
|
||||||
f.write(html.encode('utf8'))
|
f.write(html)
|
||||||
|
|
||||||
# JSON
|
# JSON
|
||||||
jsonFilename = os.path.join(BASEDIR, 'docs', 'glyphs', 'metrics.json')
|
jsonFilename = os.path.join(BASEDIR, 'docs', 'glyphs', 'metrics.json')
|
||||||
jsonFilenameRel = os.path.relpath(jsonFilename, os.getcwd())
|
jsonFilenameRel = os.path.relpath(jsonFilename, os.getcwd())
|
||||||
print('write', jsonFilenameRel)
|
print('write', jsonFilenameRel)
|
||||||
with open(jsonFilename, 'w') as f:
|
with open(jsonFilename, 'w', encoding="utf-8") as f:
|
||||||
f.write(metaJson)
|
f.write(metaJson)
|
||||||
|
|
||||||
metaJson
|
metaJson
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
#
|
#
|
||||||
# Updates the "?v=x" in docs/inter-ui.css
|
# Updates the "?v=x" in docs/inter-ui.css
|
||||||
#
|
#
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
||||||
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
||||||
|
|
|
||||||
Reference in a new issue