comment out some print lines used for debugging
parent
927b066b3a
commit
170bcdad0e
|
@ -18,7 +18,10 @@ def codes_to_string(codes):
|
||||||
pieces = codes.split ("_")
|
pieces = codes.split ("_")
|
||||||
string = "".join ([unichr (int (code, 16)) for code in pieces])
|
string = "".join ([unichr (int (code, 16)) for code in pieces])
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
string = unichr (int (codes, 16))
|
string = unichr (int (codes, 16))
|
||||||
|
except:
|
||||||
|
raise ValueError("uh-oh, no unichr for '%s'" % codes)
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,13 +148,13 @@ def add_lig_sequence(ligatures, seq, n):
|
||||||
rev_seq.reverse()
|
rev_seq.reverse()
|
||||||
trseq = tuple(rev_seq)
|
trseq = tuple(rev_seq)
|
||||||
if trseq in ligatures:
|
if trseq in ligatures:
|
||||||
print 'rev lig sequence %s, replace %s with %s' % (
|
# print 'rev lig sequence %s, replace %s with %s' % (
|
||||||
trseq, ligatures[trseq], n)
|
# trseq, ligatures[trseq], n)
|
||||||
ligatures[trseq] = n
|
ligatures[trseq] = n
|
||||||
|
|
||||||
|
|
||||||
for (u, filename) in img_pairs:
|
for (u, filename) in img_pairs:
|
||||||
print "Adding glyph for U+%s" % ",".join (["%04X" % ord (char) for char in u])
|
# print "Adding glyph for U+%s" % ",".join (["%04X" % ord (char) for char in u])
|
||||||
n = glyph_name (u)
|
n = glyph_name (u)
|
||||||
glyph_names.add(n)
|
glyph_names.add(n)
|
||||||
|
|
||||||
|
@ -185,13 +188,14 @@ for k, v in ligatures.iteritems():
|
||||||
|
|
||||||
for base in sorted(keyed_ligatures):
|
for base in sorted(keyed_ligatures):
|
||||||
pairs = keyed_ligatures[base]
|
pairs = keyed_ligatures[base]
|
||||||
print 'base %s has %d sequences' % (base, len(pairs))
|
# print 'base %s has %d sequences' % (base, len(pairs))
|
||||||
|
|
||||||
# Sort longest first, this ensures longer sequences with common prefixes
|
# Sort longest first, this ensures longer sequences with common prefixes
|
||||||
# are handled before shorter ones. It would be better to have multiple
|
# are handled before shorter ones. It would be better to have multiple
|
||||||
# lookups, most likely.
|
# lookups, most likely.
|
||||||
pairs.sort(key = lambda pair: (len(pair[0]), pair[0]), reverse=True)
|
pairs.sort(key = lambda pair: (len(pair[0]), pair[0]), reverse=True)
|
||||||
for seq, name in pairs:
|
for seq, name in pairs:
|
||||||
print seq, name
|
# print seq, name
|
||||||
add_ligature(font, seq, name)
|
add_ligature(font, seq, name)
|
||||||
|
|
||||||
font.saveXML (out_file)
|
font.saveXML (out_file)
|
||||||
|
|
|
@ -84,7 +84,7 @@ class CBDT:
|
||||||
write_func = self.image_write_func (image_format)
|
write_func = self.image_write_func (image_format)
|
||||||
for glyph in glyphs:
|
for glyph in glyphs:
|
||||||
img_file = glyph_filenames[glyph]
|
img_file = glyph_filenames[glyph]
|
||||||
print 'writing data for glyph %s' % path.basename(img_file)
|
# print 'writing data for glyph %s' % path.basename(img_file)
|
||||||
offset = self.tell ()
|
offset = self.tell ()
|
||||||
write_func (PNG (img_file))
|
write_func (PNG (img_file))
|
||||||
self.glyph_maps.append (GlyphMap (glyph, offset, image_format))
|
self.glyph_maps.append (GlyphMap (glyph, offset, image_format))
|
||||||
|
@ -113,7 +113,7 @@ class CBDT:
|
||||||
if y_bearing == 128:
|
if y_bearing == 128:
|
||||||
y_bearing = 127
|
y_bearing = 127
|
||||||
advance = width
|
advance = width
|
||||||
print "small glyph metrics h: %d w: %d" % (height, width)
|
# print "small glyph metrics h: %d w: %d" % (height, width)
|
||||||
# smallGlyphMetrics
|
# smallGlyphMetrics
|
||||||
# Type Name
|
# Type Name
|
||||||
# BYTE height
|
# BYTE height
|
||||||
|
@ -488,7 +488,8 @@ By default they are dropped.
|
||||||
glyph_imgs[glyph_id] = img_file
|
glyph_imgs[glyph_id] = img_file
|
||||||
if "verbose" in options:
|
if "verbose" in options:
|
||||||
uchars_name = ",".join (["%04X" % ord (char) for char in uchars])
|
uchars_name = ",".join (["%04X" % ord (char) for char in uchars])
|
||||||
print "Matched U+%s: id=%d name=%s image=%s" % (uchars_name, glyph_id, glyph_name, img_file)
|
# print "Matched U+%s: id=%d name=%s image=%s" % (
|
||||||
|
# uchars_name, glyph_id, glyph_name, img_file)
|
||||||
|
|
||||||
advance += glyph_metrics[glyph_name][0]
|
advance += glyph_metrics[glyph_name][0]
|
||||||
w, h = PNG (img_file).get_size ()
|
w, h = PNG (img_file).get_size ()
|
||||||
|
|
Loading…
Reference in New Issue