foliojs / fontkit

An advanced font engine for Node and the browser
1.46k stars 219 forks source link

'frac', should it replace / with ⁄? #192

Open casperno opened 5 years ago

casperno commented 5 years ago

Hi,

Not sure if this is a bug or a misunderstanding on my part.

When feature 'frac' is enabled, I expected "/" to be replaced with “⁄” (U+2044). Fraction rendering itself does work, if I send 1⁄2 to fontkit, it renders 1 as numerator, 2 as denominator. But the replacement of "/" does not seem to happen. Turning "frac" on in InDesign causes "/" to be replaced with “⁄”, using the same font.

I have a font with the following features: "ase, dnom, frac, liga, lnum, numr, onum, pnum, sinf, sups, tnum, kern". I'm calling fontkit.layout with 'frac'.

Pomax commented 5 years ago

What's the content that fontkit reports for the frac feature?

casperno commented 5 years ago

Not sure what you mean? By 'content', do you mean returned glyphRun from the layout() call?

brawer commented 5 years ago

You could try dumping the content of the GSUB table with fonttols; the command line is something like ttx -t GSUB -o - path/to/font.ttf.

casperno commented 5 years ago

This is to double check that the font does fraction substitution? Meaning that the font flagging support for "frac" might not be saying that it does have this substitution? Thanks for helping by the way, I appreciate your patience with my lack of detailed knowledge.

Pomax commented 5 years ago

I meant what's the actual features/lookup data that is in the font according to fontkit. E.g is there, and then of course does it see, a frac feature as part of the DFLT/latn script?