Closed rudcode closed 1 year ago
Italic fonts and others have glyphs that overlap. This complicates background rendering since it is necessary to maintain two cursors, one for the glyph position and one for the last background end coordinate.
Another complication is that the background clear start coordinate may need to start at a different x coordinate after the setCursor has been called. This again is required for glyphs (e.g. italics) that can extend in front of the cursor coordinate.
The carriage return/line feed case also needs consideration.
TFT_eSPI handles these cases in it's smooth font functions.
I would expect any useful graphics library to provide a fill rectangle function so do not anticipate a problem there.
This OpenFontRender library is amazing, it is so useful to have a fully scaleable font. Really appreciated.
I agree about the need for background drawing. I have recognized that in some code it is more convenient to draw the background as well, even if user accept some performance loss.
I will bring back the transparent background option in the next release.
However, as Bodmer said, we need to fully consider how to render the background.
This illustrates the problem with a script style font. The three successive non-overlapping rectangles represent the areas to be filled as each character is drawn. So a character cursor and background clear cursor is needed:
I implemented this approach for "smooth fonts" in TFT_eSPI here so that technique does work: https://github.com/Bodmer/TFT_eSPI/blob/master/Extensions/Smooth_font.cpp#L355-L542
Thank you @Bodmer .
I will refer to your code. Can you tell me about the fonts you have pasted because I want to use for test my development code.
I don't remember which font that was but will try to find it and post information here. Many italic fonts have overlapping glyphs.
Thank you very much. I would like to implement and verify using the appropriate italic font.
The font is Vladimir Script, it should be available on any Windows machine.
The functions which requested has been implemented in v1.1
.
Thank you.
Great, thank you very much. Will test it soon.
Bring back transparent background, add background draw to new optimized drawing method, add fill background
Tested with ESP32 and platformio
Hi @takkaO, I'm not sure about where to put the ascender value, and what do you think about the added fillRect function? Is it okay if I add it?
cc: @Bodmer I use your method in smoothfont for this. Do you have any comment?