fixed: encoding problem with vertical characters.
parent
e927bd307e
commit
8a70a9f657
|
@ -47,6 +47,7 @@ class CMapConverter(object):
|
||||||
if not line: continue
|
if not line: continue
|
||||||
values = line.split('\t')
|
values = line.split('\t')
|
||||||
if encs is None:
|
if encs is None:
|
||||||
|
assert values[0] == 'CID'
|
||||||
encs = values
|
encs = values
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -84,16 +85,12 @@ class CMapConverter(object):
|
||||||
(c,_) = chars[0]
|
(c,_) = chars[0]
|
||||||
return c
|
return c
|
||||||
|
|
||||||
cid = None
|
cid = int(values[0])
|
||||||
unimap_h = {}
|
unimap_h = {}
|
||||||
unimap_v = {}
|
unimap_v = {}
|
||||||
for (enc,value) in zip(encs, values):
|
for (enc,value) in zip(encs, values):
|
||||||
if enc == 'CID':
|
if enc == 'CID': continue
|
||||||
cid = int(value)
|
if value == '*': continue
|
||||||
continue
|
|
||||||
assert cid is not None
|
|
||||||
if value == '*':
|
|
||||||
continue
|
|
||||||
|
|
||||||
# hcodes, vcodes: encoded bytes for each writing mode.
|
# hcodes, vcodes: encoded bytes for each writing mode.
|
||||||
hcodes = []
|
hcodes = []
|
||||||
|
@ -128,7 +125,9 @@ class CMapConverter(object):
|
||||||
# Determine the "most popular" candidate.
|
# Determine the "most popular" candidate.
|
||||||
if unimap_h:
|
if unimap_h:
|
||||||
self.cid2unichr_h[cid] = pick(unimap_h)
|
self.cid2unichr_h[cid] = pick(unimap_h)
|
||||||
|
if unimap_v or unimap_h:
|
||||||
self.cid2unichr_v[cid] = pick(unimap_v or unimap_h)
|
self.cid2unichr_v[cid] = pick(unimap_v or unimap_h)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def dump_cmap(self, fp, enc):
|
def dump_cmap(self, fp, enc):
|
||||||
|
|
Loading…
Reference in New Issue