bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #60587] Allow font files to specify kern pairs for characters in di


From: G. Branden Robinson
Subject: [bug #60587] Allow font files to specify kern pairs for characters in different fonts
Date: Fri, 14 May 2021 21:26:33 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #3, bug #60587 (project groff):

Hi Dave,

I share Werner's instinct as to the pragmatics of this.  It seems to me like a
common computer science problem--a combinatorial explosion.

Just _within_ a font, the number of potential kerning pairs can be immense in
the Unicode era.

Given a font with n glyphs, the number of kerning pairs is on the order of n^2
(I at first thought n*(n-1), but a glyph can of course require--or be
given--particularized kerning with itself). 


num_kern_pairs = g1,g1 + g1,g2 + g1,g3 + ... + g1, gn + g2,g1 + g2,g2 + ...
num_kern_pairs = gn*gn
num_kern_pairs = n^2


Now add F fonts with identical glyph coverage.  Each glyph g in font f1 has
n^2 kern pairs just internally, and now we add each of the n glyphs in each
font f2, f3, f4, ...

If I'm reasoning correctly, this turns a quadratic problem into a cubic
problem.  And as a rule of thumb, any time you're dealing with an increase in
the complexity class of a problem in computer science you need to consider if
you're going to have enough resources to manage it.

At first blush, the concept of Heirloom Doctools troff's solution seems sound.
 Fonts define their own kern pairs, and users can supplement them or override
them as needed.  Most practical documents will not use a large number of
fonts, and fewer still will combine arbitrary glyphs from arbitrary adjacent
pairings of those fonts.

Putting the responsibility on the user to define the cross-font kernings
they're going to need for a particular document seems reasonable to me.

However, we can aid them in this.  We could have a feature in groff which
emits a diagnostic (probably off by default) any time it writes out a pair of
adjacent glyphs without having any kerning data for them.  (N.B., this does
_not_ mean for which the kerning adjustment is defined as zero or some
within-font default.  Maybe we'd have an exception for cases where the font
family [family+style?] does not change, on the assumption that the font
designer considered this issue and left the kerning pair undefined on
purpose.)  This would catalog the occurrences for which Heirloomish .kernpair
requests would need to be written.  Then let the suitably informed user deal
with it.

While I have y'all's attention I wanted to re-raise he matter that has been
"itching me", as I put it the other day, in our man pages.  We have italic
corrections and left italic corrections.  I wonder, given the attached
specimen, whether we need "bold corrections".  These would work within a font
family, in a cross-style way just as the italic corrections do.  I suppose I
could pilot this idea with \^ escapes in the groff_man(7) font macros.  Or
maybe that is all that is necessary...?

(file #51435)
    _______________________________________________________

Additional Item Attachment:

File name: gropdf_bad_kerning.png         Size:34 KB
    <https://file.savannah.gnu.org/file/gropdf_bad_kerning.png?file_id=51435>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60587>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]