Offset overflow?


#1

Anyone got an idea on why I can make this work? And how to fix it?

Basically I want 10 ”special dashes” with different length to replace hyphens in a row. and depending on how many hyphens the user puts in I want a ”special dash” to be activated.

I use the Rlig-feature.

sub @dashes @dashes @dashes by specialdash1;
sub @dashes @dashes @dashes @dashes by specialdash2;
sub @dashes @dashes @dashes @dashes @dashes by specialdash3;
sub @dashes @dashes @dashes @dashes @dashes @dashes by specialdash4;
sub @dashes @dashes @dashes @dashes @dashes @dashes @dashes by specialdash5;

But not this:

sub @dashes @dashes @dashes by specialdash1;
sub @dashes @dashes @dashes @dashes by specialdash2;
sub @dashes @dashes @dashes @dashes @dashes by specialdash3;
sub @dashes @dashes @dashes @dashes @dashes @dashes by specialdash4;
sub @dashes @dashes @dashes @dashes @dashes @dashes @dashes by specialdash5;
sub @dashes @dashes @dashes @dashes @dashes @dashes @dashes @dashes by specialdash6;


#2

What is in the dashes class?

And you should have the longest substitution first, otherwise it will never be triggered.


#3

Thanks!

In the @dashes class these three glyphs are present:

hyphen endash emdash


#4

What you could do is to split it in two steps: first with a short context and then combine the special dashes into longer ones.


#5

I don’t want to overlap (combine the special dashes). It needs to be separate glyphs.

Is this not possible perhaps? Is this some limitation in OpenType code specs? No more the 5 substations in a row?


#6

What Georg meant is that this:

sub @dashes @dashes @dashes by specialdash1;
sub @dashes @dashes @dashes @dashes by specialdash2;

… is equivalent to this:

sub @dashes @dashes @dashes by specialdash1;
sub specialdash1 @dashes by specialdash2;

And writing it this way may help reduce the binary size.


#7

Oh, thanks for clarifying!

I’ll give that a try, Cheers!


#8

It just repeats the first substitution… :sob:


#9

It works only if I manually place the first @specialdash1 and then type hyphen after.


#10

Can you send me the .glyphs file please to support (at) (this website without www). I will have a look.


#11

I had a look at the file. It is very interesting: Ligature substitutions do not actually support classes. So makeOTF expands this to have simple ligature substitution for all combinations from the classes:

 sub emdash emdash emdash emdash emdash emdash by ipcodash5;
 sub emdash emdash emdash emdash emdash endash by ipcodash5;
 sub emdash emdash emdash emdash emdash hyphen by ipcodash5;
 sub emdash emdash emdash emdash endash emdash by ipcodash5;
 sub emdash emdash emdash emdash endash endash by ipcodash5;
 sub emdash emdash emdash emdash endash hyphen by ipcodash5;
 sub emdash emdash emdash emdash hyphen emdash by ipcodash5;
 sub emdash emdash emdash emdash hyphen endash by ipcodash5;
 sub emdash emdash emdash emdash hyphen hyphen by ipcodash5;
 sub emdash emdash emdash endash emdash emdash by ipcodash5;
 sub emdash emdash emdash endash emdash endash by ipcodash5;
 sub emdash emdash emdash endash emdash hyphen by ipcodash5;
 sub emdash emdash emdash endash endash emdash by ipcodash5;
 sub emdash emdash emdash endash endash endash by ipcodash5;
 sub emdash emdash emdash endash endash hyphen by ipcodash5;
 sub emdash emdash emdash endash hyphen emdash by ipcodash5;
 sub emdash emdash emdash endash hyphen endash by ipcodash5;
 sub emdash emdash emdash endash hyphen hyphen by ipcodash5;
 sub emdash emdash emdash hyphen emdash emdash by ipcodash5;
 sub emdash emdash emdash hyphen emdash endash by ipcodash5;
# and more than 3000 lines like this.

First, I though it should be done like this:

lookup dash1 {
	sub @dashes @dashes @dashes by ipcodash1;
} dash1;
lookup dash2 {
	sub ipcodash1 ipcodash1 @dashes @dashes by ipcodash6;
	sub ipcodash1 ipcodash1 @dashes by ipcodash5;
	sub ipcodash1 ipcodash1 by ipcodash4;
	sub ipcodash1 @dashes @dashes by ipcodash3;
	sub ipcodash1 @dashes by ipcodash2;
} dash2;

That works but Indesign gets confused where to put the cursor. And then I came up with this:

lookup dash1 {
	sub @dashes' @dashes @dashes by hyphen;
	sub @dashes @dashes' @dashes by hyphen;
	sub @dashes @dashes @dashes' by hyphen;
} dash1;
lookup dash2 {
	sub hyphen hyphen hyphen hyphen hyphen hyphen hyphen hyphen by ipcodash6;
	sub hyphen hyphen hyphen hyphen hyphen hyphen hyphen by ipcodash5;
	sub hyphen hyphen hyphen hyphen hyphen hyphen by ipcodash4;
	sub hyphen hyphen hyphen hyphen hyphen by ipcodash3;
	sub hyphen hyphen hyphen hyphen by ipcodash2;
	sub hyphen hyphen hyphen by ipcodash1;
} dash2;

So first, all dashes are converted to hyphens and then the plain ligatures will work just fine.


#12

Thanks so much! This works like a dream.

Hugs from Sweden
Göran


#13

Do you have correct ligature (elements) count in gdef? I thought that Indesign bug was gone. The World Ready composer worked better, some years ago.


#14

The ligature count is calculated by makeOTF and it can’t reliably do that because of the multiple substitutions. I look into this.