|
1 | 1 | from collections import OrderedDict |
2 | | - |
3 | 2 | import base64 |
4 | 3 | import gzip |
5 | 4 | import hashlib |
@@ -155,7 +154,7 @@ def start(self, tag, attrib={}, **extra): |
155 | 154 | if not v == '': |
156 | 155 | k = escape_cdata(k) |
157 | 156 | v = escape_attrib(v) |
158 | | - self.__write(" %s=\"%s\"" % (k, v)) |
| 157 | + self.__write(' %s="%s"' % (k, v)) |
159 | 158 | self.__open = 1 |
160 | 159 | return len(self.__tags)-1 |
161 | 160 |
|
@@ -1005,9 +1004,8 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None): |
1005 | 1004 |
|
1006 | 1005 | glyph_info, glyph_map_new, rects = _glyphs |
1007 | 1006 |
|
1008 | | - # we store the character glyphs w/o flipping. Instead, the |
1009 | | - # coordinate will be flipped when this characters are |
1010 | | - # used. |
| 1007 | + # We store the character glyphs w/o flipping. Instead, the |
| 1008 | + # coordinate will be flipped when these characters are used. |
1011 | 1009 | if glyph_map_new: |
1012 | 1010 | writer.start('defs') |
1013 | 1011 | for char_id, glyph_path in glyph_map_new.items(): |
@@ -1161,14 +1159,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None): |
1161 | 1159 | for style, chars in spans.items(): |
1162 | 1160 | chars.sort() |
1163 | 1161 |
|
1164 | | - same_y = True |
1165 | | - if len(chars) > 1: |
1166 | | - last_y = chars[0][1] |
1167 | | - for i in range(1, len(chars)): |
1168 | | - if chars[i][1] != last_y: |
1169 | | - same_y = False |
1170 | | - break |
1171 | | - if same_y: |
| 1162 | + if len({y for x, y, t in chars}) == 1: # Are all y's the same? |
1172 | 1163 | ys = str(chars[0][1]) |
1173 | 1164 | else: |
1174 | 1165 | ys = ' '.join(str(c[1]) for c in chars) |
|
0 commit comments