adafruit / Adafruit-GFX-Library

Adafruit GFX graphics core Arduino library, this is the 'core' class that all our other graphics libraries derive from
https://learn.adafruit.com/adafruit-gfx-graphics-library
Other
2.32k stars 1.52k forks source link

Fixed Adafruit_GFX font size limitation - the 8-bit signed values prevented large fonts from working #448

Closed bitbank2 closed 3 weeks ago

bitbank2 commented 1 month ago

This is a simple change which allows the fontconverter and Adafruit GFX font logic to work with fonts larger than about 90 pt. The original code used signed 8-bit values for the character offsets and yAdvance. These overflow when working with fonts past about 90 points. There is no downside to this fix; adding a few bytes to the size of the GFXglyph structure won't negatively impact anything.

bitbank2 commented 1 month ago

No idea what the problem is because it just shows "error 1". Useless.

BillyDonahue commented 3 weeks ago

adding a few bytes to the size of the GFXglyph structure won't negatively impact anything.

I disagree with that. Let's say there are 100 glyphs in a font.

This change adds 5 bytes per glyph, so 500 bytes to that font, even for apps that will never work with huge fonts. The Atmega328 target only has 32kB total PROGMEM space.

People pack their apps pretty tightly into that 32kB PROGMEM space. If they have a few fonts the cost will be multiplied again.

We may disagree as to whether a 2-ish % overhead is significant, but it's not correct to flatly state that there's no downside. It's a tradeoff.

BillyDonahue commented 3 weeks ago

No idea what the problem is because it just shows "error 1". Useless.

The details are in the failure report:

https://github.com/adafruit/Adafruit-GFX-Library/actions/runs/9206826415/job/25325537261?pr=448

Your code needs be in a state that running clang-format on it would produce no changes.

Widening the types pushed the // comments over to the right by 1 character, and clang-format adjusts the position of // comments so that the // on adjacent source lines form a straight vertical line.