kohler / lcdf-typetools

Utilities for manipulating OpenType, PostScript Type 1, and Multiple Master fonts.
GNU General Public License v2.0
146 stars 18 forks source link

Generate pre-composed glyphs using advanced OpenType features. #14

Open krfkeith opened 7 years ago

krfkeith commented 7 years ago

Often times, there is a glyph one might want that doesn't exist with it's own slot in the font itself. Unfortunately, using LaTeX to create accented characters has serious drawbacks: not the least of which is that it's impossible to create characters with double diacritics without extra packages and manual tweaking. Furthermore, this doesn't take advantage of OpenType's advanced positioning features to achieve optimal results. What I am looking for is some sort of feature wherein you specify a character and one or more combining characters, and otftotfm would then synthesize this character and put it in whatever slot specified.

kohler commented 7 years ago

Can you give a specific example of how this might work, or a font that lacks a specific glyph?

krfkeith commented 7 years ago

A good example would be letter with double diacritics. For example, the capital A with macron and acute accent doesn't exist as a precomposed glyph in Unicode, and as such it doesn't have a slot in most fonts. Nevertheless, OpenType fonts can specify how to place accents in such scenarios. For example, here is how the character is supposed to look in Libertine:

screenshot_117

However, since this character doesn't exist precomposed in the Libertine font, there's no way to access the advanced placement features from within pdfTeX. The only way to even sort of getting anything approximating this character is the \twoacc command from the covington package, and even that doesn't work very well:

screenshot_118

As you can see, the accent is way too high up, but even if it weren't it doesn't look as good as the former. Ideally, there we would be a way to "synthesize" these missing glyphs on the fly, using the OpenType rules. Something maybe like:

% SYNTHESIZE Amacron acute := Amacronacute

where the generated glyph would be available under the name Amacronacute. In addition, this would prove useful for generating pseudo-ligatures in place of opentype contextual substitutions. For example, many fonts will substitute an 'f' character which is less wide before characters like 'ä'

% SYNTHESIZE f.short adieresis := f_adieresis
% LIGKERN f adieresis := f_adieresis
kohler commented 6 years ago

It might simply work to add a character such as “Amacron_acute” to the encoding. Have you tried something like that?