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

Font size calculation discrepancy #1196

Closed
DanRStevens opened this issue Feb 1, 2025 · 0 comments
Closed

Font size calculation discrepancy #1196

DanRStevens opened this issue Feb 1, 2025 · 0 comments

Comments

@DanRStevens
Copy link
Collaborator

There is a discrepancy in how the size of Font text is calculated between the Font class and the RendererOpenGL class.

The Font class calculates width of text using:

width += gml[glyph].advance + gml[glyph].minX;

This appears to give a larger width than is actually displayed.

Meanwhile, the RendererOpenGL class advances Font position using:

offset += gm.advance;

These two should match up.


SDL TTF documentation:

The most relevant section appears to be for TTF_GlyphMetrics:

Image


Related:

Here it was noted the Button font text didn't look very centered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant