示例#1
0
    cmap = asianFont['cmap']
    for t, s in OpenCC_T2S.items():
        us = str(ord(s))
        if us in cmap:
            ut = str(ord(t))
            cmap[ut] = cmap[us]


if __name__ == '__main__':
    param = sys.argv[1]
    param = json.loads(param)

    dep = configure.ResolveDependency(param)

    with open(
            "build/noto/{}.otd".format(configure.GenerateFilename(
                dep['Latin'])), 'rb') as baseFile:
        baseFont = json.loads(baseFile.read().decode('UTF-8',
                                                     errors='replace'))
    upm = baseFont["head"]["unitsPerEm"]
    if (upm != 1000):
        Rebase(baseFont, 1000 / upm, roundToInt=True)
    NameFont(param, baseFont)

    hhea = baseFont["hhea"]
    os_2 = baseFont["OS_2"]
    if os_2["version"] < 4:
        os_2["version"] = 4
    hhea['ascender'] = 880
    hhea['descender'] = -120
    hhea['lineGap'] = 200
    os_2['sTypoAscender'] = 880
		cff['version'] = configure.config.version
		if 'notice' in cff:
			del cff['notice']
		cff['copyright'] = configure.config.copyright
		cff['fontName'] = friendly[1033].replace(" ", "-")
		cff['fullName'] = friendly[1033]
		cff['familyName'] = family[1033]
		cff['weight'] = subfamily

if __name__ == '__main__':
	param = sys.argv[1]
	param = Namespace(**json.loads(param))

	dep = configure.ResolveDependency(param)

	with open("noto/{}.otd".format(configure.GenerateFilename(dep['Latin'])), 'rb') as baseFile:
		baseFont = json.loads(baseFile.read().decode('UTF-8', errors='replace'))
	NameFont(param, baseFont)

	baseFont['hhea']['ascender'] = 880
	baseFont['hhea']['descender'] = -120
	baseFont['hhea']['lineGap'] = 200
	baseFont['OS_2']['sTypoAscender'] = 880
	baseFont['OS_2']['sTypoDescender'] = -120
	baseFont['OS_2']['sTypoLineGap'] = 200
	baseFont['OS_2']['fsSelection']['useTypoMetrics'] = True
	baseFont['OS_2']['usWinAscent'] = 1050
	baseFont['OS_2']['usWinDescent'] = 300

	# replace numerals
	if param.family in [ "WarcraftSans", "WarcraftUI" ]:
import sys
import json
import codecs
from types import SimpleNamespace as Namespace
import configure

if __name__ == '__main__':
    param = sys.argv[1]
    param = Namespace(**json.loads(param))

    dep = Namespace(**param.__dict__)
    dep.encoding = "unspec"

    with open("nowar/{}.otd".format(configure.GenerateFilename(dep)),
              'rb') as baseFile:
        baseFont = json.loads(baseFile.read().decode('UTF-8',
                                                     errors='replace'))

    baseFont['OS_2']['ulCodePageRange1'][param.encoding] = True

    outStr = json.dumps(baseFont, ensure_ascii=False)
    with codecs.open("nowar/{}.otd".format(configure.GenerateFilename(param)),
                     'w', 'UTF-8') as outFile:
        outFile.write(outStr)
示例#4
0
fuColonKernValue = {
    "CN": (0, -300),
    "TW": (-150, -150),
    "HK": (-150, -150),
    "JP": (-150, -150),
    "KR": (-150, -150),
    "CL": (-150, -150),
    "GB": (0, -300),
}

