Skip to content

Commit

Permalink
Update winfont.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GuiWonder committed Mar 16, 2023
1 parent 6939936 commit 494e085
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main/winfont.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
otfccbuild += '2'
TG= ('msyh', 'msjh', 'mingliu', 'mingliub', 'simsun', 'simsunb', 'yugoth', 'msgothic', 'malgun', 'msmincho', 'meiryo', 'batang', 'gulim', 'all', 'allsans', 'allserif')
WT=('thin', 'extralight', 'light', 'semilight', 'demilight', 'normal', 'regular', 'medium', 'semibold', 'bold', 'black', 'heavy')
end={'Thin':'th', 'ExtraLight':'xl', 'Light':'l', 'Semilight':'sl', 'DemiLight':'dm', 'Normal':'nm', 'Regular':'', 'Medium':'md', 'SemiBold':'sb', 'Bold':'bd', 'Black':'bl', 'Heavy':'hv'}

def getwt(font):
if 'macStyle' in font['head'] and 'bold' in font['head']['macStyle'] and font['head']['macStyle']['bold']:
Expand Down Expand Up @@ -57,7 +58,6 @@ def wtbuil(nml, wt):
return nwtnm

def bldttfft(font, tgft, wt):
end={'Thin':'th', 'ExtraLight':'xl', 'Light':'l', 'Semilight':'sl', 'DemiLight':'dm', 'Normal':'nm', 'Regular':'', 'Medium':'md', 'SemiBold':'sb', 'Bold':'bd', 'Black':'bl', 'Heavy':'hv'}
ncfg=json.load(open(os.path.join(pydir, f'names/{tgft}.json'), 'r', encoding = 'utf-8'))
font['OS_2']['ulCodePageRange1']=ncfg['ulCodePageRange1']
if tgft=='malgun':wts=('Regular', 'Bold', 'Semilight', 'Light')
Expand All @@ -78,17 +78,17 @@ def bldttfft(font, tgft, wt):
print('完成!')

def bldttcft(font, tgft, wt):
end={'Thin':'th', 'ExtraLight':'xl', 'Light':'l', 'Semilight':'sl', 'DemiLight':'dm', 'Normal':'nm', 'Regular':'', 'Medium':'md', 'SemiBold':'sb', 'Bold':'bd', 'Black':'bl', 'Heavy':'hv'}
ncfg=json.load(open(os.path.join(pydir, f'names/{tgft}.json'), 'r', encoding = 'utf-8'))
font['OS_2']['ulCodePageRange1']=ncfg['ulCodePageRange1']
if tgft in ('msyh', 'msjh', 'meiryo'):
if wt not in ('Regular', 'Bold', 'Light'):
nmslist=[wtbuil(ncfg[tgft+'l'], wt), wtbuil(ncfg[tgft+'ui'+'l'], wt)]
else:
nmslist=[ncfg[tgft+end[wt]], ncfg[tgft+'ui'+end[wt]]]
if tgft=='meiryo': end[wt]=end[wt].replace('bd', 'b')
ttflist=[otpth(tgft+end[wt]+'.ttf'), otpth(tgft+'ui'+end[wt]+'.ttf')]
ttcfil=otpth(tgft+end[wt]+'.ttc')
edl=end[wt]
if tgft=='meiryo': edl=end[wt].replace('bd', 'b')
ttflist=[otpth(tgft+edl+'.ttf'), otpth(tgft+'ui'+edl+'.ttf')]
ttcfil=otpth(tgft+edl+'.ttc')
elif tgft=='simsun':
if wt not in ('Regular', 'Bold', 'Light'):
nmslist=[wtbuil(ncfg[tgft+'l'], wt), wtbuil(ncfg['n'+tgft+'l'], wt)]
Expand Down

0 comments on commit 494e085

Please sign in to comment.