页码以反向显示,例如 ConTeXt MarkIV 中的第 12 页显示为 21

页码以反向显示,例如 ConTeXt MarkIV 中的第 12 页显示为 21

我正在尝试在 ConTeXt 中排版一本阿拉伯语书籍。我偶然发现了这个问题

页码在 9 之后发生变化,01 表示第 10 页,21 表示第 12 页,31 表示第 13 页,41 表示第 14 页,依此类推

问题似乎在于

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

我需要从右到左的设置才能使阿拉伯文本正确显示在标题中。

以下是页码问题的快照: 在此处输入图片描述

这是我的 ConTeXt 代码:

\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

该命令似乎\righttoleft颠倒了标题中的数字顺序,您可以保持\pagenumber从左到右书写,如下所示

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

或者

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

代码

\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

相关内容