\startenvironment heb-sty

\mainlanguage[hebrew]

\definefontfeature
   [hebrew]
   [mode=node,language=dflt,script=hebr,
    init=yes,medi=yes,fina=yes,isol=yes,
    liga=yes,dlig=yes,rlig=yes,clig=yes,
    mark=yes,mkmk=yes,kern=yes,curs=yes]

\starttypescript [serif] [hebrew]
    \definefontsynonym [EzraSIL] [file:sileot] [features=hebrew]
\stoptypescript

\starttypescript [serif] [hebrew] [name]
    \usetypescript[serif][fallback]
    \definefontsynonym [Serif] [EzraSIL] [features=hebrew]
\stoptypescript

\starttypescript [hebrew]
    \definetypeface [hebrew] [rm] [serif] [hebrew] [default]
\stoptypescript

\def\HebrewParDir {\textdir TRT\pardir TRT}
\def\HebrewTextDir{\textdir TRT}
\def\LatinParDir  {\textdir TLT\pardir TLT}
\def\LatinTextDir {\textdir TLT}

\usetypescript[hebrew]

\define\sethebrew{\HebrewParDir\switchtobodyfont[hebrew,20pt]}
\define\setlatin {\LatinParDir \switchtobodyfont[modern,20pt]}

\definestartstop[hebrewpar][commands=\hebrew\HebrewParDir]
\definestartstop[latinpar] [commands=\Hebrew\LatinParDir]

\define[1]\RT{\begingroup\hebrew\HebrewTextDir#1\endgroup}
\define[1]\LT{\begingroup\modern\LatinTextDir #1\endgroup}

\setcharactermirroring[1]

\stopenvironment

