Exemple #1
0
            'rb') as asianFile:
        asianFont = json.loads(asianFile.read().decode('UTF-8',
                                                       errors='replace'))

    # pre-apply `palt` in UI family
    if "UI" in param["feature"]:
        ApplyPalt(asianFont)
    else:
        NowarApplyPaltMultiplied(asianFont, 0.4)
        asianSymbolFont = GenerateAsianSymbolFont(asianFont)
        MergeAbove(baseFont, asianSymbolFont)

    # pseudo-simplified font
    if "Simp" in param["feature"]:
        Simplify(asianFont)

    NowarRemoveFeatures(asianFont)
    MergeBelow(baseFont, asianFont)

    # remap `丶` to `·` in RP variant
    if "RP" in param["feature"]:
        baseFont['cmap'][str(ord('丶'))] = baseFont['cmap'][str(ord('·'))]

    Gc(baseFont)
    Consolidate(baseFont)
    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)
Exemple #2
0
    asianFont = ReadOtz(f"build/shs/{configure.GenerateFilename(dep['CJK'])}.otz")

    # pre-apply `palt` in UI family
    if "UI" in param["feature"]:
        ApplyPalt(asianFont)
    else:
        NowarApplyPaltMultiplied(asianFont, 0.4)
        asianSymbolFont = GenerateAsianSymbolFont(asianFont)
        MergeAbove(baseFont, asianSymbolFont)

    # pseudo-simplified font
    if "Simp" in param["feature"]:
        Simplify(asianFont)

    NowarRemoveFeatures(asianFont)
    MergeBelow(baseFont, asianFont)

    # remap `丶` to `·` in RP variant
    if "RP" in param["feature"]:
        baseFont['cmap'][str(ord('丶'))] = baseFont['cmap'][str(ord('·'))]

    # romanisation
    romaniseCyrillic = "CyR" in param["feature"]
    romaniseHanzi = "Pinyin" in param["feature"]
    romaniseHanguel = "Romaja" in param["feature"]
    if romaniseHanguel or romaniseHanzi:
        romanFont = ReadOtz(f"build/roman/{configure.GenerateFilename(dep['Roman'])}.otz")
        MergeBelow(baseFont, romanFont)
    if romaniseCyrillic or romaniseHanzi or romaniseHanguel:
        BuildRomanisedFont(
            baseFont,