Open kseino opened 2 years ago
@puzrin Could you review please :pray:
Could you use fork for a while? I'm still busy with extremely urgent fixes on my project, which made all this stuff possible.
Sorry for unexpected delays.
@puzrin Could you please review this PR?
We are looking forward to this option!
I encountered the same problem when generating an icon font for a Flutter app.
I avoided the issue without changing the Use Typo Metrics
flag. (Tested on Android and iOS) Based on some experimenting, the problem disappears if the OS/2 sTypoLineGap is set to 0. Based on my understanding, this won't cause any problem as we use this for icons, not real fonts,
I monkey-patched the Font "class" using the following snippet based on the actual implementation and it seems to be working just fine.
import * as sfnt from "svg2ttf/lib/sfnt.js";
// ...
Object.defineProperty(sfnt.Font.prototype, "int_lineGap", { value: 0 });
This bypasses the built-in 9% of font ascent minus descent calculation. I suggest adding a lineGap parameter to the options object. (SVG font face does not define a similar param.)
Added
useTypoMetrics
options to setREGULAR
to fsSelection. https://docs.microsoft.com/en-us/typography/opentype/spec/os2#fsselectionUse cases We use custom icon fonts generated thanks to
svg2ttf
in Flutter project. Flutter renders extra ascent whenUse Typo Metrics
is enabled.useTypoMetrics
options will solve this problem.https://github.com/fontello/svg2ttf/issues/95#issuecomment-631370838