For a monospaced font, what are recommended ways to create fractions?
What I was originally planning:
Glyphs for zero.numr through nine.numr, visually centered and spaced, appropriately. Same for .dnom glyphs.
Glyphs for zero.sups through nine.sups made from components of zero.numr through nine.numr. Same for .subs and .dnom, perhaps. Similar for .sinf, adjusting vertical positioning.
Fraction glyph, appropriately angled and centered.
Build fraction glyphs such as onequarter, fiveeighths, etc. from components, keeping within the monospaced width.
Use OpenType frac feature to build additional fractions (with single digit for numeral and denominator) on the fly that aren’t prebuilt, when feature is enabled.
Since this is a monospaced font, all of the glyphs have the same width (600).
For building a glyph like fiveeighths, one way seems to be:
create the five.numr, fraction, and eight.dnom glyphs,
add glyph fiveeighths (which creates a glyph (1800 width) of those three components,
disable automatic alignment for each component by right (control-) clicking on each component and selecting,
then move the five.numr and eight.dnom to appropriate spots.
For the frac feature side, since the glyphs are mostly visually centered, I assume I’ll need to play with OpenType positioning.
If this weren’t a monospaced font, I’d probably consider adjusting side bearings on the fraction glyph, perhaps kern the fraction and .numr/.dnom glyphs.
You need to add at least one regular kerning pair. This is a bug that I will fix with the next update. And the manual kerning feature only works in the version 1.3.19.
Export your font and test the fractions. The preview in Glyphs will not work.
One possible bug I noticed: if one has both .subs and .sinf glyphs, automatic feature generation puts both in the sinf feature. If you have, for example, zero.subs and zero.sinf, then the feature won’t compile since there would be two substitution lines:
sub zero by zero.sinf;
sub zero by zero.subs;
in the same feature. For now, I just disable automatic generation for that feature and remove the extraneous .subs substitutions.
The reasoning for having both .subs and .sinf glyphs.
.subs sit on the baseline for shilling fractions.
.sinf are shifted further below for scientific use, etc.
Hi! I’m trying to figure out how to set up pre-composed fractions in a mono font properly. Auto compose does not work because it adds up the widths, so I thought using anchors was a way to go to, but apparently two things do not work:
with top and bottom anchors, it ignores both. So instead of giving the choice of the anchor, it auto aligns as if there are no anchors.
one.numr, being a component of one.dnom, does not inherit the anchors at all. I guess I could use only dnoms, but see problem 1.
Is that expected? Is that not how you’d do it?
Version 3220. mono fractions.glyphs (4.9 KB)
Anchors are not helping here.
I would move the numerators to the left and the denominators to the right. Then change the component order to one.numr fraction two.dnom and add kerning of -600 between the numerators and the fraction and the fraction and denominators.
Have a look at the file: mono fractions.glyphs (4.9 KB)