commit 4fa0fbe5bfd01bf3878db53852f74478c0f2da5d
Author: Enrico Forestieri <[email protected]>
Date:   Thu Aug 10 18:34:17 2023 +0200

    Use utf8 strings for previewed labels when possible
    
    Fixes bug #12842.
---
 src/mathed/InsetMathHull.cpp |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index fc7dbe5..9c64180 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -1659,10 +1659,16 @@ void InsetMathHull::eol(TeXMathStream & os, row_type 
row, bool fragile, bool lat
                         bool last_eoln) const
 {
        if (numberedType()) {
+               bool const for_preview =
+                       (os.output() == TeXMathStream::wsPreview);
                if (label_[row]) {
-                       docstring const name =
-                               latex ? escape(label_[row]->getParam("name"))
-                                     : label_[row]->getParam("name");
+                       // Use utf8 strings for previewed labels when possible
+                       bool use_utf8 = for_preview &&
+                               (buffer().params().useNonTeXFonts ||
+                                buffer().params().encoding().package() == 
Encoding::japanese);
+                       docstring const name = (latex && !use_utf8)
+                               ? escape(label_[row]->getParam("name"))
+                               : label_[row]->getParam("name");
                        os << "\\label{" + name + '}';
                }
                if (type_ != hullMultline) {
@@ -1671,7 +1677,7 @@ void InsetMathHull::eol(TeXMathStream & os, row_type row, 
bool fragile, bool lat
                        else if (numbered_[row]  == NOTAG)
                                os<< "\\notag ";
                }
-               if (os.output() == TeXMathStream::wsPreview && 
!numbers_[row].empty()) {
+               if (for_preview && !numbers_[row].empty()) {
                        os << "\\global\\def\\theequation{" << numbers_[row] << 
"}\n";
                }
 
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to