From: Enrico Forestieri Date: Thu, 10 Aug 2023 16:34:17 +0000 (+0200) Subject: Use utf8 strings for previewed labels when possible X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4fa0fbe5bfd01bf3878db53852f74478c0f2da5d;p=features.git Use utf8 strings for previewed labels when possible Fixes bug #12842. --- diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index fc7dbe561d..9c641807f8 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"; }