Closed MarcelRobitaille closed 1 year ago
The tests would need to be updated to the new Adafruit-GFX files. Actually the tests should probably be checking compatibility with both the new and old fomats.
The "process and create file" function of this tool doesn't seem like it's going to preserve the header fragments that are now discarded by the import function.
👋🏼 Hi there and thanks for the discussion
If I understand correctly the change we indeed need:
I think I'd rather have a checkbox to add the new headers automatically to any given output. Will probably give it a try if I can in the coming days
@tchapi Thanks for your feedback and implementation. This still seems tightly tied to the current adafruit standard though. What if you saved the lines sliced away here and add those same lines back at the end. For the old format, this would just be an empty string, and it also allows the format to change upstream in the future.
const slice_index = Math.min(
data.indexOf(font_name[0]),
data.indexOf(font_def[0]),
data.search(glyph_part_re),
)
window.font_preamble = data.slice(0, slice_index)
data = data.slice(slice_index)
and later
data = (window.font_preamble ?? '') + data
It is tightly tied for now, yes, but I couldn't find any other example of different headers in the wild (do you have any?)
"Qui peut le plus peut le moins" so happy to accept your suggestion in a PR though :)
Some lines of code were added to the start of font files in this PR: https://github.com/adafruit/Adafruit-GFX-Library/pull/423
This change ignores such extra lines.