The following email had large attachments (more than 100K).  I uploaded everything here:
http://mhbateni.com/context/bug-04/

On Thu, May 25, 2017 at 11:40 PM, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
Hello Hans,

I'm going to explain a strange problem which came about, as far as I can tell, in beta 2017.04.27 01:00.  The same beta had introduced some other issues with fallbacks, which you fixed already.  Thanks a lot for that!

I am now using the latest beta, version 2017.05.25 12:50.  Unfortunately I don't know what is going on precisely.  Here is a sort-of-minimal non-working example.


%%%%%%%%%%%%%%%%%%%%%%%%%

\definefontfeature[slanted][slant=.4]


\starttypescript [serif][sahel][name]

  \resetfontfallback [dejavudefault]

  \definefontfallback[dejavudefault][dejavusans] [range=generalpunctuation,check=yes,force=no]

%

  \definefontsynonym [SahelReg]    [Sahel][features={arabic,tlig},fallbacks=dejavudef]

%% NOTE 1

%  \definefontsynonym [SahelReg] [Sahel][features={arabic,tlig}]

  \definefontsynonym [SahelBd]       [SahelBold][features={arabic,tlig},fallbacks=dejavudef]

  \definefontsynonym [SahelIt]         [Sahel][features={arabic,tlig,slanted},fallbacks=dejavudef]

  \definefontsynonym [SahelBdIt]     [SahelBold][features={arabic,tlig,slanted},fallbacks=dejavudef]

%

  \definefontsynonym [Serif] [SahelReg]

  \definefontsynonym [SerifBold] [SahelBd]

  \definefontsynonym [SerifItalic] [SahelIt]

  \definefontsynonym [SerifBoldItalic] [SahelBdIt]

\stoptypescript


\starttypescript [math] [modern] [name]

\definefontsynonym [MathRoman] [name:modern] [features=math\mathsizesuffix]

\stoptypescript


\starttypescript [myfont]

\definetypeface [myfont][rm] [serif][sahel] [default]

%% NOTE 2

\definetypeface [myfont][mm] [math] [modern][default]

\stoptypescript


\setupbodyfont[myfont,rm]

%% NOTE 3

%\definedfont[Serif]


\def\Sample{{\lefttoright Salam} {\righttoleft سلام} }


\starttext

rm:\Sample

{\bf bf:\Sample}

{\it it:\Sample}

{\bi bi:\Sample}


%% NOTE 4

\definedfont[SahelReg]\Sample

\definedfont[Serif]\Sample


\stoptext

%%%%%%%%%%%%%%%%%%%%%%%%%


Background

Commenting/uncommenting some of the lines produces three outputs, only one of which seems correct to me.  I have attached the three.  Betas before 4/27 always produced the correct solution.

I am using a free open-source Farsi font, whose English glyphs come from Open Sans font.  I am attaching the specific versions of the Farsi font to reproduce the same results.


Explanation:

Compiling the MWE above produces wrong-1.pdf in recent betas.  The serif font has not been set up properly on the first line of output.  Instead the default Latin Modern has been used, which looks different and misses the Farsi glyphs.

Strangely there is nothing wrong with the second line of text, which shows Serif and SahelReg fonts are both set up just fine.  See "NOTE 4" in the MWE.

Replacing the line above "NOTE 1" with the line below it—i.e., if I remove the fallbacks for definition of SahelReg—generates correct.pdf as output.  I get the same correct output if uncomment the line below "NOTE 3," which should be a no-op in my opinion.  Notice that setting the fallback for bold, italic and bold italic has not caused any issues.  It's only the serif itself that's acting up weirdly.

Finally when I comment the math definition below "NOTE 2," I get wrong-2.pdf as output.  Here everything seems okay except that the serif on the first line—but strangely not on the second line—misses the Arabic features: the letters are not joined.


I spent quite some time investigating the changes to the GitHub repository on 4/27, to pinpoint what might have caused this issue, but my efforts didn't go anywhere.  I hope you can spot the issue.


Thanks a lot for your attention!
—MHB