From dde506924cefa889f844385ff799e3125155e0fe Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sat, 13 Oct 2007 14:07:04 +0000 Subject: [PATCH] Clarify comments. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20946 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Paragraph.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 71684202ed..299af8263c 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -641,15 +641,19 @@ int Paragraph::Pimpl::knownLangChars(odocstream & os, Encoding const & encoding, pos_type & i) { - // The latex command is "\textLANG{}" and we have to retain - // "\textLANG{" for the first char but only "" for all - // subsequent chars (this also works when we are passed untranslated - // unicode). + // When the character is marked by the proper language, we simply + // get its code point in some encoding, otherwise we get the + // translation specified in the unicodesymbols file, which is + // something like "\textLANG{}". So, we have to retain + // "\textLANG{" for the first char but only "" for + // all subsequent chars. docstring const latex1 = rtrim(encoding.latexChar(c), "}"); int length = latex1.length(); os << latex1; while (i < size() - 1) { char_type next = getChar(i + 1); + // Stop here if next character belongs to another + // language or there is a change tracking status. if (!Encodings::isKnownLangChar(next, preamble) || runningChange != lookupChange(i + 1)) break; @@ -665,6 +669,7 @@ int Paragraph::Pimpl::knownLangChars(odocstream & os, if (cit->pos() >= i + 1) break; } + // Stop here if there is a font attribute change. if (found && cit != end && prev_font != cit->font()) break; docstring const latex = rtrim(encoding.latexChar(next), "}"); @@ -679,8 +684,8 @@ int Paragraph::Pimpl::knownLangChars(odocstream & os, } ++i; } - // When the proper language is set, we are passed the straight unicode, - // so we should not try to close the \textLANG command. + // When the proper language is set, we are simply passed a code + // point, so we should not try to close the \textLANG command. if (prefixIs(latex1, from_ascii("\\" + preamble))) { os << '}'; ++length; -- 2.39.5