From 56fd3783bbc7c711b165ddcd656bafd62985b7f9 Mon Sep 17 00:00:00 2001 From: olsak Date: Thu, 27 Apr 2023 16:02:36 +0200 Subject: [PATCH] minor changes to TRT typesetting, see thread #132 --- optex/base/hyperlinks.opm | 2 +- optex/base/margins.opm | 27 +++++++++++++++++++++++++-- optex/base/output.opm | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/optex/base/hyperlinks.opm b/optex/base/hyperlinks.opm index 7505436f..1d15b5e7 100644 --- a/optex/base/hyperlinks.opm +++ b/optex/base/hyperlinks.opm @@ -136,7 +136,7 @@ \_replstring\_tmpb{[||]}{{gb|}}% \_replstring\_tmpb{ }{{ }}% \_replstring\_tmpb{://}{{://}}% - \_ea\_ulink \_ea[\_ea{\_tmpa}] {\_urlfont \_ea\_urlA\_tmpb\_fin}% + \_ea\_ulink \_ea[\_ea{\_tmpa}] {\_urlfont \_textdirection=0 \_ea\_urlA\_tmpb\_fin}% }} \_def\_urlA#1{\_ifx\_fin#1\_else \_urlC{}{#1}\_fi} \_def\_urlB#1{\_ifx\_fin#1\_else \_urlC{\_urlxskip}{#1}\_fi} diff --git a/optex/base/margins.opm b/optex/base/margins.opm index d88cc042..fe52a40f 100644 --- a/optex/base/margins.opm +++ b/optex/base/margins.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \margins {Macros for margins setting <2021-03-15>} % preloaded in format +\_codedecl \margins {Macros for margins setting <2023-04-27>} % preloaded in format \_doc ---------------------------- \`\margins``/ (,,,)` @@ -36,9 +36,11 @@ \_fi\_fi \_if 1#1\_shiftoffset=0pt \_def\_prepoffsets{}\_else \_if 2#1% double-page layout \_shiftoffset = \_dimexpr \_pgwidth -\_hsize -2\_hoffset \_relax - \_def\_prepoffsets{\_ifodd\_pageno \_else \_advance\_hoffset \_shiftoffset \_fi}% + \_def\_prepoffsets{\_ifodd\_pageno \_else \_advance\_hoffset \_shiftoffset \_fi + \_setpagerightoffset}% \_else \_opwarning{use \_string\_margins/1 or \_string\_margins/2}% \_fi\_fi\_fi + \_setpagerightoffset } \_def\_setpagedimens{\_isnextchar({\_setpagedimensB}{\_setpagedimensA}} \_def\_setpagedimensA#1 {\_ifcsname _pgs:#1\_endcsname @@ -74,7 +76,28 @@ \_public \magscale ; + \_doc ----------------------------- + When left-to-right direction of typesetting is selected (default) then + \"main vertical line" of the page has `\hoffset` distance from the left + paper border and all lines at the page start here and run to the right side + (exceptions can be done by `\moveleft` or `\moveright`, of course). When we + have set right-to-left direction (using `\textdir TRT`, for example), then + the \"main vertical line" is at the same position but lines run to the left, + i.e.\ typically outside the paper. But when `\pagedir TRT` is set too, + then this main vertical line has `\pagerightoffset+1in` distance from the + {\em right} paper border and thus right-to-left lines are visible on the + paper. We have to set `\pagerightoffset` for such cases properly in the + macro \`\_setpagerightoffset`. + It must be called whenever `\hoffset` is changed. + \_cod ----------------------------- + +\_def\_setpagerightoffset{% + \_pagerightoffset=\_dimexpr\_pdfpagewidth-\_xhsize-\_hoffset-1in\_relax +} +\_setpagerightoffset + \_endcode % ----------------------------------------- +2023-04-27 \_setpagerightoffset for TRT typesetting introduced 2021-03-15 \_setxhsize added 2020-03-14 released diff --git a/optex/base/output.opm b/optex/base/output.opm index 095cfda4..5cd2b5af 100644 --- a/optex/base/output.opm +++ b/optex/base/output.opm @@ -48,7 +48,7 @@ `\hsize` value is eventually changed by the user in this environment. \_cod ----------------------------- -\_newdimen \_xhsize +\_newdimen \_xhsize \_xhsize=\_hsize \_def\_setxhsize {\_global\_xhsize=\_hsize \_global\_let\_setxhsize=\_relax} \_doc -----------------------------