@@ -50,37 +50,22 @@ def getgname(s):
50
50
51
51
def setpun (pzh , loczh ):
52
52
pg = getgname (pzh )
53
- zhp = list ()
54
- etb = set ()
55
- ztb = set ()
53
+ rplg = dict ()
56
54
for tb in loczh :
57
- allen = 0
58
- for ctb in font ['GSUB' ]['lookups' ][tb ]['subtables' ]:
59
- allen += len (ctb )
60
- if allen > 60 :
61
- ztb .add (tb )
62
- else :
63
- etb .add (tb )
64
- for tb in ztb :
65
- for subtable in font ['GSUB' ]['lookups' ][tb ]['subtables' ]:
66
- for j , t in list (subtable .items ()):
67
- for p1 in pzh :
68
- cod = str (ord (p1 ))
69
- if cod in font ['cmap' ]:
70
- g = font ['cmap' ][cod ]
71
- if g == j :
72
- zhp .append ((cod , t ))
73
- for tb in etb :
74
- a = gettbs (tb , pg , True )
75
- if len (a )> 0 :
76
- relp = dict ()
77
- for itm in a :
78
- if itm [0 ]!= itm [1 ]:
79
- relp [itm [0 ]]= itm [1 ]
80
- replg (relp )
81
- for punzh in zhp :
82
- print ('Processing' , chr (int (punzh [0 ])))
83
- font ['cmap' ][punzh [0 ]]= punzh [1 ]
55
+ if tb in locjan :
56
+ continue
57
+ for glin in pg :
58
+ for subtable in font ['GSUB' ]['lookups' ][tb ]['subtables' ]:
59
+ if glin in subtable :
60
+ rplg [glin ]= subtable [glin ]
61
+ for tb in locjan :
62
+ if tb not in loczh :
63
+ continue
64
+ for glin in pg :
65
+ for subtable in font ['GSUB' ]['lookups' ][tb ]['subtables' ]:
66
+ if glin not in rplg and glin in subtable :
67
+ rplg [glin ]= subtable [glin ]
68
+ replg (rplg )
84
69
85
70
def gfmloc (g , loczh ):
86
71
for zhtb in loczh :
@@ -882,6 +867,7 @@ def savefont(fontpath, tmpfl):
882
867
break
883
868
print ('Getting the localized lookups table...' )
884
869
loc = set ()
870
+ locjan = set ()
885
871
lockor = set ()
886
872
loczhs = set ()
887
873
loczht = set ()
@@ -890,7 +876,9 @@ def savefont(fontpath, tmpfl):
890
876
for fs in font ['GSUB' ]['languages' ][lang ]['features' ]:
891
877
if fs .split ('_' )[0 ]== 'locl' :
892
878
loc .update (set (font ['GSUB' ]['features' ][fs ]))
893
- if lang .split ('_' )[- 1 ].strip ()== 'KOR' :
879
+ if lang .split ('_' )[- 1 ].strip ()== 'JAN' :
880
+ locjan .update (set (font ['GSUB' ]['features' ][fs ]))
881
+ elif lang .split ('_' )[- 1 ].strip ()== 'KOR' :
894
882
lockor .update (set (font ['GSUB' ]['features' ][fs ]))
895
883
elif lang .split ('_' )[- 1 ].strip ()== 'ZHS' :
896
884
loczhs .update (set (font ['GSUB' ]['features' ][fs ]))
@@ -932,7 +920,7 @@ def savefont(fontpath, tmpfl):
932
920
AAJP = getvcmp ()
933
921
rmloc ()
934
922
exn = inf .split ('.' )[- 1 ].lower ()
935
- print (f 'Generating { exn . upper () } ...' )
923
+ print ('Generating fonts ...' )
936
924
for aa1 in (AA , AATC , AASC , AAJP ):
937
925
aa1 ['file' ]= os .path .join (outd , aa1 ['file' ]+ '.' + exn )
938
926
font ['cmap' ]= aa1 ['cmap' ]
0 commit comments