Fontlab OpenType newbie contextual alternates confusion

Primary tabs

10 posts / 0 new
Last post
Tim Barnes's picture
Offline
Joined: 23 Nov 2012 - 12:03pm
Fontlab OpenType newbie contextual alternates confusion
0

hello...

I'm attempting to make a font with some OpenType features for the first time, using Fontlab, and, guess what - it's slightly confusing...

what I'd like OpenType to do is:
for lots of specific character pairs, substitute pairs of alternate characters

so, for example, if someone types 'AB' I'd like OpenType to substitute glyph A_2 followed by glyph B_2...

I was kind of thinking I could do this with a contextual alternate feature like

sub A' B' by A_2 B_2;

but that doesn't seem to compile

sub A B' by B_2;

compiles OK, but doesn't really do what I want...

does what I'm trying to do make any sense? is it possible?

would a better way be to make all my desired glyph combinations as ligature glyphs? (and also make all the individual alternate glyphs separately available)

any help would be great

John Hudson's picture
Offline
Joined: 21 Dec 2002 - 11:00am
0

OpenType doesn't support many-to-many substitutions. So you need to do this as two steps:

A -> A.2
when followed by B

then

B -> B.2
when preceded by A.2

Justin Callaghan's picture
Joined: 10 Oct 2003 - 12:49am
0

In the AFDKO/FontLab syntax, that would translate to:
sub A' B by A.2;
sub A.2 B' by B.2;

For glyph names, underscores are customarily used to indicate ligatures between two characters, and periods to precede suffixes. Suffixes might also be more descriptive if you have different kinds of alternates– i.e. .alt[x] for general alternates, .swsh[x] for swashes, (where [x] is a numeric index), .smcp for small caps, etc.

Bob Hallissy's picture
Offline
Joined: 23 Mar 2012 - 9:09am
0

OpenType doesn't support many-to-many substitutions.

Actually it seems to me that OpenType *does* permit m2m substitutions (using GSUB type 5 or 6 lookups) but none of the common tools (VOLT and AFDKO) provide a way to express these such rules.

So I've often wondered if rendering engines actually support m2m lookups or not?

Theunis de Jong's picture
Offline
Joined: 22 Apr 2008 - 5:06pm
0

I've often wondered if rendering engines actually support m2m lookups or not?

I should really double-check this, but I think InDesign does. I constructed a many-to-many translation with a TTX dump as intermediary.

Charles Ellertson's picture
Joined: 3 Nov 2004 - 11:00am
0

For glyph names, underscores are customarily used to indicate ligatures between two characters

More than custom. IIRC, when generating a PDF, that's what the Adobe engine will assume & make happen. So, if you have a glyph named A_B in your font, that glyph will become the two characters A & B in a PDF text stream. (Or, I may not RC...)

A period is what you want; everything after the period is dropped. So, "A.(anything)" remains "A".

Justin Callaghan's picture
Joined: 10 Oct 2003 - 12:49am
0

Thanks for elaborating, Charles. That's my understanding as well, but was trying to stay succinct with the naming advice. No doubt the topic has been [[http://typophile.com/node/33330#comment-200526|discussed here before at some point]].

Charles Ellertson's picture
Joined: 3 Nov 2004 - 11:00am
0

Publisher A decides to take a book out of print, and sell the rights to publisher B. They supply PDF files, without fonts, of course. Publisher B has to take the text stream & use it for the resetting.

And you're trying to be succinct? I've been involved in a few projects where recovering the text was, shall we say (amongst other choice words), expensive.

Or did you mean you wouldn't write the code that way, it was just for this example? Don't scare old people like me. Use a period, even in examples.

Justin Callaghan's picture
Joined: 10 Oct 2003 - 12:49am
0

Charles, perhaps I was not clear. I did use a period in my example code, then succinctly advised the original poster to use periods instead of underscores for suffixes, without fully elaborating on the matter. You explained the technical reasons behind this practice, so I thanked you for taking the time to do so (whereas, in my succinctness, I had not) and linked to a more detailed discussion on the topic. So I'm pretty sure we're in agreement.

Tim Barnes's picture
Offline
Joined: 23 Nov 2012 - 12:03pm
0

thanks everyone for your replies and the ensuing discussion... I've realised there was some illogic in what I was trying to do and, in figuring that out, and considering your contributions, I am now somewhat wiser!