From e68659e5c76fa45bb0549444fda5da0566f7fb48 Mon Sep 17 00:00:00 2001 From: Andrew Clemons Date: Tue, 11 Apr 2017 00:49:08 +0100 Subject: system/noto-emoji: Updated for version gitff93f20. Signed-off-by: David Spencer --- system/noto-emoji/noto-emoji.SlackBuild | 6 +- system/noto-emoji/noto-emoji.info | 10 +- .../1e8488167c26ac1e780e374961d08f1fb1d1e880.patch | 84 ----------- .../293da509043595a052efbead51a9effbbb13794c.patch | 84 +++++++++++ .../c8259f2cb0fe0579e1391811edaf8ed5bb86e220.patch | 162 +++++++++++++++++++++ .../d34c13fb99f07d09c0c98192e7998186a622e28c.patch | 162 --------------------- 6 files changed, 254 insertions(+), 254 deletions(-) delete mode 100644 system/noto-emoji/patches/1e8488167c26ac1e780e374961d08f1fb1d1e880.patch create mode 100644 system/noto-emoji/patches/293da509043595a052efbead51a9effbbb13794c.patch create mode 100644 system/noto-emoji/patches/c8259f2cb0fe0579e1391811edaf8ed5bb86e220.patch delete mode 100644 system/noto-emoji/patches/d34c13fb99f07d09c0c98192e7998186a622e28c.patch (limited to 'system') diff --git a/system/noto-emoji/noto-emoji.SlackBuild b/system/noto-emoji/noto-emoji.SlackBuild index d1103d25df..12e290c905 100644 --- a/system/noto-emoji/noto-emoji.SlackBuild +++ b/system/noto-emoji/noto-emoji.SlackBuild @@ -23,8 +23,8 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=noto-emoji -GITREV=${GITREV:-732cb454ac854efe6ce00630fee9ae5499062056} -NOTOTOOLSGITREV=${NOTOTOOLSGITREV:-4bcd7d5bc55963c30cceaadf637836446662fec3} +GITREV=${GITREV:-ff93f20f6669ee89c819640485e4e555d3df32e9} +NOTOTOOLSGITREV=${NOTOTOOLSGITREV:-eb00fba810c3472222ef1e6e91a054626b11b3bf} VERSION=${VERSION:-git$(echo "$GITREV" | sed 's/^\(.\{7\}\).*$/\1/')} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -78,7 +78,7 @@ export PYTHONPATH=$(pwd) cd .. # Slackware's Python is a narrow-build - workaround -for sha in d34c13fb99f07d09c0c98192e7998186a622e28c 1e8488167c26ac1e780e374961d08f1fb1d1e880 ; do +for sha in c8259f2cb0fe0579e1391811edaf8ed5bb86e220 293da509043595a052efbead51a9effbbb13794c ; do patch -p1 < $CWD/patches/$sha.patch done diff --git a/system/noto-emoji/noto-emoji.info b/system/noto-emoji/noto-emoji.info index 4339049cfc..2fd28daba9 100644 --- a/system/noto-emoji/noto-emoji.info +++ b/system/noto-emoji/noto-emoji.info @@ -1,10 +1,10 @@ PRGNAM="noto-emoji" -VERSION="git732cb45" +VERSION="gitff93f20" HOMEPAGE="https://www.google.com/get/noto/help/emoji/" -DOWNLOAD="https://github.com/googlei18n/noto-emoji/archive/732cb454ac854efe6ce00630fee9ae5499062056/noto-emoji-732cb454ac854efe6ce00630fee9ae5499062056.tar.gz \ - https://github.com/googlei18n/nototools/archive/4bcd7d5bc55963c30cceaadf637836446662fec3/nototools-4bcd7d5bc55963c30cceaadf637836446662fec3.tar.gz" -MD5SUM="760193841db3b502fbb3462384eca64b \ - 40d0a5ac9d5ad1aeb9e9be43017828f3" +DOWNLOAD="https://github.com/googlei18n/noto-emoji/archive/ff93f20f6669ee89c819640485e4e555d3df32e9/noto-emoji-ff93f20f6669ee89c819640485e4e555d3df32e9.tar.gz \ + https://github.com/googlei18n/nototools/archive/eb00fba810c3472222ef1e6e91a054626b11b3bf/nototools-eb00fba810c3472222ef1e6e91a054626b11b3bf.tar.gz" +MD5SUM="8f2686d7c2a558022feb7c8b25ad66d7 \ + 96d8dad6f19386032830bc46f8919a74" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="optipng python-fonttools" diff --git a/system/noto-emoji/patches/1e8488167c26ac1e780e374961d08f1fb1d1e880.patch b/system/noto-emoji/patches/1e8488167c26ac1e780e374961d08f1fb1d1e880.patch deleted file mode 100644 index 35bdd3d661..0000000000 --- a/system/noto-emoji/patches/1e8488167c26ac1e780e374961d08f1fb1d1e880.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 1e8488167c26ac1e780e374961d08f1fb1d1e880 Mon Sep 17 00:00:00 2001 -From: Andrew Clemons -Date: Thu, 9 Mar 2017 21:48:18 +1300 -Subject: [PATCH] Add support for "narrow" python to emoji_builder.py - -The code currently only works with wide builds since it does not take -UTF-16 surrogate pairs into account. ---- - third_party/color_emoji/emoji_builder.py | 41 ++++++++++++++++++++++++++++---- - 1 file changed, 37 insertions(+), 4 deletions(-) - -diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py -index c118e83..3d3e0c8 100644 ---- a/third_party/color_emoji/emoji_builder.py -+++ b/third_party/color_emoji/emoji_builder.py -@@ -25,10 +25,36 @@ - - from nototools import font_data - -+def myunichr(cp): -+ if sys.maxunicode < 0x10FFFF and cp > 0xFFFF: -+ return ("\\U" + hex(cp)[2:].zfill(8)).decode("unicode-escape") -+ return unichr(cp) -+ -+def myord(high, low): -+ return (ord(high) - 0xD800) * 0x400 + (ord(low) - 0xDC00) + 0x10000 -+ -+def begins_with_surrogate(string): -+ return sys.maxunicode < 0x10FFFF and len(string) > 1 and (0xD800 <= ord(string[0]) <= 0xDBFF) and (0xDC00 <= ord(string[1]) <= 0xDFFF) -+ - def get_glyph_name_from_gsub (string, font, cmap_dict): - ligatures = font['GSUB'].table.LookupList.Lookup[0].SubTable[0].ligatures -- first_glyph = cmap_dict[ord (string[0])] -- rest_of_glyphs = [cmap_dict[ord (ch)] for ch in string[1:]] -+ -+ if begins_with_surrogate(string): -+ first_glyph = cmap_dict[myord(string[0], string[1])] -+ string = string[2:] -+ else: -+ first_glyph = cmap_dict[ord (string[0])] -+ string = string[1:] -+ -+ rest_of_glyphs = [] -+ while (len(string) > 0): -+ if begins_with_surrogate(string): -+ rest_of_glyphs.append(cmap_dict[myord(string[0], string[1])]) -+ string = string[2:] -+ else: -+ rest_of_glyphs.append(cmap_dict[ord (string[0])]) -+ string = string[1:] -+ - for ligature in ligatures[first_glyph]: - if ligature.Component == rest_of_glyphs: - return ligature.LigGlyph -@@ -462,13 +488,13 @@ def is_vs(cp): - if "_" in codes: - pieces = codes.split ("_") - cps = [int(code, 16) for code in pieces] -- uchars = "".join ([unichr(cp) for cp in cps if not is_vs(cp)]) -+ uchars = "".join ([myunichr(cp) for cp in cps if not is_vs(cp)]) - else: - cp = int(codes, 16) - if is_vs(cp): - print "ignoring unexpected vs input %04x" % cp - continue -- uchars = unichr(cp) -+ uchars = myunichr(cp) - img_files[uchars] = img_file - if not img_files: - raise Exception ("No image files found in '%s'." % glb) -@@ -483,6 +509,13 @@ def is_vs(cp): - except: - print "no cmap entry for %x" % ord(uchars) - raise ValueError("%x" % ord(uchars)) -+ elif len (uchars) == 2 and begins_with_surrogate(uchars): -+ cp = myord(uchars[0], uchars[1]) -+ try: -+ glyph_name = unicode_cmap.cmap[cp] -+ except: -+ print "no cmap entry for %x" % cp -+ raise ValueError("%x" % ord(uchars)) - else: - glyph_name = get_glyph_name_from_gsub (uchars, font, unicode_cmap.cmap) - glyph_id = font.getGlyphID (glyph_name) diff --git a/system/noto-emoji/patches/293da509043595a052efbead51a9effbbb13794c.patch b/system/noto-emoji/patches/293da509043595a052efbead51a9effbbb13794c.patch new file mode 100644 index 0000000000..5aea67682f --- /dev/null +++ b/system/noto-emoji/patches/293da509043595a052efbead51a9effbbb13794c.patch @@ -0,0 +1,84 @@ +From 293da509043595a052efbead51a9effbbb13794c Mon Sep 17 00:00:00 2001 +From: Andrew Clemons +Date: Thu, 9 Mar 2017 21:48:18 +1300 +Subject: [PATCH] Add support for "narrow" python to emoji_builder.py + +The code currently only works with wide builds since it does not take +UTF-16 surrogate pairs into account. +--- + third_party/color_emoji/emoji_builder.py | 41 ++++++++++++++++++++++++++++---- + 1 file changed, 37 insertions(+), 4 deletions(-) + +diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py +index c118e83..3d3e0c8 100644 +--- a/third_party/color_emoji/emoji_builder.py ++++ b/third_party/color_emoji/emoji_builder.py +@@ -25,10 +25,36 @@ + + from nototools import font_data + ++def myunichr(cp): ++ if sys.maxunicode < 0x10FFFF and cp > 0xFFFF: ++ return ("\\U" + hex(cp)[2:].zfill(8)).decode("unicode-escape") ++ return unichr(cp) ++ ++def myord(high, low): ++ return (ord(high) - 0xD800) * 0x400 + (ord(low) - 0xDC00) + 0x10000 ++ ++def begins_with_surrogate(string): ++ return sys.maxunicode < 0x10FFFF and len(string) > 1 and (0xD800 <= ord(string[0]) <= 0xDBFF) and (0xDC00 <= ord(string[1]) <= 0xDFFF) ++ + def get_glyph_name_from_gsub (string, font, cmap_dict): + ligatures = font['GSUB'].table.LookupList.Lookup[0].SubTable[0].ligatures +- first_glyph = cmap_dict[ord (string[0])] +- rest_of_glyphs = [cmap_dict[ord (ch)] for ch in string[1:]] ++ ++ if begins_with_surrogate(string): ++ first_glyph = cmap_dict[myord(string[0], string[1])] ++ string = string[2:] ++ else: ++ first_glyph = cmap_dict[ord (string[0])] ++ string = string[1:] ++ ++ rest_of_glyphs = [] ++ while (len(string) > 0): ++ if begins_with_surrogate(string): ++ rest_of_glyphs.append(cmap_dict[myord(string[0], string[1])]) ++ string = string[2:] ++ else: ++ rest_of_glyphs.append(cmap_dict[ord (string[0])]) ++ string = string[1:] ++ + for ligature in ligatures[first_glyph]: + if ligature.Component == rest_of_glyphs: + return ligature.LigGlyph +@@ -462,13 +488,13 @@ def is_vs(cp): + if "_" in codes: + pieces = codes.split ("_") + cps = [int(code, 16) for code in pieces] +- uchars = "".join ([unichr(cp) for cp in cps if not is_vs(cp)]) ++ uchars = "".join ([myunichr(cp) for cp in cps if not is_vs(cp)]) + else: + cp = int(codes, 16) + if is_vs(cp): + print "ignoring unexpected vs input %04x" % cp + continue +- uchars = unichr(cp) ++ uchars = myunichr(cp) + img_files[uchars] = img_file + if not img_files: + raise Exception ("No image files found in '%s'." % glb) +@@ -483,6 +509,13 @@ def is_vs(cp): + except: + print "no cmap entry for %x" % ord(uchars) + raise ValueError("%x" % ord(uchars)) ++ elif len (uchars) == 2 and begins_with_surrogate(uchars): ++ cp = myord(uchars[0], uchars[1]) ++ try: ++ glyph_name = unicode_cmap.cmap[cp] ++ except: ++ print "no cmap entry for %x" % cp ++ raise ValueError("%x" % ord(uchars)) + else: + glyph_name = get_glyph_name_from_gsub (uchars, font, unicode_cmap.cmap) + glyph_id = font.getGlyphID (glyph_name) diff --git a/system/noto-emoji/patches/c8259f2cb0fe0579e1391811edaf8ed5bb86e220.patch b/system/noto-emoji/patches/c8259f2cb0fe0579e1391811edaf8ed5bb86e220.patch new file mode 100644 index 0000000000..e5f4d24764 --- /dev/null +++ b/system/noto-emoji/patches/c8259f2cb0fe0579e1391811edaf8ed5bb86e220.patch @@ -0,0 +1,162 @@ +From c8259f2cb0fe0579e1391811edaf8ed5bb86e220 Mon Sep 17 00:00:00 2001 +From: Andrew Clemons +Date: Tue, 7 Mar 2017 18:13:40 +1300 +Subject: [PATCH] Tidy mixed tabs and spaces + +--- + third_party/color_emoji/emoji_builder.py | 76 ++++++++++++++++---------------- + 1 file changed, 37 insertions(+), 39 deletions(-) + +diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py +index c847fdb..c118e83 100644 +--- a/third_party/color_emoji/emoji_builder.py ++++ b/third_party/color_emoji/emoji_builder.py +@@ -33,7 +33,6 @@ def get_glyph_name_from_gsub (string, font, cmap_dict): + if ligature.Component == rest_of_glyphs: + return ligature.LigGlyph + +- + def div (a, b): + return int (round (a / float (b))) + +@@ -111,11 +110,11 @@ def write_smallGlyphMetrics (self, width, height): + line_height = (ascent + descent) * y_ppem / float (upem) + line_ascent = ascent * y_ppem / float (upem) + y_bearing = int (round (line_ascent - .5 * (line_height - height))) +- # fudge y_bearing if calculations are a bit off +- if y_bearing == 128: +- y_bearing = 127 ++ # fudge y_bearing if calculations are a bit off ++ if y_bearing == 128: ++ y_bearing = 127 + advance = width +- # print "small glyph metrics h: %d w: %d" % (height, width) ++ # print "small glyph metrics h: %d w: %d" % (height, width) + # smallGlyphMetrics + # Type Name + # BYTE height +@@ -123,14 +122,14 @@ def write_smallGlyphMetrics (self, width, height): + # CHAR BearingX + # CHAR BearingY + # BYTE Advance +- try: +- self.write (struct.pack ("BBbbB", +- height, width, +- x_bearing, y_bearing, +- advance)) +- except Exception as e: +- raise ValueError("%s, h: %d w: %d x: %d y: %d %d a:" % ( +- e, height, width, x_bearing, y_bearing, advance)) ++ try: ++ self.write (struct.pack ("BBbbB", ++ height, width, ++ x_bearing, y_bearing, ++ advance)) ++ except Exception as e: ++ raise ValueError("%s, h: %d w: %d x: %d y: %d %d a:" % ( ++ e, height, width, x_bearing, y_bearing, advance)) + + def write_format1 (self, png): + +@@ -253,11 +252,11 @@ def write_sbitLineMetrics_hori (self): + ascent = div (ascent * y_ppem, upem) + descent = - (line_height - ascent) + self.write (struct.pack ("bbBbbbbbbbbb", +- ascent, descent, +- self.strike_metrics.width, +- 0, 0, 0, +- 0, 0, 0, 0, # TODO +- 0, 0)) ++ ascent, descent, ++ self.strike_metrics.width, ++ 0, 0, 0, ++ 0, 0, 0, 0, # TODO ++ 0, 0)) + + def write_sbitLineMetrics_vert (self): + self.write_sbitLineMetrics_hori () # XXX +@@ -430,10 +429,10 @@ def drop_outline_tables (font): + print "Loaded font '%s'." % font_file + + font_metrics = FontMetrics (font['head'].unitsPerEm, +- font['hhea'].ascent, +- -font['hhea'].descent) ++ font['hhea'].ascent, ++ -font['hhea'].descent) + print "Font metrics: upem=%d ascent=%d descent=%d." % \ +- (font_metrics.upem, font_metrics.ascent, font_metrics.descent) ++ (font_metrics.upem, font_metrics.ascent, font_metrics.descent) + glyph_metrics = font['hmtx'].metrics + unicode_cmap = font['cmap'].getcmap (3, 10) + if not unicode_cmap: +@@ -449,8 +448,8 @@ def drop_outline_tables (font): + eblc.write_header () + eblc.start_strikes (len (img_prefixes)) + +- def is_vs(cp): +- return cp >= 0xfe00 and cp <= 0xfe0f ++ def is_vs(cp): ++ return cp >= 0xfe00 and cp <= 0xfe0f + + for img_prefix in img_prefixes: + print +@@ -462,13 +461,13 @@ def is_vs(cp): + codes = img_file[len (img_prefix):-4] + if "_" in codes: + pieces = codes.split ("_") +- cps = [int(code, 16) for code in pieces] ++ cps = [int(code, 16) for code in pieces] + uchars = "".join ([unichr(cp) for cp in cps if not is_vs(cp)]) + else: +- cp = int(codes, 16) +- if is_vs(cp): +- print "ignoring unexpected vs input %04x" % cp +- continue ++ cp = int(codes, 16) ++ if is_vs(cp): ++ print "ignoring unexpected vs input %04x" % cp ++ continue + uchars = unichr(cp) + img_files[uchars] = img_file + if not img_files: +@@ -479,19 +478,18 @@ def is_vs(cp): + advance = width = height = 0 + for uchars, img_file in img_files.items (): + if len (uchars) == 1: +- try: +- glyph_name = unicode_cmap.cmap[ord (uchars)] +- except: +- print "no cmap entry for %x" % ord(uchars) +- raise ValueError("%x" % ord(uchars)) ++ try: ++ glyph_name = unicode_cmap.cmap[ord (uchars)] ++ except: ++ print "no cmap entry for %x" % ord(uchars) ++ raise ValueError("%x" % ord(uchars)) + else: + glyph_name = get_glyph_name_from_gsub (uchars, font, unicode_cmap.cmap) + glyph_id = font.getGlyphID (glyph_name) + glyph_imgs[glyph_id] = img_file + if "verbose" in options: + 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] + w, h = PNG (img_file).get_size () +@@ -529,10 +527,10 @@ def is_vs(cp): + drop_outline_tables (font) + print "Dropped outline ('glyf', 'CFF ') and related tables." + +- # hack removal of cmap pua entry for unknown flag glyph. If we try to +- # remove it earlier, getGlyphID dies. Need to restructure all of this +- # code. +- font_data.delete_from_cmap(font, [0xfe82b]) ++ # hack removal of cmap pua entry for unknown flag glyph. If we try to ++ # remove it earlier, getGlyphID dies. Need to restructure all of this ++ # code. ++ font_data.delete_from_cmap(font, [0xfe82b]) + + font.save (out_file) + print "Output font '%s' generated." % out_file diff --git a/system/noto-emoji/patches/d34c13fb99f07d09c0c98192e7998186a622e28c.patch b/system/noto-emoji/patches/d34c13fb99f07d09c0c98192e7998186a622e28c.patch deleted file mode 100644 index 6b7b93f5fb..0000000000 --- a/system/noto-emoji/patches/d34c13fb99f07d09c0c98192e7998186a622e28c.patch +++ /dev/null @@ -1,162 +0,0 @@ -From d34c13fb99f07d09c0c98192e7998186a622e28c Mon Sep 17 00:00:00 2001 -From: Andrew Clemons -Date: Tue, 7 Mar 2017 18:13:40 +1300 -Subject: [PATCH] Tidy mixed tabs and spaces - ---- - third_party/color_emoji/emoji_builder.py | 76 ++++++++++++++++---------------- - 1 file changed, 37 insertions(+), 39 deletions(-) - -diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py -index c847fdb..c118e83 100644 ---- a/third_party/color_emoji/emoji_builder.py -+++ b/third_party/color_emoji/emoji_builder.py -@@ -33,7 +33,6 @@ def get_glyph_name_from_gsub (string, font, cmap_dict): - if ligature.Component == rest_of_glyphs: - return ligature.LigGlyph - -- - def div (a, b): - return int (round (a / float (b))) - -@@ -111,11 +110,11 @@ def write_smallGlyphMetrics (self, width, height): - line_height = (ascent + descent) * y_ppem / float (upem) - line_ascent = ascent * y_ppem / float (upem) - y_bearing = int (round (line_ascent - .5 * (line_height - height))) -- # fudge y_bearing if calculations are a bit off -- if y_bearing == 128: -- y_bearing = 127 -+ # fudge y_bearing if calculations are a bit off -+ if y_bearing == 128: -+ y_bearing = 127 - advance = width -- # print "small glyph metrics h: %d w: %d" % (height, width) -+ # print "small glyph metrics h: %d w: %d" % (height, width) - # smallGlyphMetrics - # Type Name - # BYTE height -@@ -123,14 +122,14 @@ def write_smallGlyphMetrics (self, width, height): - # CHAR BearingX - # CHAR BearingY - # BYTE Advance -- try: -- self.write (struct.pack ("BBbbB", -- height, width, -- x_bearing, y_bearing, -- advance)) -- except Exception as e: -- raise ValueError("%s, h: %d w: %d x: %d y: %d %d a:" % ( -- e, height, width, x_bearing, y_bearing, advance)) -+ try: -+ self.write (struct.pack ("BBbbB", -+ height, width, -+ x_bearing, y_bearing, -+ advance)) -+ except Exception as e: -+ raise ValueError("%s, h: %d w: %d x: %d y: %d %d a:" % ( -+ e, height, width, x_bearing, y_bearing, advance)) - - def write_format1 (self, png): - -@@ -253,11 +252,11 @@ def write_sbitLineMetrics_hori (self): - ascent = div (ascent * y_ppem, upem) - descent = - (line_height - ascent) - self.write (struct.pack ("bbBbbbbbbbbb", -- ascent, descent, -- self.strike_metrics.width, -- 0, 0, 0, -- 0, 0, 0, 0, # TODO -- 0, 0)) -+ ascent, descent, -+ self.strike_metrics.width, -+ 0, 0, 0, -+ 0, 0, 0, 0, # TODO -+ 0, 0)) - - def write_sbitLineMetrics_vert (self): - self.write_sbitLineMetrics_hori () # XXX -@@ -430,10 +429,10 @@ def drop_outline_tables (font): - print "Loaded font '%s'." % font_file - - font_metrics = FontMetrics (font['head'].unitsPerEm, -- font['hhea'].ascent, -- -font['hhea'].descent) -+ font['hhea'].ascent, -+ -font['hhea'].descent) - print "Font metrics: upem=%d ascent=%d descent=%d." % \ -- (font_metrics.upem, font_metrics.ascent, font_metrics.descent) -+ (font_metrics.upem, font_metrics.ascent, font_metrics.descent) - glyph_metrics = font['hmtx'].metrics - unicode_cmap = font['cmap'].getcmap (3, 10) - if not unicode_cmap: -@@ -449,8 +448,8 @@ def drop_outline_tables (font): - eblc.write_header () - eblc.start_strikes (len (img_prefixes)) - -- def is_vs(cp): -- return cp >= 0xfe00 and cp <= 0xfe0f -+ def is_vs(cp): -+ return cp >= 0xfe00 and cp <= 0xfe0f - - for img_prefix in img_prefixes: - print -@@ -462,13 +461,13 @@ def is_vs(cp): - codes = img_file[len (img_prefix):-4] - if "_" in codes: - pieces = codes.split ("_") -- cps = [int(code, 16) for code in pieces] -+ cps = [int(code, 16) for code in pieces] - uchars = "".join ([unichr(cp) for cp in cps if not is_vs(cp)]) - else: -- cp = int(codes, 16) -- if is_vs(cp): -- print "ignoring unexpected vs input %04x" % cp -- continue -+ cp = int(codes, 16) -+ if is_vs(cp): -+ print "ignoring unexpected vs input %04x" % cp -+ continue - uchars = unichr(cp) - img_files[uchars] = img_file - if not img_files: -@@ -479,19 +478,18 @@ def is_vs(cp): - advance = width = height = 0 - for uchars, img_file in img_files.items (): - if len (uchars) == 1: -- try: -- glyph_name = unicode_cmap.cmap[ord (uchars)] -- except: -- print "no cmap entry for %x" % ord(uchars) -- raise ValueError("%x" % ord(uchars)) -+ try: -+ glyph_name = unicode_cmap.cmap[ord (uchars)] -+ except: -+ print "no cmap entry for %x" % ord(uchars) -+ raise ValueError("%x" % ord(uchars)) - else: - glyph_name = get_glyph_name_from_gsub (uchars, font, unicode_cmap.cmap) - glyph_id = font.getGlyphID (glyph_name) - glyph_imgs[glyph_id] = img_file - if "verbose" in options: - 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] - w, h = PNG (img_file).get_size () -@@ -529,10 +527,10 @@ def is_vs(cp): - drop_outline_tables (font) - print "Dropped outline ('glyf', 'CFF ') and related tables." - -- # hack removal of cmap pua entry for unknown flag glyph. If we try to -- # remove it earlier, getGlyphID dies. Need to restructure all of this -- # code. -- font_data.delete_from_cmap(font, [0xfe82b]) -+ # hack removal of cmap pua entry for unknown flag glyph. If we try to -+ # remove it earlier, getGlyphID dies. Need to restructure all of this -+ # code. -+ font_data.delete_from_cmap(font, [0xfe82b]) - - font.save (out_file) - print "Output font '%s' generated." % out_file -- cgit v1.2.3