Substitute multiple glyphs with multiple alternate glyphs

Primary tabs

7 posts / 0 new
Last post
Stickley's picture
Offline
Joined: 17 Apr 2009 - 10:08am
Substitute multiple glyphs with multiple alternate glyphs
0

I can't quite find this circumstance in the forums, manuals, or elsewhere...

I want to substitute multiple glyphs with multiple alternate glyphs.

For example, if I type chalk, I want it to be replaced by cha.alt and lk.alt.

Can't do:
sub c' h' a' by cha.alt;

because if I type champ, I don't want the .alt.

I can do:
sub c' h' a' l k by cha.alt;
sub cha.alt l' k' by lk.alt;

Is that as simple as I can get, or can I make it one line of code?

I'd ideally like this:
sub c h a l k by cha.alt and lk.alt;

Thoughts?

Thanks,

Mcs

Tomi Haaparanta's picture
Offline
Joined: 31 Mar 2006 - 3:16am
0

Try chancing the order of OT codes in that left hand column, and see what happens.

Tomi Haaparanta's picture
Offline
Joined: 31 Mar 2006 - 3:16am
0

First come, first served.

Stickley's picture
Offline
Joined: 17 Apr 2009 - 10:08am
0

It's not really an OT order thing so much as a group-replace function.

If I were to type "international" and I wanted it to force "int'l" to replace it, with each letter being an independent glyph, how could (or can I at all) do that?

I want a group of letters in a particular order to be replaced by a different group of letters in a different particular order, not necessarily of the same count for each group.

Can it be done?

fanatic font addict's picture
Joined: 22 Feb 2008 - 10:27pm
0

Have no idea if the following will help you

"mergeFonts
This program will merge glyphs from one font into another, optionally copying a subset from the source fonts, and changing the names of the glyphs. It can also be used to subset and change the glyph names in a font. By using the same font more than once as a source with different mapping files, glyphs can be duplicated under other names."

However, just ran across it yesterday. Its part of the Adobe Font Development Kit -some utilities they made available, though not documented super well.

http://www.adobe.com/devnet/opentype/afdko/topic_overview.html

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

OpenType cannot do many-to-many substitutions. It can to one-to-one, one-to-one-out-of-many, many-to-one and one-to-many (though the last one is not supported by some applications).

To achieve what you're trying to do, you need a series of lookups, each performing a many-to-one substitution. Each lookup is executed on the glyph string produced by the previous lookup. So:

feature calt {
lookup calt1 {
sub c' h' a' l k by c_h_a.alt;
} calt1;
lookup calt2 {
sub c_h_a.alt l' k' by l_k.alt;
} calt2;
} calt;

Note above that I've used PDF-compatible glyphnames for ligatures. c_h_a.alt and l_k.alt will be "understood" by PDF applications while cha.alt and lk.alt will not, i.e. copy-paste or searching may not work properly.

Adam

Stickley's picture
Offline
Joined: 17 Apr 2009 - 10:08am
0

Thanks, Adam. I figured it might me the more complicated way, I just needed the clarity/reassurance you gave.

Mcs