Draw the font[glyphName] at the defined position with the defined fontSize.
(self, glyph, x, y, fill=noColor, stroke=noColor,
strokeWidth=0, fontSize=None, xTextAlign=LEFT)
| 1245 | # Glyphs. |
| 1246 | |
| 1247 | def drawGlyph(self, glyph, x, y, fill=noColor, stroke=noColor, |
| 1248 | strokeWidth=0, fontSize=None, xTextAlign=LEFT): |
| 1249 | """Draw the font[glyphName] at the defined position with the defined |
| 1250 | fontSize.""" |
| 1251 | font = glyph.font |
| 1252 | |
| 1253 | if fontSize is None: |
| 1254 | fontSize = font.info.unitsPerEm |
| 1255 | s = fontSize / font.info.unitsPerEm |
| 1256 | |
| 1257 | if xTextAlign == CENTER: |
| 1258 | x -= (glyph.width or 0) / 2*s |
| 1259 | elif xTextAlign == RIGHT: |
| 1260 | x -= glyph.width*s |
| 1261 | |
| 1262 | #self.save() |
| 1263 | self.fill(fill) |
| 1264 | self.stroke(stroke, w=strokeWidth) |
| 1265 | self.translate(x, y) |
| 1266 | self.scale(s) |
| 1267 | self.drawGlyphPath(glyph) |
| 1268 | self.scale(1/s) |
| 1269 | self.translate(-x, -y) |
| 1270 | #self.restore() |
| 1271 | |
| 1272 | |
| 1273 | def drawGlyphPath(self, glyph): |
nothing calls this directly
no test coverage detected