[LyX/master] Fix math preview of Japanese text for UTF-8 encoding

Koji Yokota <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit e74e17c0ba8cdb09fa8ac6263e858ce4b3a29abf
Author: Koji Yokota <[email protected]>
Date:   Fri Apr 10 17:24:05 2026 +0900

    Fix math preview of Japanese text for UTF-8 encoding
    
    Since dvipng cannot support Japanese text directly, we adopt
       latex + (bxcjkjatype package) -> pdf -> png
    path instead of
       platex -> dvipng.
    
    Fix is limited to UTF-8 encoding.
---
 src/graphics/PreviewLoader.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index 7fa7dfb456..0d185b4350 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -626,7 +626,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
 					? buffer_.params().getOutputFlavor()
 					: Flavor::LaTeX;
 	if (buffer_.params().encoding().package() == Encoding::japanese) {
-		latexparam = " --latex=platex";
+		latexparam = " --latex=pdflatex";
 		flavor = Flavor::LaTeX;
 	}
 	else if (buffer_.params().useNonTeXFonts) {
@@ -850,6 +850,11 @@ void PreviewLoader::Impl::dumpPreamble(otexstream & os, Flavor flavor) const
 	os << "\n"
 	   << "\\usepackage[active,delayed,showlabels,lyx]{preview}\n"
 	   << "\n";
+	if (buffer_.params().encoding().package() == Encoding::japanese) {
+		os << "\n"
+		   << "\\usepackage[whole]{bxcjkjatype}\n"
+		   << "\n";
+	}
 }
 
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.