Page 1 of 1

Can we change the input sequence ?

Posted: Mon Apr 10, 2017 9:06 am
by raghugada
Hi,

This is my input sequence
pmq

I want the output sequence to be
pqm

Is it possible to change the above sequence ?
If so please suggest me how to do this ?

Re: Can we change the input sequence ?

Posted: Mon Apr 10, 2017 11:19 am
by Erwin Denissen
I'm not sure what you want to achieve.

If you want to replace a single character depending on the context, e.g. replace a character if it is preceded or followed by specific character, then use a contextual substitution.

If you want to replace multiple glyphs with multiple glyphs, then you need to know it is consider bad practice, so we strongly recommend against it. If you still want this, then you need to use a work-around, as OpenType layout features don't support multiple to multiple substitution lookups.

One way to accomplish this is to first replace several glyphs with a single (unmapped) glyph, using a ligature substitution. Then use a mulitple substitution lookup, (also known as decompose) to replace the ligature back into the final glyphs.

If you only want to make this happen if the text is preceded by a letter "p", then use the ligature within a contextual substitution.

Code: Select all

script latn {
  feature StandardLigatures1;
}

feature StandardLigatures1 liga {
  lookup ChainingContext1;
  lookup MultipleSubstitution1;
}

lookup Ligature1 {
  sub m q -> mult2multi;
}

lookup ChainingContext1 {
  context (p) m q;
  sub 0 Ligature1;
}

lookup MultipleSubstitution1 {
  sub mult2multi -> q m;
}

Re: Can we change the input sequence ?

Posted: Mon Apr 10, 2017 3:06 pm
by raghugada
Hi,

Actually i want to change the position of characters in the output.
I don't want to substitute

Re: Can we change the input sequence ?

Posted: Mon Apr 10, 2017 3:20 pm
by Erwin Denissen
raghugada wrote:Hi,

Actually i want to change the position of characters in the output.
I don't want to substitute
That is related to word processing, not to fonts. If you want that, type the characters in the different order or use search-replace in your word processing software.