Exception from pseudo-randomization

Hello.

I’m running Mekkablue’s pseudo randomizing script where it jumbles different classes. Is there any way of making an exception from this?
What i would like to do is have a specific word that is set in specific style-sets (ex.: s o.ss02 b e.ss01 r.ss03). I know this could be done with a ligature, but i would like to be able to control the single characters instead, without it overriding the randomization when i spell out other words?

Does this make sense?

Insert the substitution for the word before the rest of the (generated) code.

But is it possible to substitute a string of letters- The OpenType Cookbook only seem to touch upon substituting one w. one 0r many w. one(as a ligature).

Is it possible to do something like `sub h e l l o by h.ss01 e.ss02 l.ss02 l.ss01 o.ss03; so that the substitution only happens when the word hello is written?

Does it not work? Put it inside a lookup maybe. Send me the code (or better post it here) if it still does not work.

So this is how my code looks:

I just get a “invalid ligature rule replacement” warning, when i try to run it.

lookup LETTER {

sub Z e a l a n d by Z e a.ss04 l a.ss02 n.ss02 d;

} LETTER;

# BEGIN PSEUDORANDO

sub @calt00@calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00@calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00@calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00@calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00@calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00@calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 @calt00 by @calt00;…

You can’t do many to many substitutions.

You need to sub each glyph individually

lookup LETTER {

sub Z e a' l a n d by a.ss04;
sub Z e a.ss04 l a' n d by a.ss02;
sub Z e a.ss04 l a.ss02 n' d by n.ss02;

} LETTER;

I didn’t tried this. You might need to put each line in its own lookup.

I see, you need a different solution in this case.

  1. In Font Info > Features, click the Plus button and add the AllLetters class.
  2. In the feature, add this code:
lookup ZEALAND {
	ignore sub @AllLetters Z' e' a' l' a' n' d';
	ignore sub Z' e' a' l' a' n' d' @AllLetters;
	sub Z e a' l a n d by a.ss04;
	sub Z e a.ss04 l a' n d by a.ss02;
	sub Z e a.ss04 l a.ss02 n' d by n.ss02;
} ZEALAND;

The ignore lines make sure it is only replaced when it really just says Zealand, not when there is any other letter coming before or after.

EDIT: sorry for double post, was writing under bad internet connection circumstances.

Yeah i got that much working yesterday, but if there is any text coming after the word Zealand it seems that ignore sub @All Z' e' a' l' a' n' d'; ignore sub Z' e' a' l' a' n' d' @All; changes it to default glyphs and not the appointed style sets.
What i want is the word Zealand to always be appointed the specified style sets, even when there is a ‘space’ or glyph following the word.

I tried something like this, but doesn’t seem to work as intended. :

  lookup ZEALAND {
    	ignore sub @All Z' e' a.ss04' l' a.ss02' n.ss02' d';
    	ignore sub Z' e' a.ss04' l' a.ss02' n,ss02' d' @All;
    	sub Z e a' l a n d by a.ss04;
    	sub Z e a.ss04 l a' n d by a.ss02;
    	sub Z e a.ss04 l a.ss02 n' d by n.ss02;
    } ZEALAND;

Added the All class instead of AllLetters since i wanted ‘space’ to be included as well.

Seems i found a solution. If i add the word(with its appointed style sets) to a class of its own and ignore sub of that class then everything seems to work.

Thanks for the help!!!

That means just delete the second ignore line from the code I pasted above. It stipulates that the code that follows in the lookup is not executed if there is a letter following. Please familiarise yourself with the ignore statement, you will find a good description of it in the Positional Alternates tutorial.

1 Like