# Contextual alternates?

Hi,
I’m trying to make a font that can be constructed of 8(eight) parts depending on a combination of numbers. The idea is that each glyph is constructed out of eight parts; four corners and four sides. Each part corresponds to a number, as such:

789
4 6
123

When the user types a certain assigned letter followed by a number combination (a maximum of five numbers) using the digits above, the font would then interpret the combination and determine what glyph that represents. I’ve calculated the number of unique glyphs would be 218, every possible variation you can make using 1-5 numbers from 1 to 8, not counting duplicates. Hence, a number combo of 231 and 123 should be treated as the same.

Am I making any sense here and is this possible?

I think it’s possible but I’m not sure I understand it.
Wouldn’t you want to define all eight positions?
Can you show me an example?

Lets just say that I want the font to exchange glyphs depending on what number combination I’ve pressed.
Combos could be; 2973, 617, 21674 or 21.
Given this, ‘13482’ should be interpreted as the same as ‘38142’ as it contains the same digits and is just a variation.
Each number can only be used once per combo, therefore, ‘114’ is not allowed and should be interpreted as 1 and 14.

This is what I want my font to do:

• a feature that can interpret a series of digits regardless in what order they are typed. Ie. 123=213=321=231 etc.
• a sequence is between one and five digits long using 1-4 & 6-9.
• the feature should not interpret double digits such as; 11223.
• each sequence should be preceded by a special character to mark the start of the sequence.

A quick example of how it could look:

This is possible. Just create the digits 1 thru 4 and 6 thru 9 with width=0 and negative left sidebearing. And the trigger glyph (=‘special character to mark the start of the sequence’) as a placeholder with the width of the symbol you intend.

Let’s take the asterisk (*) as trigger. Valid combos are e.g. *123, *789, *9163 etc.

But what should happen if the user types *11? Should it turn it into *1*1? That's a little difficult, but still possible. Also, imagine a user types *1a3b9. Remember it's a font, not a program with a user interface.

Perhaps the best solution (which can be done in a simple calt feature) is to have regular digits (/one/two/three etc.) and only substitute them by the lines (/line1/line2/line3 etc.) right after an asterisk and until a digit is repeated or the sequence ends. So *11 would yield /placeholder/line1/one. And *1a3b9 would yield /placeholder/line1/a/three/b/nine. Sounds good?

I tried to make a feature like this:

sub one’ two’ by otw;
sub two’ one’ by otw;
sub otw’ three’ by otth;
sub three’ otw’ by otth;

This doesn’t work though. How should this be used?
I’m not really sure when to use the different features such as calt or clig or liga and whatnot…

What you do is to make eight glyphs with each has one line. To test it use the regular numbers spots so you don’t need an features. All glyphs have a width of zero and the outlines are on the left side of the bounding box and the asterisk has the width of the hole thing but no outline.

then you type the asterisk and any number from one to eight. if you have on number twice you get the same glyph twice but would not see it.

Hi, George and thank you for taking the time to answer my question. However, my task is a little bit more complicated than that. The image I posted was a huge simplification. I have included a new image that is more accurate than the other. I hope it will shed some more light to my problem.

By just stacking the glyphs on top of each other will not overlap as I intend.

Thank you for being patient because I’m really struggling with how to explain it.

In this case, the marks (') are wrong since it's not a contextual substitution. You want the third picture? That's a little more complicated because then you need to catch all possible orders of up to eight numbers.