Skip to content

Commit

Permalink
0.1.4: half-width CJK punctation
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanoHao committed Mar 4, 2019
1 parent eb89d52 commit f6ddd87
Show file tree
Hide file tree
Showing 16 changed files with 165 additions and 38 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 0.1.3
VERSION = 0.1.4

all: SharedMedia-NowarRounded-${VERSION}.7z CN-L-${VERSION}.7z CN-R-${VERSION}.7z CN-M-${VERSION}.7z CN-B-${VERSION}.7z TW-L-${VERSION}.7z TW-R-${VERSION}.7z TW-M-${VERSION}.7z TW-B-${VERSION}.7z HK-L-${VERSION}.7z HK-R-${VERSION}.7z HK-M-${VERSION}.7z HK-B-${VERSION}.7z JP-L-${VERSION}.7z JP-R-${VERSION}.7z JP-M-${VERSION}.7z JP-B-${VERSION}.7z CL-L-${VERSION}.7z CL-R-${VERSION}.7z CL-M-${VERSION}.7z CL-B-${VERSION}.7z OSF-L-${VERSION}.7z OSF-R-${VERSION}.7z OSF-M-${VERSION}.7z OSF-B-${VERSION}.7z

Expand All @@ -10,6 +10,7 @@ clean:

SharedMedia-NowarRounded-${VERSION}.7z: nowar/unspec-NowarWideRoundedUI-CN-Light.ttf nowar/unspec-NowarWideRoundedUI-CN-Regular.ttf nowar/unspec-NowarWideRoundedUI-CN-Medium.ttf nowar/unspec-NowarWideRoundedUI-CN-Bold.ttf nowar/unspec-NowarWideRoundedUI-TW-Light.ttf nowar/unspec-NowarWideRoundedUI-TW-Regular.ttf nowar/unspec-NowarWideRoundedUI-TW-Medium.ttf nowar/unspec-NowarWideRoundedUI-TW-Bold.ttf nowar/unspec-NowarWideRoundedUI-HK-Light.ttf nowar/unspec-NowarWideRoundedUI-HK-Regular.ttf nowar/unspec-NowarWideRoundedUI-HK-Medium.ttf nowar/unspec-NowarWideRoundedUI-HK-Bold.ttf nowar/unspec-NowarWideRoundedUI-JP-Light.ttf nowar/unspec-NowarWideRoundedUI-JP-Regular.ttf nowar/unspec-NowarWideRoundedUI-JP-Medium.ttf nowar/unspec-NowarWideRoundedUI-JP-Bold.ttf nowar/unspec-NowarWideRoundedUI-CL-Light.ttf nowar/unspec-NowarWideRoundedUI-CL-Regular.ttf nowar/unspec-NowarWideRoundedUI-CL-Medium.ttf nowar/unspec-NowarWideRoundedUI-CL-Bold.ttf nowar/unspec-NowarWideRoundedUI-OSF-Light.ttf nowar/unspec-NowarWideRoundedUI-OSF-Regular.ttf nowar/unspec-NowarWideRoundedUI-OSF-Medium.ttf nowar/unspec-NowarWideRoundedUI-OSF-Bold.ttf nowar/unspec-NowarCompactRoundedUI-CN-Light.ttf nowar/unspec-NowarCompactRoundedUI-CN-Regular.ttf nowar/unspec-NowarCompactRoundedUI-CN-Medium.ttf nowar/unspec-NowarCompactRoundedUI-CN-Bold.ttf nowar/unspec-NowarCompactRoundedUI-TW-Light.ttf nowar/unspec-NowarCompactRoundedUI-TW-Regular.ttf nowar/unspec-NowarCompactRoundedUI-TW-Medium.ttf nowar/unspec-NowarCompactRoundedUI-TW-Bold.ttf nowar/unspec-NowarCompactRoundedUI-HK-Light.ttf nowar/unspec-NowarCompactRoundedUI-HK-Regular.ttf nowar/unspec-NowarCompactRoundedUI-HK-Medium.ttf nowar/unspec-NowarCompactRoundedUI-HK-Bold.ttf nowar/unspec-NowarCompactRoundedUI-JP-Light.ttf nowar/unspec-NowarCompactRoundedUI-JP-Regular.ttf nowar/unspec-NowarCompactRoundedUI-JP-Medium.ttf nowar/unspec-NowarCompactRoundedUI-JP-Bold.ttf nowar/unspec-NowarCompactRoundedUI-CL-Light.ttf nowar/unspec-NowarCompactRoundedUI-CL-Regular.ttf nowar/unspec-NowarCompactRoundedUI-CL-Medium.ttf nowar/unspec-NowarCompactRoundedUI-CL-Bold.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Light.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Regular.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Medium.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Bold.ttf nowar/gbk-NowarRounded-CN-Light.ttf nowar/gbk-NowarRounded-CN-Regular.ttf nowar/gbk-NowarRounded-CN-Medium.ttf nowar/gbk-NowarRounded-CN-Bold.ttf nowar/gbk-NowarWideRounded-CN-Light.ttf nowar/gbk-NowarWideRounded-CN-Regular.ttf nowar/gbk-NowarWideRounded-CN-Medium.ttf nowar/gbk-NowarWideRounded-CN-Bold.ttf nowar/gbk-NowarCompactRounded-CN-Light.ttf nowar/gbk-NowarCompactRounded-CN-Regular.ttf nowar/gbk-NowarCompactRounded-CN-Medium.ttf nowar/gbk-NowarCompactRounded-CN-Bold.ttf nowar/big5-NowarRounded-TW-Light.ttf nowar/big5-NowarRounded-TW-Regular.ttf nowar/big5-NowarRounded-TW-Medium.ttf nowar/big5-NowarRounded-TW-Bold.ttf nowar/big5-NowarWideRounded-TW-Light.ttf nowar/big5-NowarWideRounded-TW-Regular.ttf nowar/big5-NowarWideRounded-TW-Medium.ttf nowar/big5-NowarWideRounded-TW-Bold.ttf nowar/big5-NowarCompactRounded-TW-Light.ttf nowar/big5-NowarCompactRounded-TW-Regular.ttf nowar/big5-NowarCompactRounded-TW-Medium.ttf nowar/big5-NowarCompactRounded-TW-Bold.ttf nowar/big5-NowarRounded-HK-Light.ttf nowar/big5-NowarRounded-HK-Regular.ttf nowar/big5-NowarRounded-HK-Medium.ttf nowar/big5-NowarRounded-HK-Bold.ttf nowar/big5-NowarWideRounded-HK-Light.ttf nowar/big5-NowarWideRounded-HK-Regular.ttf nowar/big5-NowarWideRounded-HK-Medium.ttf nowar/big5-NowarWideRounded-HK-Bold.ttf nowar/big5-NowarCompactRounded-HK-Light.ttf nowar/big5-NowarCompactRounded-HK-Regular.ttf nowar/big5-NowarCompactRounded-HK-Medium.ttf nowar/big5-NowarCompactRounded-HK-Bold.ttf nowar/korean-NowarRounded-CL-Light.ttf nowar/korean-NowarRounded-CL-Regular.ttf nowar/korean-NowarRounded-CL-Medium.ttf nowar/korean-NowarRounded-CL-Bold.ttf nowar/korean-NowarWideRounded-CL-Light.ttf nowar/korean-NowarWideRounded-CL-Regular.ttf nowar/korean-NowarWideRounded-CL-Medium.ttf nowar/korean-NowarWideRounded-CL-Bold.ttf nowar/korean-NowarCompactRounded-CL-Light.ttf nowar/korean-NowarCompactRounded-CL-Regular.ttf nowar/korean-NowarCompactRounded-CL-Medium.ttf nowar/korean-NowarCompactRounded-CL-Bold.ttf
cp -r libsm NowarRoundedTypeface
cp LICENSE.txt NowarRoundedTypeface/
mkdir -p NowarRoundedTypeface/Fonts/
for file in $^; do cp $$file NowarRoundedTypeface/Fonts/$${file#nowar/*-}; done
7z a -t7z -m0=LZMA:d=512m:fb=273 -ms $@ NowarRoundedTypeface/ -x!NowarRoundedTypeface/Fonts/*.ttf
Expand Down
2 changes: 1 addition & 1 deletion README-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
| OSF | 传统字形(UI,不齐线数字)| 传统字形 | 传统字形 | 传统字形 |

* 西文:英语、西班牙语(拉丁美洲)、葡萄牙语、德语、西班牙语(欧洲)、法语、意大利语、俄语。
* UI:中西文共用的标点视作西文标点;比例假名。
* UI:中西文共用的标点视作西文标点;半角 CJK 标点;比例假名。

### SharedMedia 字体包

Expand Down
2 changes: 1 addition & 1 deletion README-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
| OSF | 傳統字形(UI,不齊線數字)| 傳統字形 | 傳統字形 | 傳統字形 |

* 西文:英語、西班牙語(拉丁美洲)、葡萄牙語、德語、西班牙語(歐洲)、法語、義大利語、俄語。
* UI:中西文共用的標點視作西文標點;比例假名。
* UI:中西文共用的標點視作西文標點;半形 CJK 標點;比例假名。

### SharedMedia 字型包

Expand Down
2 changes: 1 addition & 1 deletion README-Pinyin.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Bù tóng de dìqū biànhuà de zìtǐ xíngtài cǎiyòng le bù
| OSF | Chuántǒng de (UI xíngshì, bù duìqí jīzhǔnxiàn de shùzì) | Chuántǒng de | Chuántǒng de | Chuántǒng de |

* Xīfāng yǔyán: Yīngyǔ, Xībānyá yǔ (Lādīng Měizhōu), Pútáoyá yǔ, Déyǔ, Xībānyá yǔ (Ōuzhōu), Fǎyǔ, Yìdàlì yǔ, Éyǔ.
* UI xíngshì: bèi zhōngwén hé xīfāng wénzì gòngyòng de biāodiǎn fúhào, dōu bèi dāngzuò xīfāng wénzì de biāodiǎn fúhào; Rìyǔ jiǎmíng de kuāndù shì chéngbǐlì de.
* UI xíngshì: bèi zhōngwén hé xīfāng wénzì gòngyòng de biāodiǎn fúhào, dōu bèi dāngzuò xīfāng wénzì de biāodiǎn fúhào; zhōngwén de biāodiǎn fúhào shì bàn kuāndù de; Rìyǔ jiǎmíng de kuāndù shì chéngbǐlì de.

### SharedMedia zìtǐbāo

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The shape of Chinese characters follows different standards in different regiona
| OSF | Classic (UI, Oldstyle Figure) | Classic | Classic | Classic |

* European: English, Español (AL), Português, Deutsch, Español (EU), Français, Italiano, and Русский.
* UI: Ambiguous punctations are treated as Western; Kana are proportional.
* UI: Ambiguous punctations are treated as Western; CJK puctations are half-width; Kana are proportional.

### SharedMedia Font Provider

Expand Down
3 changes: 2 additions & 1 deletion configure.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ regionNameMap=([CN]=CN [TW]=TW [HK]=HK [JP]=JP [CL]=Classic [OSF]=Oldstyle)
encoding=(unspec gbk big5 korean)

cat >Makefile <<EOF
VERSION = 0.1.3
VERSION = 0.1.4
all: SharedMedia-NowarRounded-\${VERSION}.7z $(echo {CN,TW,HK,JP,CL,OSF}-{L,R,M,B}-\${VERSION}.7z)
Expand All @@ -22,6 +22,7 @@ clean:
SharedMedia-NowarRounded-\${VERSION}.7z: nowar/unspec-NowarWideRoundedUI-CN-Light.ttf nowar/unspec-NowarWideRoundedUI-CN-Regular.ttf nowar/unspec-NowarWideRoundedUI-CN-Medium.ttf nowar/unspec-NowarWideRoundedUI-CN-Bold.ttf nowar/unspec-NowarWideRoundedUI-TW-Light.ttf nowar/unspec-NowarWideRoundedUI-TW-Regular.ttf nowar/unspec-NowarWideRoundedUI-TW-Medium.ttf nowar/unspec-NowarWideRoundedUI-TW-Bold.ttf nowar/unspec-NowarWideRoundedUI-HK-Light.ttf nowar/unspec-NowarWideRoundedUI-HK-Regular.ttf nowar/unspec-NowarWideRoundedUI-HK-Medium.ttf nowar/unspec-NowarWideRoundedUI-HK-Bold.ttf nowar/unspec-NowarWideRoundedUI-JP-Light.ttf nowar/unspec-NowarWideRoundedUI-JP-Regular.ttf nowar/unspec-NowarWideRoundedUI-JP-Medium.ttf nowar/unspec-NowarWideRoundedUI-JP-Bold.ttf nowar/unspec-NowarWideRoundedUI-CL-Light.ttf nowar/unspec-NowarWideRoundedUI-CL-Regular.ttf nowar/unspec-NowarWideRoundedUI-CL-Medium.ttf nowar/unspec-NowarWideRoundedUI-CL-Bold.ttf nowar/unspec-NowarWideRoundedUI-OSF-Light.ttf nowar/unspec-NowarWideRoundedUI-OSF-Regular.ttf nowar/unspec-NowarWideRoundedUI-OSF-Medium.ttf nowar/unspec-NowarWideRoundedUI-OSF-Bold.ttf nowar/unspec-NowarCompactRoundedUI-CN-Light.ttf nowar/unspec-NowarCompactRoundedUI-CN-Regular.ttf nowar/unspec-NowarCompactRoundedUI-CN-Medium.ttf nowar/unspec-NowarCompactRoundedUI-CN-Bold.ttf nowar/unspec-NowarCompactRoundedUI-TW-Light.ttf nowar/unspec-NowarCompactRoundedUI-TW-Regular.ttf nowar/unspec-NowarCompactRoundedUI-TW-Medium.ttf nowar/unspec-NowarCompactRoundedUI-TW-Bold.ttf nowar/unspec-NowarCompactRoundedUI-HK-Light.ttf nowar/unspec-NowarCompactRoundedUI-HK-Regular.ttf nowar/unspec-NowarCompactRoundedUI-HK-Medium.ttf nowar/unspec-NowarCompactRoundedUI-HK-Bold.ttf nowar/unspec-NowarCompactRoundedUI-JP-Light.ttf nowar/unspec-NowarCompactRoundedUI-JP-Regular.ttf nowar/unspec-NowarCompactRoundedUI-JP-Medium.ttf nowar/unspec-NowarCompactRoundedUI-JP-Bold.ttf nowar/unspec-NowarCompactRoundedUI-CL-Light.ttf nowar/unspec-NowarCompactRoundedUI-CL-Regular.ttf nowar/unspec-NowarCompactRoundedUI-CL-Medium.ttf nowar/unspec-NowarCompactRoundedUI-CL-Bold.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Light.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Regular.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Medium.ttf nowar/unspec-NowarCompactRoundedUI-OSF-Bold.ttf nowar/gbk-NowarRounded-CN-Light.ttf nowar/gbk-NowarRounded-CN-Regular.ttf nowar/gbk-NowarRounded-CN-Medium.ttf nowar/gbk-NowarRounded-CN-Bold.ttf nowar/gbk-NowarWideRounded-CN-Light.ttf nowar/gbk-NowarWideRounded-CN-Regular.ttf nowar/gbk-NowarWideRounded-CN-Medium.ttf nowar/gbk-NowarWideRounded-CN-Bold.ttf nowar/gbk-NowarCompactRounded-CN-Light.ttf nowar/gbk-NowarCompactRounded-CN-Regular.ttf nowar/gbk-NowarCompactRounded-CN-Medium.ttf nowar/gbk-NowarCompactRounded-CN-Bold.ttf nowar/big5-NowarRounded-TW-Light.ttf nowar/big5-NowarRounded-TW-Regular.ttf nowar/big5-NowarRounded-TW-Medium.ttf nowar/big5-NowarRounded-TW-Bold.ttf nowar/big5-NowarWideRounded-TW-Light.ttf nowar/big5-NowarWideRounded-TW-Regular.ttf nowar/big5-NowarWideRounded-TW-Medium.ttf nowar/big5-NowarWideRounded-TW-Bold.ttf nowar/big5-NowarCompactRounded-TW-Light.ttf nowar/big5-NowarCompactRounded-TW-Regular.ttf nowar/big5-NowarCompactRounded-TW-Medium.ttf nowar/big5-NowarCompactRounded-TW-Bold.ttf nowar/big5-NowarRounded-HK-Light.ttf nowar/big5-NowarRounded-HK-Regular.ttf nowar/big5-NowarRounded-HK-Medium.ttf nowar/big5-NowarRounded-HK-Bold.ttf nowar/big5-NowarWideRounded-HK-Light.ttf nowar/big5-NowarWideRounded-HK-Regular.ttf nowar/big5-NowarWideRounded-HK-Medium.ttf nowar/big5-NowarWideRounded-HK-Bold.ttf nowar/big5-NowarCompactRounded-HK-Light.ttf nowar/big5-NowarCompactRounded-HK-Regular.ttf nowar/big5-NowarCompactRounded-HK-Medium.ttf nowar/big5-NowarCompactRounded-HK-Bold.ttf nowar/korean-NowarRounded-CL-Light.ttf nowar/korean-NowarRounded-CL-Regular.ttf nowar/korean-NowarRounded-CL-Medium.ttf nowar/korean-NowarRounded-CL-Bold.ttf nowar/korean-NowarWideRounded-CL-Light.ttf nowar/korean-NowarWideRounded-CL-Regular.ttf nowar/korean-NowarWideRounded-CL-Medium.ttf nowar/korean-NowarWideRounded-CL-Bold.ttf nowar/korean-NowarCompactRounded-CL-Light.ttf nowar/korean-NowarCompactRounded-CL-Regular.ttf nowar/korean-NowarCompactRounded-CL-Medium.ttf nowar/korean-NowarCompactRounded-CL-Bold.ttf
cp -r libsm NowarRoundedTypeface
cp LICENSE.txt NowarRoundedTypeface/
mkdir -p NowarRoundedTypeface/Fonts/
for file in \$^; do cp \$\$file NowarRoundedTypeface/Fonts/\$\${file#nowar/*-}; done
7z a -t7z -m0=LZMA:d=512m:fb=273 -ms \$@ NowarRoundedTypeface/ -x!NowarRoundedTypeface/Fonts/*.ttf
Expand Down
18 changes: 18 additions & 0 deletions fontlib/dereference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import copy
from fontlib.transform import Transform

def Dereference(glyph, font):
if 'references' not in glyph:
return copy.deepcopy(glyph)

result = dict(glyph)
del result['references']
result['contours'] = []

for ref in glyph['references']:
target = font['glyf'][ref['glyph']]
data = Dereference(target, font) if 'references' in target else copy.deepcopy(target)
Transform(data, ref['a'], ref['b'], ref['c'], ref['d'], ref['x'], ref['y'])
result['contours'].extend(data['contours'])

return result
10 changes: 10 additions & 0 deletions fontlib/pkana.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ def ProportionalizeKana(font):
Transform(glyph, 1, 0, 0, 1, d['dx'], 0)
if 'dWidth' in d:
ChangeAdvanceWidth(glyph, d['dWidth'])

def ApplyPalt(font):
for palt in GetLookupPalt(font):
for sub in palt['subtables']:
for (n, d) in sub.items():
glyph = font['glyf'][n]
if 'dx' in d:
Transform(glyph, 1, 0, 0, 1, d['dx'], 0)
if 'dWidth' in d:
ChangeAdvanceWidth(glyph, d['dWidth'])
12 changes: 8 additions & 4 deletions fontlib/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ def Transform(glyph, a, b, c, d, dx, dy):
if 'contours' in glyph:
for contour in glyph['contours']:
for point in contour:
point['x'] = a * point['x'] + b * point['y'] + dx
point['y'] = c * point['x'] + d * point['y'] + dy
x = point['x']
y = point['y']
point['x'] = a * x + b * y + dx
point['y'] = c * x + d * y + dy
if 'references' in glyph:
for reference in glyph['references']:
reference['x'] = a * reference['x'] + b * reference['y'] + dx
reference['y'] = c * reference['x'] + d * reference['y'] + dy
x = reference['x']
y = reference['y']
reference['x'] = a * x + b * y + dx
reference['y'] = c * x + d * y + dy

def ChangeAdvanceWidth(glyph, adv):
glyph['advanceWidth'] += adv
109 changes: 109 additions & 0 deletions fontlib/unicode.py

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions merge-compact.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import json

from fontlib.merge import MergeBelow

def NameFont(font, region, weight, version):

Expand Down Expand Up @@ -186,11 +186,7 @@ def NameFont(font, region, weight, version):
baseFont['OS_2']['ulCodePageRange1'][encoding] = True
NameFont(baseFont, 'Classic' if region == 'CL' else region, weight, version)

for (uniId, glyphName) in asianFont['cmap'].items():
if uniId not in baseFont['cmap'].keys():
baseFont['cmap'][uniId] = glyphName
if glyphName not in baseFont['glyf'].keys():
baseFont['glyf'][glyphName] = asianFont['glyf'][glyphName]
MergeBelow(baseFont, asianFont)

# quotes, em-dash and ellipsis
for u in [0x2014, 0x2018, 0x2019, 0x201C, 0x201D, 0x2026]:
Expand Down
4 changes: 2 additions & 2 deletions merge-compactui.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import json

from fontlib.pkana import ProportionalizeKana
from fontlib.pkana import ApplyPalt
from fontlib.merge import MergeBelow

def NameFont(font, region, weight, version):
Expand Down Expand Up @@ -195,7 +195,7 @@ def NameFont(font, region, weight, version):
baseFont['OS_2']['ulCodePageRange1'][encoding] = True
NameFont(baseFont, region2, weight, version)

ProportionalizeKana(asianFont)
ApplyPalt(asianFont)
MergeBelow(baseFont, asianFont)

outStr = json.dumps(baseFont, ensure_ascii=False)
Expand Down
8 changes: 2 additions & 6 deletions merge-rounded.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import json

from fontlib.merge import MergeBelow

def NameFont(font, region, weight, version):

Expand Down Expand Up @@ -186,11 +186,7 @@ def NameFont(font, region, weight, version):
baseFont['OS_2']['ulCodePageRange1'][encoding] = True
NameFont(baseFont, 'Classic' if region == 'CL' else region, weight, version)

for (uniId, glyphName) in asianFont['cmap'].items():
if uniId not in baseFont['cmap'].keys():
baseFont['cmap'][uniId] = glyphName
if glyphName not in baseFont['glyf'].keys():
baseFont['glyf'][glyphName] = asianFont['glyf'][glyphName]
MergeBelow(baseFont, asianFont)

# quotes, em-dash and ellipsis
for u in [0x2014, 0x2018, 0x2019, 0x201C, 0x201D, 0x2026]:
Expand Down
8 changes: 2 additions & 6 deletions merge-warcraft.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import json

from fontlib.merge import MergeBelow

def NameFont(font, region, weight, version):

Expand Down Expand Up @@ -192,11 +192,7 @@ def NameFont(font, region, weight, version):
for n in ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']:
baseFont['glyf'][n] = numFont['glyf'][n]

for (uniId, glyphName) in asianFont['cmap'].items():
if uniId not in baseFont['cmap'].keys():
baseFont['cmap'][uniId] = glyphName
if glyphName not in baseFont['glyf'].keys():
baseFont['glyf'][glyphName] = asianFont['glyf'][glyphName]
MergeBelow(baseFont, asianFont)

# quotes, em-dash and ellipsis
for u in [0x2014, 0x2018, 0x2019, 0x201C, 0x201D, 0x2026]:
Expand Down
8 changes: 2 additions & 6 deletions merge-wide.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import json

from fontlib.merge import MergeBelow

def NameFont(font, region, weight, version):

Expand Down Expand Up @@ -186,11 +186,7 @@ def NameFont(font, region, weight, version):
baseFont['OS_2']['ulCodePageRange1'][encoding] = True
NameFont(baseFont, 'Classic' if region == 'CL' else region, weight, version)

for (uniId, glyphName) in asianFont['cmap'].items():
if uniId not in baseFont['cmap'].keys():
baseFont['cmap'][uniId] = glyphName
if glyphName not in baseFont['glyf'].keys():
baseFont['glyf'][glyphName] = asianFont['glyf'][glyphName]
MergeBelow(baseFont, asianFont)

# quotes, em-dash and ellipsis
for u in [0x2014, 0x2018, 0x2019, 0x201C, 0x201D, 0x2026]:
Expand Down
4 changes: 2 additions & 2 deletions merge-wideui.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import json

from fontlib.pkana import ProportionalizeKana
from fontlib.pkana import ApplyPalt
from fontlib.merge import MergeBelow

def NameFont(font, region, weight, version):
Expand Down Expand Up @@ -194,7 +194,7 @@ def NameFont(font, region, weight, version):
baseFont['OS_2']['ulCodePageRange1'][encoding] = True
NameFont(baseFont, region2, weight, version)

ProportionalizeKana(asianFont)
ApplyPalt(asianFont)
MergeBelow(baseFont, asianFont)

outStr = json.dumps(baseFont, ensure_ascii=False)
Expand Down

0 comments on commit f6ddd87

Please sign in to comment.