Skip to content
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

Text Alignment using Adafruit GFX fonts off by a few pixels. #277

Closed
Pconti31 opened this issue Oct 15, 2020 · 1 comment
Closed

Text Alignment using Adafruit GFX fonts off by a few pixels. #277

Pconti31 opened this issue Oct 15, 2020 · 1 comment
Assignees
Labels
fixed Addressed bug or implementation change

Comments

@Pconti31
Copy link
Contributor

As you know I've been porting Adafruit's Font code to Java for the Builder and also porting your alignment code.
Having completed the port for reading and writing these fonts I found what I think is a small bug within the GUIslice API gslc_DrawTxtBase() routine.

I have attached a small sample program that shows the alignment that I believe is incorrect. I have tried this program with various GFX fonts and sizes and they all behave the same.

I think the problem is within gslc_DrawTxtBase() routine line number 2982:

    nTxtX += nTxtOffsetX;

If you modify this to

    nTxtX -= nTxtOffsetX;

I believe you will find the text lining up correctly. Note that these nTxtOffsets are only used by GFX fonts. The glcd built-in fonts set these offsets to zeroes.

Paul--
test-align.zip

@ImpulseAdventure
Copy link
Owner

Thank you very much Paul for reporting this and supplying an example to demonstrate the behavior.

I have now merged the proposed fix.
thx

@ImpulseAdventure ImpulseAdventure added fixed Addressed bug or implementation change and removed bug labels Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Addressed bug or implementation change
Projects
None yet
Development

No branches or pull requests

2 participants