Added proportional bitmap font format support#9592
Added proportional bitmap font format support#9592endreszabo wants to merge 6 commits intopython-pillow:mainfrom
Conversation
Signed-off-by: Endre Szabo <git@end.re>
for more information, see https://pre-commit.ci
As far as I can see, YAFF resides within monobit, which has 244 stars on GitHub, and is still in 'Beta' on PyPI. Your claim seems a bit superlative, especially considering that https://github.com/robhagemans/monobit/blob/master/YAFF.md states
I'm not saying that this shouldn't be a part of Pillow, but it would good to assess exactly how much use this feature would receive. Are there any articles you can link to demonstrating widespread acceptance? What advantage do you see in embedding this support into Pillow directly, rather than, say, using monobit to convert a YAFF font into PCF or BDF, which Pillow already supports? |
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Yes, I am very enthusiastic as I spent years with Jimp + AngelCode BMFont to achieve the same (= my goal is to render a proportional bitmap font with kerning). And even with that, BMFont is basically PNG sprites, so you can't 'detach' the font rendering from the sprite images (no
I have no evidence for widespread acceptance. This PR will certainly raise awareness of its existence.
Immediate benefit is the proportional (variable width) glyph support (+kerning, which narrows the scope even further in the field of bitmap fonts) that BDF and PCF do not have. |
|
Did you use AI to develop this? |
Yes, I was using Opus. |
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This PR introduces support for YAFF proportional bitmap font support. Not only proportional, but YAFF is the ultimate bitmap font format that supersedes most popular formats. Unlike xkcd#927 this not a random 15th standard; this IS the standard to which all bitmap font should be converted to and used directly with Pillow. It is easily parsable for machines and human-friendly as you can edit the font files directly with your favorite text editor.
The following framebuffer has been created with Pillow, using the C64 font with manually added kerning pairs:
YAFF features include:
Out of these features only the kerning support has been implemented in this commit. In order to avoid introducing dependency on monobit, we wrote our YAFF format parser; with support for kerning.
Details on the YAFF format from the specs:
The yaff format has the following design aims: