Problem with Greek letters messing up OpenType feature code in TextEdit

Hey there,

I am working on a feature for a handwriting font that is about detecting if a glyph is entered in a mathematical context and then should replace the glyph with a mathematical not connected version of the glyph.

This is the formula I am trying to write:


The code renders correctly in InDesign which looks like this:

In TextEdit the same formula renders like this:

It seems to me TextEdit does not recognise the alpha, and renders the connected letter form instead of the desired isolated letter form.

The feature code I use to process this is placed in the calt feature

sub @MathIndicators @MathLettersToBeReplaced@Mathindicators by @MathLetters;

When I replace the alpha with a any other letter for example a “c”, TextEdit renders correctly the isolated form and not the connected form:

Also I have noticed that I can enter as many spaces and numbers as I want, the first time after a greek letter the feature will not work, until another two @MathIndicator’s are entered (for example space or number).

So far I have tried to put the alpha at another code point MATHEMATICAL ITALIC SMALL ALPHA (u+1D6FC) vs. Greek small letter alpha (u+03B1) - with the same result. I have looked into the .rtf file and the glyphs are indicated in the rtf code with correct code points /945 and /120572.

Thank you very much for your help!

The context for the OpenType features sometimes is separated by script. So the alpha is a separate string and has no math indicators around it. Different implementation handle that differently.

One way to handle this is to have the not connected shapes as default and replace them in none math contexts with the connecting shapes.

Thank you for the information Georg.
I am not really sure if I understand what “separated by script” or a “separated string” means in this context.

This is what the .rtf code looks like:

{\fonttbl\f0\fnil\fcharset0 AlbertEinstein1-029m-Regular;}

\f0\fs24 \cf0  
\fs96 \uc0\u945 x\u945 }

Are you saying that the OpenType feature is separated in TextEdit by script because in the .rtf code is stored as \u945 x\u945 instead of αxα (alpha x alpha) ?

If so would there be another way to address the substitution rule i.e.:

sub \u945 x' \u945 by x.isol

Thank you for clarifying!

PS.: I just tested the code with Notepad on a PC and it shows the same results - however InDesign still renders the font as intended.

The OpenType layout engine divides the string for each script and only applies the features for each portion. Has nothing to do how it is stored in the file.