commit 7dcf9611d2867de530a2c77b8fdfabdd9011b19b
Author: Udi-Fogiel <[email protected]>
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@set@pagerightoffset)
(cherry picked from commit 64aad586f49b9047082356e5f217fc6147ac9500)
---
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@family}{cmr}}{
-\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}}{}
-\\g@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath
fill}\\color{lyxfg}}
-\\g@addto@macro\\endpreview{\\endgroup}
-\\makeatother
-""" % (fg_color_gr, bg_color_gr, previewopts))
- else:
- tmp.write(b"""
+\\def\\@tempa{cmr}
+\\ifx\\f@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@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath
fill}\\color{lyxfg}}
+\\g@addto@macro\\preview{\\leavevmode\\begingroup\\color{lyxbg}\\special{background
\\current@color}\\special{ps::clippath fill}\\color{lyxfg}}
\\g@addto@macro\\endpreview{\\endgroup}
+\\let\\pr@set@pagerightoffset\\@empty
+\\ifx\\pagerightoffset\\@undefined\\else
+ \\def\\pr@set@pagerightoffset{\\ifnum\\pagedirection=1
+ \\pagerightoffset=-1in
+ \\advance\\pagerightoffset-\\pr@bb@i
+ \\advance\\pagerightoffset\\pr@bb@iii
+ \\fi
+ }
+\\fi
+\\g@addto@macro\\pr@ship@end{\\pr@set@pagerightoffset}
\\makeatother
""" % previewopts)
if success:
diff --git a/texput.log b/texput.log
new file mode 100644
index 0000000000..e69de29bb2
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs