X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FEncoding.cpp;h=9dde12d1213fc6d06e80ba0d28d27345605e1c39;hb=9926927fb1a38f15ec4fa1334075720925a3295e;hp=0d1d11607720b7ac622c11a3fc490607c4d2c612;hpb=fd7aa2d62d88e4da746f7f91378d19fc9d11e62c;p=lyx.git diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 0d1d116077..9dde12d121 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -25,8 +25,9 @@ #include -#include +#include #include +#include using namespace std; using namespace lyx::support; @@ -259,16 +260,15 @@ vector Encoding::symbolsList() const // assure the used encoding is properly initialized init(); - // first all encodable characters - vector symbols(encodable_.begin(), encodable_.end()); - // add those below start_encodable_ + // first all those below start_encodable_ + vector symbols; for (char_type c = 0; c < start_encodable_; ++c) symbols.push_back(c); + //add all encodable characters + copy(encodable_.begin(), encodable_.end(), back_inserter(symbols)); // now the ones from the unicodesymbols file - CharInfoMap::const_iterator const end = unicodesymbols.end(); - CharInfoMap::const_iterator it = unicodesymbols.begin(); - for (; it != end; ++it) - symbols.push_back(it->first); + for (pair const & elem : unicodesymbols) + symbols.push_back(elem.first); return symbols; } @@ -317,6 +317,8 @@ char_type Encodings::fromLaTeXCommand(docstring const & cmd, int cmdtype, CharInfoMap::const_iterator const end = unicodesymbols.end(); CharInfoMap::const_iterator it = unicodesymbols.begin(); for (combining = false; it != end; ++it) { + if (it->second.deprecated()) + continue; docstring const math = it->second.mathcommand(); docstring const text = it->second.textcommand(); if ((cmdtype & MATH_CMD) && math == cmd) { @@ -402,6 +404,8 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, int cmdtype, size_t unicmd_size = 0; char_type c = 0; for (; it != uniend; ++it) { + if (it->second.deprecated()) + continue; docstring const math = mathmode ? it->second.mathcommand() : docstring(); docstring const text = textmode ? it->second.textcommand() @@ -597,6 +601,16 @@ bool Encodings::isMathAlpha(char_type c) } +bool Encodings::isUnicodeTextOnly(char_type c) +{ + if (isASCII(c) || isMathAlpha(c)) + return false; + + CharInfoMap::const_iterator const it = unicodesymbols.find(c); + return it == unicodesymbols.end() || it->second.mathcommand().empty(); +} + + Encoding const * Encodings::fromLyXName(string const & name, bool allowUnsafe) const { @@ -722,6 +736,8 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile) flags &= ~CharInfoMathNoTermination; } else if (contains(flag, "tipashortcut=")) { tipashortcut = split(flag, '='); + } else if (flag == "deprecated") { + flags |= CharInfoDeprecated; } else { lyxerr << "Ignoring unknown flag `" << flag << "' for symbol `0x"