Hi Khaled,

I extended the font mechanism to deal with bidirectional math fonts in such a way that we can have a mixed document (probably mostly usefull for testing fonts). I've put a beta on the ftp server. Hopefully I didn't mess up regular math too much.

% example from the xits suite

% \setupbodyfont[xits]
\setupbodyfont[xitsbidi]

\setupalign[r2l]

\starttext

\setupmathematics[align=r2l]

\startformula
\sqrt{ف^2\over 4ب} \eqno(1)
\stopformula

\setupmathematics[align=l2r]

\startformula
\sqrt{x^2\over 4x} \eqno(1)
\stopformula

\stoptext

The magic is in defining the font i.e. a typescript needs to define it. In font-otf I patched the definition:

    \starttypescript [math] [xits,xitsbidi] [name]
\definefontsynonym[MathRoman] [\s!file:xits-math.otf][\s!features=\s!math\mathsizesuffix,\s!goodies=xits-math]

\definefontsynonym[MathRomanL2R][\s!file:xits-math.otf][\s!features=\s!math\mathsizesuffix-l2r,\s!goodies=xits-math]

\definefontsynonym[MathRomanR2L][\s!file:xits-math.otf][\s!features=\s!math\mathsizesuffix-r2l,\s!goodies=xits-math]
    \stoptypescript

There are some extra predefined featuresets. The R2L and L2R names are just symbolic and used here:

\definebodyfont [default] [mm]
  [mr=MathRoman mo 1,
   mrlr=MathRomanL2R mo 1,
   mrrl=MathRomanR2L mo 1]

Now, bidi is explicitly enabled by setting the direction parameter:

    \starttypescript[xitsbidi]
        \definetypeface [xitsbidi] [rm] [\s!serif] [xits]     [\s!default]
\definetypeface [xitsbidi] [ss] [\s!sans] [heros] [\s!default] [\s!rscale=0.9] \definetypeface [xitsbidi] [tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.05] %definetypeface [xitsbidi] [mm] [\s!math] [xitsbidi] [bidi] [\s!direction=\s!both] \definetypeface [xitsbidi] [mm] [\s!math] [xitsbidi] [\s!default] [\s!direction=\s!both]
    \stoptypescript

Maybe at some point we can just default to bidi for xits.

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------
_______________________________________________
dev-context mailing list
dev-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/dev-context

Reply via email to