*texstr* A valid mathtext string, e.g., r'IQ: $\\sigma_i=15$' *dpi* The dots-per-inch to render the text *fontsize* The font size in points Returns a tuple (*array*, *depth*) - *array* is an NxM uint8 alpha ubyte mask
(self, texstr, dpi=120, fontsize=14)
| 3271 | return font_output.get_results(box) |
| 3272 | |
| 3273 | def to_mask(self, texstr, dpi=120, fontsize=14): |
| 3274 | """ |
| 3275 | *texstr* |
| 3276 | A valid mathtext string, e.g., r'IQ: $\\sigma_i=15$' |
| 3277 | |
| 3278 | *dpi* |
| 3279 | The dots-per-inch to render the text |
| 3280 | |
| 3281 | *fontsize* |
| 3282 | The font size in points |
| 3283 | |
| 3284 | Returns a tuple (*array*, *depth*) |
| 3285 | |
| 3286 | - *array* is an NxM uint8 alpha ubyte mask array of |
| 3287 | rasterized tex. |
| 3288 | |
| 3289 | - depth is the offset of the baseline from the bottom of the |
| 3290 | image in pixels. |
| 3291 | """ |
| 3292 | assert self._output == "bitmap" |
| 3293 | prop = FontProperties(size=fontsize) |
| 3294 | ftimage, depth = self.parse(texstr, dpi=dpi, prop=prop) |
| 3295 | |
| 3296 | x = ftimage.as_array() |
| 3297 | return x, depth |
| 3298 | |
| 3299 | def to_rgba(self, texstr, color='black', dpi=120, fontsize=14): |
| 3300 | """ |
no test coverage detected