[LyX/master] missing background in xetex and fix RTL stuff in preview
Udi-Fogiel
udifoglle at gmail.com
Sun Jun 9 10:54:49 UTC 2024
commit 64aad586f49b9047082356e5f217fc6147ac9500
Author: Udi-Fogiel <udifoglle at gmail.com>
Date: Sun Jun 9 13:36:35 2024 +0300
missing background in xetex and fix RTL stuff in preview
* previwes with xetex did not produce any background (\pagecolor does not work for some reason), adding the direct command for that, \special{background <color>} inside the preview box solved it.
* similar to #12923 we should push the color node in horizontal mode
* there is a bug in preview with LuaTeX with main RTL language, this commit fix this bug, but it should be removed when it is fixed upstream (the code related to \pr at set@pagerightoffset)
---
lib/scripts/legacy_lyxpreview2ppm.py | 28 +++++++++++++++++-----------
texput.log | 0
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/lib/scripts/legacy_lyxpreview2ppm.py b/lib/scripts/legacy_lyxpreview2ppm.py
index 77a621b39a..7803441636 100644
--- a/lib/scripts/legacy_lyxpreview2ppm.py
+++ b/lib/scripts/legacy_lyxpreview2ppm.py
@@ -251,21 +251,27 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
\\definecolor{lyxfg}{rgb}{%s}
\\definecolor{lyxbg}{rgb}{%s}
\\pagecolor{lyxbg}
-\\usepackage[%s,tightpage]{preview}
-\\usepackage{ifthen}
\\makeatletter
-\\ifthenelse{\\equal{\\f at family}{cmr}}{
-\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}}{}
-\\g at addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}}
-\\g at addto@macro\\endpreview{\\endgroup}
-\\makeatother
-""" % (fg_color_gr, bg_color_gr, previewopts))
- else:
- tmp.write(b"""
+\\def\\@tempa{cmr}
+\\ifx\\f at family\\@tempa
+ \\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}
+\\fi
+""" % (fg_color_gr, bg_color_gr))
+ tmp.write(b"""
\\usepackage[%s,tightpage]{preview}
\\makeatletter
-\\g at addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}}
+\\g at addto@macro\\preview{\\leavevmode\\begingroup\\color{lyxbg}\\special{background \\current at color}\\special{ps::clippath fill}\\color{lyxfg}}
\\g at addto@macro\\endpreview{\\endgroup}
+\\let\\pr at set@pagerightoffset\\@empty
+\\ifx\\pagerightoffset\\@undefined\\else
+ \\def\\pr at set@pagerightoffset{\\ifnum\\pagedirection=1
+ \\pagerightoffset=-1in
+ \\advance\\pagerightoffset-\\pr at bb@i
+ \\advance\\pagerightoffset\\pr at bb@iii
+ \\fi
+ }
+\\fi
+\\g at addto@macro\\pr at ship@end{\\pr at set@pagerightoffset}
\\makeatother
""" % previewopts)
if success:
diff --git a/texput.log b/texput.log
new file mode 100644
index 0000000000..e69de29bb2
More information about the lyx-cvs
mailing list