From 4010ccafbd95fed56892038c2d3e1a8a9eae8832 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 21 Apr 2018 12:55:11 +0200 Subject: [PATCH] Factor out test for script wrapper in given font enc --- src/Encoding.cpp | 14 ++++++++++++++ src/Encoding.h | 3 +++ src/Paragraph.cpp | 8 ++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Encoding.cpp b/src/Encoding.cpp index b9cad8d2e0..9966e710d8 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -599,6 +599,20 @@ bool Encodings::isKnownScriptChar(char_type const c, string & preamble) } +bool Encodings::needsScriptWrapper(string const & script, string const & fontenc) +{ + if (script == "textgreek") + return (fontenc != "LGR"); + if (script == "textcyr") { + return (fontenc != "T2A" && fontenc != "T2B" + && fontenc != "T2C" && fontenc != "X2"); + } + if (script == "textbaltic") + return (fontenc != "L7x"); + return false; +} + + bool Encodings::isMathAlpha(char_type c) { return mathalpha.count(c); diff --git a/src/Encoding.h b/src/Encoding.h index 7400127f2d..ed1ec475b2 100644 --- a/src/Encoding.h +++ b/src/Encoding.h @@ -280,6 +280,9 @@ public: * \p c is a known character matching the preamble entry. */ static bool isKnownScriptChar(char_type const c, std::string & preamble); + /// Do we need to wrap scripts into \text