(self, matrix, font, fontsize, scaling, rise, text, textwidth, textdisp)
| 204 | class LTChar(LTComponent, LTText): |
| 205 | |
| 206 | def __init__(self, matrix, font, fontsize, scaling, rise, text, textwidth, textdisp): |
| 207 | LTText.__init__(self) |
| 208 | self._text = text |
| 209 | self.matrix = matrix |
| 210 | self.fontname = font.fontname |
| 211 | self.adv = textwidth * fontsize * scaling |
| 212 | # compute the boundary rectangle. |
| 213 | if font.is_vertical(): |
| 214 | # vertical |
| 215 | width = font.get_width() * fontsize |
| 216 | (vx,vy) = textdisp |
| 217 | if vx is None: |
| 218 | vx = width/2 |
| 219 | else: |
| 220 | vx = vx * fontsize * .001 |
| 221 | vy = (1000 - vy) * fontsize * .001 |
| 222 | tx = -vx |
| 223 | ty = vy + rise |
| 224 | bll = (tx, ty+self.adv) |
| 225 | bur = (tx+width, ty) |
| 226 | else: |
| 227 | # horizontal |
| 228 | height = font.get_height() * fontsize |
| 229 | descent = font.get_descent() * fontsize |
| 230 | ty = descent + rise |
| 231 | bll = (0, ty) |
| 232 | bur = (self.adv, ty+height) |
| 233 | (a,b,c,d,e,f) = self.matrix |
| 234 | self.upright = (0 < a*d*scaling and b*c <= 0) |
| 235 | (x0,y0) = apply_matrix_pt(self.matrix, bll) |
| 236 | (x1,y1) = apply_matrix_pt(self.matrix, bur) |
| 237 | if x1 < x0: |
| 238 | (x0,x1) = (x1,x0) |
| 239 | if y1 < y0: |
| 240 | (y0,y1) = (y1,y0) |
| 241 | LTComponent.__init__(self, (x0,y0,x1,y1)) |
| 242 | if font.is_vertical(): |
| 243 | self.size = self.width |
| 244 | else: |
| 245 | self.size = self.height |
| 246 | return |
| 247 | |
| 248 | def __repr__(self): |
| 249 | return ('<%s %s matrix=%s font=%r adv=%s text=%r>' % |
nothing calls this directly
no test coverage detected