I'm wondering if it's possible to script any advanced features. Primarily I'm looking to solve a specific problem, but more generally I'm curious if more can be done with OT scripting than the standard "sub" script to replace one glyph with an other.
I'm tired of people over-hyphens so I wanted to script a fix for that, so in the standard ligatures I put the following code:
sub comma hyphen by comma_endash;
This replaces the comma followed by a hyphen with a ligature glyph where I have a comma followed by a line which is in between the hyphen and the en dash in length, which is more appropriate for denoting prices ($50,–).
Now I want to do the same fix for "x" after numbers, so every time an /x is typed after a number it's automatically replaced by a multiply symbol. Unfortunately I'm unable to script this accordingly. Every time I try to generate the font, it aborts because of an error in the script. Now, I'm not sure if my code is appropriate for numbers. I'm trying the following:
sub one x by one multiply;
I suppose it's possible to replace 1 followed by x by a '1×' "ligature" like in the comma/hyphen example but I need the code to be much more flexible because it's not realistic to create such a "ligature" for all numbers from all number sets, and with this method it's no longer affected by tracking. So is there a way to define that the /x is automatically replaced by the multiply symbol when preceded by a number? If I can't script this for all numbers automatically, is it possible to script it for each number specifically without having to rely on the ligature method described above? Is this function possible at all?