Typophile

InDesign & Illustrator: contextual alternates at the end of a line

twardoch

Guys,

I just ran into a problem in InDesign and Illustrator. In short: at the end of the line InDesign and Illustrator imply a space glyph. That's pretty annoying.

So I had this portion of code:

@WORDSEPA = [space period comma];
@ALLTEXT = [...all glyphs including space...];

feature calt {
lookup calt.linefina {
ignore sub @linefina0' @ALLTEXT;
sub @linefina0' by @linefina1;
} calt.linefina;

lookup calt.wordfina {
sub @wordfina0' @WORDSEPA by @wordfina1;
} calt.wordfina;
} calt;

which worked fine in TextEdit or Word 2010. At the end of a word, the @wordfina0 class was substituted by the @wordfina1 class, while at the end of a line, the @linefina0 class was substituted by the @linefina1 class. But in InDesign, the second lookup (calt.wordfina) kicked in, not the first.

So I discovered that InDesign and Illustrator (CS4 and CS5) imply a space glyph at the end of every line (including the last line in a text frame).

I developed a workaround that looks like the following:

@WORDSEPA = [space period comma];
@ALLTEXT = [...all glyphs not including space...];

feature calt {
lookup calt.linefina {
ignore sub @linefina0' @ALLTEXT;
ignore sub @linefina0' space @ALLTEXT;
sub @linefina0' by @linefina1;
} calt.linefina;

lookup calt.wordfina {
sub @wordfina0' @WORDSEPA by @wordfina1;
} calt.wordfina;
} calt;

This now works in TextEdit and Word 2010 (where the first ignore sub rule kicks in), as well as in InDesign and Illustrator (where the second ignore sub rule is used). Of course, a side-effect of this is that typing two spaces will make the calt.linefina lookup kick in instead of the calt.wordfina lookup, but I think it's an acceptable price to pay.

However, I believe this is a bug in InDesign and Illustrator (I've informed Adobe about this).

Best,
Adam

Is this related with this other post?
http://typophile.com/node/74468

Miguel, if you apply underlining to an entire paragraph, the "final" space at the end of each line also gets underlined ... Much to the dismay of fans of underlining.

I'm not sure if that has been true for all versions of InDesign.

Thanks, Wielce Szanowny Panie Adamie

Captured from web.archive.org on 20 Oct 2013. view this capture