I tried for weeks to find a solution to the next thing. I don’t want the random, I want a substitution in a certain order. I made an example to make it easier. I read all the tutorials on the internet but I found nothing that talks about that.
Any ideas? That would be crazy!
Write down the logic of the pattern you want. Write a python script to generate the OpenType code.
I could have been more clear, you’re right.
I’ve n versions of each letter.
Each time a certain letter is present in the chain (text), I need that the feature knows the version of the glyph used the last previous time that letter has appeared in the chain and use the next version of the glyph for this letter.
When each n version of the letter has been used, the counter is resetted and the first version is reused.
More difficult, this substitution should not be interrupted by spaces.
And even ideally the substitution should not be interrupted by line breaks!
The global idea is that letters appears as much as possible different during the reading of the text. And that all n versions are used.
What you want is pretty much what the Advanced Alternates tutorial does. Please read that one and adapt the code where necessary.
The basic problem you have to address is that you have to define the context for your substitution, and it cannot go back indefinitely. So, “the last time it was used” must become “the last time it was used in the past x characters” and x cannot become too high. Also keep in mind that most renderers only consider GSUB contexts per line (Adobe) or per paragraph (Apple), and you cannot work around that from inside the font.
I was trying to search something similar but couldn’t find the specific thing I was looking for; this topic was the closest to the matter.
Is it possible to sub an entire word for another via calt feature?
Thanks in advance!