Skip to main content
Participating Frequently
April 17, 2004
Question

ordinals feature

  • April 17, 2004
  • 12 replies
  • 1564 views
hallo,
I have problem to make ordinals substitution working:

sub [one one.small one.osf] s' t by s.superior
sub [one one.small one.osf] s t' by t.superior

(I have also tried
sub [one one.small one.osf] s.superior t' by t.superior

in any case I alwas get this result /one /s.superior /t

it seems to me that any substitution with the target glyph in the end of the string longer than two glyphs is not working and I cannot find the reason why. but it is working when the target glyph is in the middle.

any ideas?

thanks a lot for any hint

pavel
This topic has been closed for replies.

12 replies

Participating Frequently
April 19, 2004
Read,
Thanks for your explanation, but as I have written my problem is that I also tested

sub [one one.small one.osf] s.superior t' by t.superior

but it did not work neither.

Even if I use any similar substitution - I mean the target glyph is in the end of the context matching string - it does not work at all.

In short, any substitution

sub a b c' by c.alt

is not working. I would like to avoid defining @classALL_NON_SPACE_CHARS, as the font has more than thousand glyphs.

I looked into Minion Pro which ordn feature works fine in IND but it uses the same type of substitution as I intended to use! So I am completely confused now.

Pavel
Inspiring
April 19, 2004
This is because the logic for processing substitution rules says:<br />1) for each substitution lookup in the font:<br /> 2) for each rule in the current lookup<br /> 3) check the current glyph position to see if rule match string matches here. If so, then apply the rule, advance the current glyph position by the length of the substitution target string, and start over at 2)<br /><br />Your first rule matches in in the string "/one /s /t" when the current glyph '/s'. The rule is applied. The string then is "one /s.superior /t", and the current glyph is "/t". the second rule will never match, because it does not contain "/s.superior" in the match context. To work, this should be:<br /><br />sub [one one.small one.osf] s' t by s.superior <br />sub [one one.small one.osf] s.superior t' by t.superior<br /><br />The way you wrote the first rule guarantees that "/s" will have been changed to "/s.superior" by the time the rule processor gets to the second rule.<br /><br />Gratuitous complications:<br />The bit about "advance the current glyph position by the length of the substitution target string" means that if rule looked like:<br /><br />sub [one one.small one.osf] s' t' by s_t.superior;<br /><br />then current position woudl have been advanced by two glyphs, not jsut one, as the lenght of the strign that was substituted is two glyphs.<br /><br />An oddity that is useful for avoiding overly complex match contexts is the 'ignore sub' rule. If you say:<br />'ignore sub <some match string>;<br /> then the rule processing logic will match at that rule, but do nothing. This can be used to shelter subsequent rules from a particular context.. For example, you could say:<br />ignore sub [ @ALL_NUMBERS ] s t [ @ALL_NON_SPACE_GLYPHS ];<br />to avoid matching a context where the 'st' was followed by something other than whitespace.