OpenType code for infinite length Start [Middle Middle Middle…] End sequence

What’s the code to create an arbitrary length sequence where you have a substitution that turns :

x [x x x …] x


Start [Middle Middle Middle …] End

Where x is the same glyph and Middle can be any number from 0 to infinity (or the line length).
(Also just curious what’s the correct notation to denote this type of repetition?).

My particular use case is creating a infinite number of connected numbersigns, I have the following code but it seems clumsy, I wonder if there’s a more efficient way of doing this:

lookup numbersign_numbersign.start {
sub numbersign.start numbersign' by numbersign.end;
sub numbersign' numbersign by numbersign.start;
} numbersign_numbersign.start;

lookup numbersign_numbersign.middle {
sub numbersign.middle numbersign.start' by numbersign.middle;
sub numbersign.end' numbersign.start by numbersign.middle;
sub numbersign.end' numbersign by numbersign.middle;
} numbersign_numbersign.middle;

lookup numbersign_numbersign.end {
sub numbersign.middle numbersign' by numbersign.end;
} numbersign_numbersign.end;

I did read this post but still couldn’t get it to work, this is what I get as a result when I type

## ### #### ##### ######
/numbersign.init/numbersign.medi  /numbersign.medi/numbersign.medi/numbersign.medi 

The init and fina only works at the start and end of the run but not in the middle. I put every glyph into the AllLetters class.

Here’s another solution for those following:

lookup numbersign.init {
sub numbersign' numbersign by numbersign.init;
} numbersign.init;

lookup numbersign.medi {
sub numbersign.medi numbersign.init' by numbersign.medi;
sub numbersign.init numbersign.init' by numbersign.medi;
} numbersign.medi;

lookup numbersign.fina {
sub numbersign.init numbersign' by numbersign.fina;
sub numbersign.medi numbersign' by numbersign.fina;
} numbersign.fina;
1 Like