if __name__ == "__main__":
    param = sys.argv[1]
    param = json.loads(param)

    font = TTFont("build/unkerned-otf/{}.otf".format(
        configure.GenerateFilename(param)),
                  recalcBBoxes=False,
                  recalcTimestamp=False)

    kern = newTable('kern')
    kern.version = 0
    kern.kernTables = [
        BuildGenericKernSubtable(font, "CyR" not in param["feature"])
    ]
    font['kern'] = kern

    if "F**K" in param["feature"]:
        left, right = fuColonKernValue[param["region"]]
        kern.kernTables.append(BuildFuColonKernSubtable(font, left, right))

    font.save("build/final-otf/{}.otf".format(
示例#5
0
        if 'notice' in cff:
            del cff['notice']
        cff['copyright'] = configure.config.copyright
        cff['fontName'] = friendly.replace(" ", "-")
        cff['fullName'] = friendly
        cff['familyName'] = family
        cff['weight'] = subfamily


if __name__ == '__main__':
    param = sys.argv[1]
    param = Namespace(**json.loads(param))

    dep = configure.ResolveDependency(param)

    with open("noto/{}.otd".format(configure.GenerateFilename(dep['Latin'])),
              'rb') as baseFile:
        baseFont = json.loads(baseFile.read().decode('UTF-8',
                                                     errors='replace'))
    NameFont(param, baseFont)

    baseFont['hhea']['ascender'] = 850
    baseFont['hhea']['descender'] = -150
    baseFont['hhea']['lineGap'] = 200
    baseFont['OS_2']['sTypoAscender'] = 850
    baseFont['OS_2']['sTypoDescender'] = -150
    baseFont['OS_2']['sTypoLineGap'] = 200
    baseFont['OS_2']['fsSelection']['useTypoMetrics'] = True
    baseFont['OS_2']['usWinAscent'] = 1050
    baseFont['OS_2']['usWinDescent'] = 300
示例#6
0
import sys
import json
import codecs
import configure

if __name__ == '__main__':
    param = sys.argv[1]
    param = json.loads(param)

    dep = {**param, "encoding": "unspec"}

    with open("build/nowar/{}.otd".format(configure.GenerateFilename(dep)),
              'rb') as baseFile:
        baseFont = json.loads(baseFile.read().decode('UTF-8',
                                                     errors='replace'))

    baseFont['OS_2']['ulCodePageRange1'][param["encoding"]] = True

    outStr = json.dumps(baseFont, ensure_ascii=False, separators=(',', ':'))
    with codecs.open(
            "build/nowar/{}.otd".format(configure.GenerateFilename(param)),
            'w', 'UTF-8') as outFile:
        outFile.write(outStr)
import sys
import json
import codecs
from types import SimpleNamespace as Namespace
import configure

if __name__ == '__main__':
	param = sys.argv[1]
	param = Namespace(**json.loads(param))

	dep = Namespace(**param.__dict__)
	dep.encoding = "unspec"

	with open("build/nowar/{}.otd".format(configure.GenerateFilename(dep)), 'rb') as baseFile:
		baseFont = json.loads(baseFile.read().decode('UTF-8', errors='replace'))

	baseFont['OS_2']['ulCodePageRange1'][param.encoding] = True

	outStr = json.dumps(baseFont, ensure_ascii=False, separators=(',',':'))
	with codecs.open("build/nowar/{}.otd".format(configure.GenerateFilename(param)), 'w', 'UTF-8') as outFile:
		outFile.write(outStr)
示例#8
0
		if v in substitution:
			asianFont['cmap'][k] = substitution[v]

	# Rewrite this table
	st = {}
	for u in asianSymbol:
		u = str(u)
		if u in baseFont['cmap'] and u in asianFont['cmap']:
			st[baseFont['cmap'][u]] = asianFont['cmap'][u]
	lut['subtables'] = [ st ]

if __name__ == '__main__':
	param = configure.ParamFromArgument(sys.argv[1])
	dep = configure.ResolveDependency(param)

	with open("build/noto/{}.otd".format(configure.GenerateFilename(dep['Latin'])), 'rb') as baseFile:
		baseFont = json.loads(baseFile.read().decode('UTF-8', errors='replace'))
	NameFont(param, baseFont)
	SetHintFlag(baseFont)

	baseFont['hhea']['ascender'] = 880
	baseFont['hhea']['descender'] = -120
	baseFont['hhea']['lineGap'] = 200
	baseFont['OS_2']['sTypoAscender'] = 880
	baseFont['OS_2']['sTypoDescender'] = -120
	baseFont['OS_2']['sTypoLineGap'] = 200
	baseFont['OS_2']['fsSelection']['useTypoMetrics'] = True
	baseFont['OS_2']['usWinAscent'] = 1050
	baseFont['OS_2']['usWinDescent'] = 300

	with open("build/shs/{}.otd".format(configure.GenerateFilename(dep['CJK'])), 'rb') as asianFile: