-
Notifications
You must be signed in to change notification settings - Fork 42
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
Bitmap fonts sometimes clip first character on left edge #422
Comments
This occurs when the first character in the drawn text has a negative xoffset value in the font descriptor file. Because the drawing loop adds the xoffset to the current cursor position, a negative value in the first character is drawn outside of the label widget bounds. Positive xoffset values for the first character can also lead to clipping of the last character for the same reason. The solution is to adjust the initial cursor/drawing position by the first character xoffset position so it is always drawn at position 0. |
Fix bitmap font drawing bug (issue #422)
Backported fix to version 0.54.1 |
Now there are some conditions where the right edge of the last character is cut off. It appears the issue is in the BitmapFont.get_extents method. The algorithm used to calculate the extents does not properly take into account the width of the last character (only the xadvance character attribute which is sometimes less than the character width). |
Fix bug in bitmap font get_extents, add comments. Fixes issue #422
The algorithm to calculate the font extents and do the drawing had some slight differences that in some conditions could cause clipping on either the right or left edge of the text widget. This is now fixed as both methods are now in sync. |
From mpf-users group
"The only problem I have found is this:
when using a bitmap font and I make the font slightly larger, for example placing a border around the font, the left side of the border gets clipped on the very first character of a string. I have intentionally increased the offsets for all of the characters so this would not happen and it works fine for all the other characters because of the offset, however, the first character of a string is still clipped, but only on the left side. I am not sure if this is an MC bug or a kivy bug, but I find nothing in MC that would do this in my very brief search. For now, I am using a "work around" of adding a leading space to all strings."
The text was updated successfully, but these errors were encountered: