Align \textgreek and \textcyr with font encoding, part II

Also embrace encodable chars to those macros if we don't have a font
encoding that can handle the glyphs.

Fixes the remaining part of #9637
This commit is contained in:
Juergen Spitzmueller 2018-04-20 20:00:01 +02:00
parent d77c0707e0
commit 4e5e1de086
2 changed files with 14 additions and 7 deletions

View File

@ -1781,6 +1781,9 @@ Buffer::ExportStatus Buffer::writeLaTeXSource(otexstream & os,
// (or not reached) and characters encodable in the current // (or not reached) and characters encodable in the current
// encoding are not converted to ASCII-representation. // encoding are not converted to ASCII-representation.
// Some macros rely on font encoding
runparams.main_fontenc = params().main_font_encoding();
// If we are compiling a file standalone, even if this is the // If we are compiling a file standalone, even if this is the
// child of some other buffer, let's cut the link here, so the // child of some other buffer, let's cut the link here, so the
// file is really independent and no concurring settings from // file is really independent and no concurring settings from

View File

@ -1372,16 +1372,20 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
} }
} }
string fontenc; string fontenc;
if (running_font.language()->lang() == runparams.document_language) if (running_font.language()->lang() == bparams.language->lang())
fontenc = runparams.main_fontenc; fontenc = runparams.main_fontenc;
else else
fontenc = running_font.language()->fontenc(); fontenc = running_font.language()->fontenc();
if (Encodings::isKnownScriptChar(c, script) // "Script chars" need to embraced in \textcyr and \textgreek notwithstanding
&& prefixIs(latex.first, from_ascii("\\" + script))) // whether they are encodable or not (it only depends on the font encoding)
column += writeScriptChars(runparams, os, latex.first, if (!runparams.isFullUnicode() && Encodings::isKnownScriptChar(c, script)) {
running_change, encoding, docstring const wrapper = from_ascii("\\" + script + "{");
fontenc, i) - 1; docstring ltx = latex.first;
else if (latex.second if (!prefixIs(ltx, wrapper))
ltx = wrapper + latex.first + from_ascii("}");
column += writeScriptChars(runparams, os, ltx, running_change,
encoding, fontenc, i) - 1;
} else if (latex.second
&& ((!prefixIs(nextlatex, '\\') && ((!prefixIs(nextlatex, '\\')
&& !prefixIs(nextlatex, '{') && !prefixIs(nextlatex, '{')
&& !prefixIs(nextlatex, '}')) && !prefixIs(nextlatex, '}'))