FabGL icon indicating copy to clipboard operation
FabGL copied to clipboard

Scaled drawText

Open victornpb opened this issue 1 year ago • 1 comments

I want to draw really big text, I saw theres a script to make custom fonts, but would be good if i could just scale up the existent fonts, either by stretching them

cv.selectFont(&fabgl::FONT_SLANT_8x14);
cv.drawText(0,0, 100, "Hello"); // draw 100px height

or even a scale factor of 2x, 3x, 4x... less flexible but would be useful

Is that possible, or would be something easy to modify

victornpb avatar Oct 16 '24 15:10 victornpb

It is possible to scale by 2 (only), e.g.:

fabgl::ILI9341Controller display;
fabgl::Canvas canvas(&display);
canvas.setGlyphOptions(GlyphOptions().FillBackground(false).DoubleWidth(2));
// and inside, there is info:
union GlyphOptions {
    uint16_t doubleWidth      : 2;  /**< If enabled the glyph is doubled. To implement characters double width. 0 = normal, 1 = double width, 2 = double width - double height top, 3 = double width - double height bottom. */

perhaps could be extended. For my project, I'll try making bigger fonts instead, using FabGL/tools/fonttool/ttf2header.py

cryham avatar Jun 30 '25 12:06 cryham