Skip to content

Conversation

@arlosi
Copy link
Contributor

@arlosi arlosi commented Jun 9, 2025

Even monospace fonts can have variable sized BBX fields. For characters with no data such as SPACE, the BBX can be 1x1. If space is the first character in the font, this leads to the converted font having all characters be 1x1 pixel.

To resolve the issue, use the FONTBOUNDINGBOX field for the bounding box instead of the BBX of the first character when converting.

Even monospace fonts can have variable sized BBX fields. For characters
with no data such as SPACE, the BBX can be 1x1. If space is the first
character in the font, this leads to the converted font having all
characters be 1x1 pixel.

To resolve the issue, use the FONTBOUNDINGBOX field for the bounding box
instead of the BBX of the first character when converting.
@arlosi
Copy link
Contributor Author

arlosi commented Jun 9, 2025

With this fix in place, I'm able to generate bdf fonts using FontForge (following directions from adafruit), then convert them successfully for embedded graphics.

@rfuest
Copy link
Member

rfuest commented Jun 10, 2025

This seems like the right way to handle this, but I can't remember if there was a reason not to trust FONTBOUNDINGBOX. Perhaps it would be a good idea to add an additional check that makes sure that no glyph bounding box extends beyond the font bounding box.

@rfuest rfuest merged commit a7c3762 into embedded-graphics:master Jun 10, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants