Kerning glyphs with negative sidebearings in initial/final position
Adam Jagosz
Posts: 689
So is that even a thing? I felt like it would make sense when I was testing my font using the famous Pablo Impallari's template:
The solution is pretty straightforward, but requires us to keep the list of all glyphs in the font within a class (here
any
):<b>feature </b>kern {<br> <b>lookup </b>kerning1 {<br> <b>ignore pos</b> <i>@any</i> [ f f.swsh j p y ]';<br> <b>pos </b>f' <60 0 60 0> ;<br> <b>pos </b>f.swsh' <510 0 510 0> ;<br> <b>pos </b>j' <235 0 235 0>;<br> <b>pos </b>p' <20 0 20 0>;<br> <b>pos </b>y' <25 0 25 0>;<br> } kerning1;<br> <b>lookup </b>kerning2 {<br> <b>ignore pos </b>[ f f.swsh ]' <i>@any</i>;<br> <b>pos </b>f' <0 0 60 0> ;<br> <b>pos </b>f.swsh' <0 0 190 0> ;<br> } kerning2;<br>} <b>kern</b>;This will increase the left sidebearing at the beginning of the glyph run and the right sidebearing at the end.
Is this approach at all practical or useful, have you ever implemented this or something similar? Is there an easy way to do this in any of the apps/tools you use? Now that I come to think of it, you could just write a script checking the sidebearings in all glyphs and applying appropriate kerning.
One way of thinking is that resolving such issues is responsibility of the layout engine or the typesetter. But obviously most people are not even aware this could be an issue:
Fixing a bug like above wouldn't be really obvious, I think at least some (if not most) design environments just take the advance width of the text as equivalent of the bounding box.
From my experiments, MS Word uses advance width to center text. So text with applied kerning of this kind would be centered more precisely, if that is what you'd want. (Besides, I often find myself centering text in InDesign manually because the unique shapes of sidebearings (even positive) make for an illusion of misalignment... but that's another pair of shoes).
Tagged:
0
Comments
-
Try to change any formatting in the middle of the string. Like set on letter before the j in Bold. That will trigger your kerning.0
-
Trying to trigger any behaviour based on start- or end-of-line context is problematic, because OpenType Layout lookups have no line layout knowledge. You can fake it, using the kind of context statements you have here, but those substitutions are going to occur at all glyph run boundaries, not just at the beginnings ands end of lines.
I used a similar mechanism for line-initial/terminal swashes and ornaments in the Gabriola font, but am wary about recommending it for any critical functionality such as spacing.1 -
I had similar issue with several Arabic letters, what I did is instead space the glyphs for line boundary situation, and kern them with other Arabic characters as needed. This is more cumbersome, but also more reliable and also makes sure the glyphs don’t overlap with text set in other fonts around them.
3 -
Just to expand on John’s comment: some apps break glyph runs at every word space! So those apps will get your beginning/end of line effect on ever word.0
-
Georg Seifert said:Try to change any formatting in the middle of the string. Like set on letter before the j in Bold. That will trigger your kerning.Good point, but “any” is not a good word — it depends. Even adjacent HTML
span
s are not necessarily treated as separate runs, for instance, positioning marks and even substitutions work on Windows in Firefox (though not Edge or Opera): Codepen.As to Microsoft Office Word, similarly, just changing color or applying underline or crosstroke doesn't break the glyph run — you'd have to change font size or the font altogether. The same in InDesign:Here coloring half of the ligature didn't go all that well, and for the best. Those software designers are smarter then you would think.Khaled Hosny said:...space the glyphs for line boundary situation, and kern them with other Arabic characters as needed.I always felt like this approach was the best bet. Making the font work as good as possible without OT, choose the solutions that incur minimal damage, and only then polish it up with OT. So... why does nobody do that? Those f's should not hang over by default in an “invincible” font. I guess it's just because too much space after an f is deemed a greater damage than an f cut off at the end of a run.Probably this logic made more sense with your Arabic work than with Latin. Suppose you wanted to embolden half of a word, and the second half begins with the problematic character. Now it doesn't matter if it is kerned away from the beginning of a glyph run, or spaced generously by default: it is spaced away from the first half, and it's a lose-lose — better not to come up with weird ideas trying to save the world.For what it's worth, such positioning could be included... as a stylistic set. A nice substitute of the software “center by bounding box”/“align bounding box with margin” switches. Come to think of it, a CSS property like this could be useful too.
0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 803 Font Technology
- 1K Technique and Theory
- 622 Type Business
- 444 Type Design Critiques
- 542 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 485 Typography
- 303 History of Typography
- 114 Education
- 68 Resources
- 499 Announcements
- 80 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 270 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports