X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FParagraph.cpp;h=7b0b3552ddda4fb7eebf201f25917a3026def7ce;hb=8f6491f073af4a4f29faac91e21900ce81d74300;hp=6d50f278c45bd577aef0f499863f5f6b2e8dfbe1;hpb=68109443f3738b89574cfc82bc30b14e0c31a8be;p=lyx.git diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 6d50f278c4..7b0b3552dd 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -363,6 +363,12 @@ public: pos_type i, unsigned int & column); /// + bool latexSpecialTU( + char_type const c, + otexstream & os, + pos_type i, + unsigned int & column); + /// bool latexSpecialT3( char_type const c, otexstream & os, @@ -562,10 +568,10 @@ Paragraph::Private::Private(Private const & p, Paragraph * owner, } -void Paragraph::addChangesToToc(DocIterator const & cdit, - Buffer const & buf, bool output_active) const +void Paragraph::addChangesToToc(DocIterator const & cdit, Buffer const & buf, + bool output_active, TocBackend & backend) const { - d->changes_.addToToc(cdit, buf, output_active); + d->changes_.addToToc(cdit, buf, output_active, backend); } @@ -1188,8 +1194,13 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, // non-standard font encoding. If we are using such a language, // we do not output special T1 chars. if (!runparams.inIPA && !running_font.language()->internalFontEncoding() - && bparams.font_encoding() == "T1" && latexSpecialT1(c, os, i, column)) + && !runparams.isFullUnicode() && bparams.main_font_encoding() == "T1" + && latexSpecialT1(c, os, i, column)) return; + // NOTE: XeTeX and LuaTeX use EU1/2 (pre 2017) or TU (as of 2017) encoding + else if (!runparams.inIPA && !running_font.language()->internalFontEncoding() + && runparams.isFullUnicode() && latexSpecialTU(c, os, i, column)) + return; // Otherwise, we use what LaTeX provides us. switch (c) { @@ -1223,7 +1234,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, } break; case '\"': - os << "\\char`\\\"" << termcmd; + os << "\\char34" << termcmd; column += 9; break; @@ -1263,6 +1274,21 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, // written. (Asger) break; + case 0x2013: + case 0x2014: + if (bparams.use_dash_ligatures && !bparams.useNonTeXFonts) { + if (c == 0x2013) { + // en-dash + os << "--"; + column +=2; + } else { + // em-dash + os << "---"; + column +=3; + } + break; + } + // fall through default: if (c == '\0') return; @@ -1356,6 +1382,14 @@ bool Paragraph::Private::latexSpecialT1(char_type const c, otexstream & os, } +bool Paragraph::Private::latexSpecialTU(char_type const c, otexstream & os, + pos_type i, unsigned int & column) +{ + // TU encoding is currently on par with T1. + return latexSpecialT1(c, os, i, column); +} + + bool Paragraph::Private::latexSpecialT3(char_type const c, otexstream & os, pos_type /*i*/, unsigned int & column) { @@ -1389,6 +1423,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const // output is wrong if this paragraph contains content // that needs to switch encoding. otexstringstream os; + os << layout_->preamble(); if (is_command) { os << '\\' << from_ascii(layout_->latexname()); // we have to provide all the optional arguments here, even though @@ -1948,7 +1983,7 @@ depth_type Paragraph::getMaxDepthAfter() const } -char Paragraph::getAlign() const +LyXAlignment Paragraph::getAlign() const { if (d->params_.align() == LYX_ALIGN_LAYOUT) return d->layout_->align;