2

I am trying to typeset a book in arabic in ConTeXt. I have stumbled upon this issue

Page Numbers change after 9 to 01 for page 10 21 for page 12 31 for page 13 41 for page 14 and so on

The issue seems to be with

\setupheader[style=\righttoleft, state=normal]

I need the righttoleft setting for the arabic text to appear correctly in the header.

Here is the snapshot of the page number issue: enter image description here

Here is my ConTeXt Code:

\mainlanguage[arabic]

\setupdirections[bidi=global]

\definefontfeature
  [arabic]
  [mode=node,language=dflt,script=arab,
    init=yes,medi=yes,fina=yes,isol=yes,
    liga=yes,dlig=yes,rlig=yes,tlig=yes,
    calt=yes,trep=yes,clig=yes,
    mark=yes,mkmk=yes,kern=yes,curs=yes]


\starttypescript [serif] [arabic]
  \definefontsynonym [Arabic-Regular] [file:ScheherazadeRegOT.ttf] [features=arabic]
  \definefontsynonym [Arabic-Bold] [file:ScheherazadeRegOT.ttf] [features=arabic]
\stoptypescript

\starttypescript [serif] [arabic] [name]
 \usetypescript[serif][fallback]
 \definefontsynonym [Serif]     [Arabic-Regular] [features=arabic]
 \definefontsynonym [SerifBold] [Arabic-Bold]    [features=arabic]
\stoptypescript

\starttypescript [Arabic]
  \definetypeface [Arabic] [rm] [serif] [arabic] [default] 
\stoptypescript 



\setupmargindata[margintext]
    [align=r2l]

\setupalign[r2l]  


\setuppapersize[A4]


\setuplayout[
  grid=min,
  backspace=46.666mm, width=140mm,
  topspace=33.000mm, height=198mm,
  header=12.9mm,footer=9mm,
  ]


%% Double sided document
\setuppagenumbering[
  alternative=doublesided,
  state=none,
  location={header,marginedge},
%  conversion=romannumerals, left={--~}, right={~--},
]


\setupbodyfont[Arabic,18pt]
\setupinterlinespace[line=42pt]


\setupheads[number=no]
\setuphead[chapter][style=\bfd,before=,after=\blank,alternative=middle,grid=both]
\setuphead[section][style=\bfc,before=\blank,after=,grid=both]

\setupbackgrounds[text][text][frame=off, topframe=on]

\setupheader[style=\righttoleft, state=normal]     

\setupheadertexts
        [{\getmarking[chapter]}]    [{\pagenumber}]
        [{\pagenumber}]        [{\getmarking[chapter]}]



\starttext
\chapter{شرح الآجرومية}
الحمد لله رب العالمين، وصلى الله وسلم وبارك على عبده ورسوله نبينا محمد وعلى آله وصحبه أجمعين، أما بعد:\\
\stoptext
  • 1
    Please don't ask the same question on both the ConTeXt mailing list and here – Aditya Jan 18 '16 at 18:23
2

It seem like the command \righttoleft reverse the order of numbers in header, you can maintain \pagenumber to be written from left to right as follows

\let\Pagenumber\pagenumber
\def\pagenumber{\hbox{\textdir TLT\Pagenumber}}

or

\let\Pagenumber\pagenumber
    \def\pagenumber{\hbox{\lefttoright\Pagenumber}}

Code

\mainlanguage[arabic]

\setupdirections[bidi=global]

\definefontfeature
  [arabic]
  [mode=node,language=dflt,script=arab,
    init=yes,medi=yes,fina=yes,isol=yes,
    liga=yes,dlig=yes,rlig=yes,tlig=yes,
    calt=yes,trep=yes,clig=yes,
    mark=yes,mkmk=yes,kern=yes,curs=yes]


\starttypescript [serif] [arabic]
  \definefontsynonym [Arabic-Regular] [file:ScheherazadeRegOT.ttf] [features=arabic]
  \definefontsynonym [Arabic-Bold] [file:ScheherazadeRegOT.ttf] [features=arabic]
\stoptypescript

\starttypescript [serif] [arabic] [name]
 \usetypescript[serif][fallback]
 \definefontsynonym [Serif]     [Arabic-Regular] [features=arabic]
 \definefontsynonym [SerifBold] [Arabic-Bold]    [features=arabic]
\stoptypescript

\starttypescript [Arabic]
  \definetypeface [Arabic] [rm] [serif] [arabic] [default] 
\stoptypescript 



\setupmargindata[margintext]
    [align=r2l]

\setupalign[r2l]  


\setuppapersize[A4]


\setuplayout[
  grid=min,
  backspace=46.666mm, width=140mm,
  topspace=33.000mm, height=198mm,
  header=12.9mm,footer=9mm,
  ]


%% Double sided document
\setuppagenumbering[
  alternative=doublesided,
  state=none,
  location={header,marginedge},
%  conversion=romannumerals, left={--~}, right={~--},
]


\setupbodyfont[Arabic,18pt]
\setupinterlinespace[line=42pt]


\setupheads[number=no]
\setuphead[chapter][style=\bfd,before=,after=\blank,alternative=middle,grid=both]
\setuphead[section][style=\bfc,before=\blank,after=,grid=both]

\setupbackgrounds[text][text][frame=off, topframe=on]

\setupheader[style=\righttoleft, state=normal]     

\let\Pagenumber\pagenumber
\def\pagenumber{\hbox{\textdir TLT\Pagenumber}}

\setupheadertexts
        [{\getmarking[chapter]}]    [{\pagenumber}]
        [{\pagenumber}]        [{\getmarking[chapter]}]



\starttext
\chapter{شرح الآجرومية}
الحمد لله رب العالمين، وصلى الله وسلم وبارك على عبده ورسوله نبينا محمد وعلى آله وصحبه أجمعين، أما بعد:\\
\stoptext

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.