summaryrefslogtreecommitdiff
path: root/system/noto-emoji/patches/c8259f2cb0fe0579e1391811edaf8ed5bb86e220.patch
blob: e5f4d24764e454652276d69f3d125d4945815014 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
From c8259f2cb0fe0579e1391811edaf8ed5bb86e220 Mon Sep 17 00:00:00 2001
From: Andrew Clemons <andrew.clemons@gmail.com>
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