Hi! Some of you reported that exported fonts come out at a different size than expected (about 133%), and that imported fonts don’t keep their original size and line height after exporting them again. Thanks a lot to all that reported and discussed on the forums!
The change in 0.91 was a deliberate choice, not a bug, but maybe the choice wasn’t ideal. I want to do it properly, but before changing anything I’d like to hear what you think.
How it works now: A font that is N pixels tall (from the lowest descender to the highest ascender) is exported so that it renders pixel-perfect at N pt at 96 DPI. That works nicely in apps where you choose the size in points. But 96 DPI means N pt is N x 4/3 pixels, so in apps where you choose the size in pixels (Godot, Unity, CSS, Photoshop at 72 ppi, etc.) a 9 pixel font has to be used at 12 px. Worse, if the height isn’t a multiple of 3, there’s no whole pixel size where it’s pixel-perfect at 1x (a 7 pixel font would need 9.33 px).
You can’t have both: either the size in points is a clean number, or the size in pixels is, but not both for every font height. Correct me if I’m wrong! I’m no expert either.
Imports: When importing a TTF, PixelForge figures out the pixel grid, but it doesn’t keep the original font’s em size and vertical metrics, so exporting it again changes its size and line height.
Some ideas:
- A per-font setting for the export size, with the result clearly shown, something like “1:1 at 9 px, which is 6.75 pt at 96 DPI”. It could be “pixel size = font height”, “point size = font height (at 96 DPI)”, or a custom value. This setting would be saved with the PXF file.
- Existing fonts would keep exporting exactly as they do now, so nothing changes unless you change the setting.
- New fonts could get a different default, if one makes more sense to most people.
- Imported fonts would remember the original size and vertical metrics, so that exporting without changes gives you the same size and line height as the original. If the original size doesn’t fit exactly on the pixel grid, it would get rounded slightly, so that pixels stay crisp.
Other questions for you:
Where do you use your fonts (which engines/apps), and do you set the size in pixels or points there? What would you expect as the default for a new font? Is there anything else about the exported metrics (line height, ascent/descent, etc.) that has been a problem for you?
I’m not an expert on all the details of font metrics, so if anything here sounds wrong, please let me know!
