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

problems with small fonts #123

Open
eadmaster opened this issue May 17, 2017 · 1 comment
Open

problems with small fonts #123

eadmaster opened this issue May 17, 2017 · 1 comment

Comments

@eadmaster
Copy link
Contributor

eadmaster commented May 17, 2017

When using a small font like TomThumb the first line gets printed outside the screen.
(i have to add 13 padding spaces before the string to be printed)

side question:
can i reduce the size of the whitespace between words and the newlines?
(actually the whitespace takes 5 pixels with my 3-pixel width font)

@pljakobs
Copy link
Contributor

this has been sitting around for a long time.
The dimensions of a font are part of the font definition. So when you say your whitespace is five pixels wide, that's consistent with it's definition
{ 0, 0, 0, 4, 0, 1 }, // 0x20 '
if the following character has an xOffset of 1, that would make it five pixels.
Same goes for the actual height of the font:
they're all defined to be 3 pixels high, but some have an additional offset that would make them bigger.
For fonts that small, I assume that freetype just has issues rendering them onto a small cell without rounding errors. You can certainly go ahead and manually adapt those values, although I figure that would be a whole lot of work without a graphical editor that understands the GFXfont format (of which there's none).

As for why your String is showing outside the screen - you say "first line" but then say you need to pad with spaces - could it be that the first line is printed above the visible area? Keep in mind that the flexible fonts are not top left pixel bound but have a baseline that runs at the bottom of the characters with things like p,q, j and y reaching below it. So if you print someting to screen position (0,0) it would be expected that only the the character portions reaching below the baseline would show.

pj

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