-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Font offset not calculated correctly when using fonts. #276
Comments
Thanks for pointing this out, I'll look at this and try it out for both tcUnicode and native fonts. They both use the same calculation. I have a graphical example that shows this and can try it out. |
Many thanks, this somehow escaped through testing, I have fixed this as per your suggestion and it will be in 3.1 which is due very soon. |
I had not understood how serious this was, or I would have removed the touch change from 3.1 and released it earlier. As it is now 3.1 is probably a few days from release so it will go into that. |
The fix is already applied in - https://github.com/davetcc/tcMenu/blob/master/xmlPlugins/core-display/adaGfxDriver/tcMenuAdaFruitGfx.cpp |
You're welcome! Always glad to help out if I can.
…On Tue, Jan 24, 2023 at 2:26 AM Dave Cherry ***@***.***> wrote:
I had not understood how serious this was, or I would have removed the
touch change from 3.1 and released it earlier. As it is now 3.1 is probably
a few days from release so it will go into that.
—
Reply to this email directly, view it on GitHub
<#276 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIBTUKA56FX7VIOPNJOSCT3WT6GZ7ANCNFSM6AAAAAATSHZHLA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Dave
|
When using non built in fonts (tested with Adafruit fonts) the offset is incorrectly calculated.
In tcAdaFruitGfx.cpp internalTextExtents function the line:
bl = glyphHeight + pgm_read_byte(&allGlyphs[glIdx].yOffset);
should be
bl = glyphHeight + (signed char)pgm_read_byte(&allGlyphs[glIdx].yOffset);
so that negative offsets are calculated correctly. But this still just uses the offset of the last character tested - the left parentheses.
or preferably it can be changed by eliminating the bl calculation and replacing
if(baseline) *baseline = bl;
with
if(baseline) *baseline = font->yAdvance - height;
This uses the line spacing for the font minus the tallest character.
This is using Arduino 1.8.16 to compile.
The text was updated successfully, but these errors were encountered: