#include "support/textutils.h"
#include "support/unicode.h"
-#include <boost/cstdint.hpp>
-
-#include <iterator>
#include <algorithm>
+#include <cstdint>
+#include <iterator>
#include <sstream>
using namespace std;
}
-const char * EncodingException::what() const throw()
+const char * EncodingException::what() const noexcept
{
return "Could not find LaTeX command for a character";
}
{
// assure the used encoding is properly initialized
init();
-
if (iconvName_ == "UTF-8" && package_ == none)
return true;
+ // platex does not load inputenc: force conversion of supported characters
+ if (package_ == Encoding::japanese
+ && ((0xb7 <= c && c <= 0x05ff) // Latin-1 Supplement ... Hebrew
+ || (0x1d00 <= c && c <= 0x218f) // Phonetic Extensions ... Number Forms
+ || (0x2193 <= c && c <= 0x2aff) // Arrows ... Supplemental Mathematical Operators
+ || (0xfb00 <= c && c <= 0xfb4f) // Alphabetic Presentation Forms
+ || (0x1d400 <= c && c <= 0x1d7ff))) // Mathematical Alphanumeric Symbols
+ return false;
if (c < start_encodable_ && !isForced(c))
return true;
if (encodable_.find(c) != encodable_.end())
docstring uncodable;
bool terminate = false;
for (size_t n = 0; n < input.size(); ++n) {
+ char_type const c = input[n];
try {
- char_type const c = input[n];
pair<docstring, bool> latex_char = latexChar(c);
docstring const latex = latex_char.first;
if (terminate && !prefixIs(latex, '\\')
result += latex;
terminate = latex_char.second;
} catch (EncodingException & /* e */) {
- LYXERR0("Uncodable character in latexString!");
+ LYXERR0("Uncodable character <" << docstring(1, c)
+ << "> in latexString!");
if (dryrun) {
result += "<" + _("LyX Warning: ")
+ _("uncodable character") + " '";
// add all encodable characters
copy(encodable_.begin(), encodable_.end(), back_inserter(symbols));
// now the ones from the unicodesymbols file that are not already there
- for (pair<char_type, CharInfo> const & elem : unicodesymbols) {
+ for (auto const & elem : unicodesymbols) {
if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end())
symbols.push_back(elem.first);
}
if (!encoding || command.empty()) {
command = it->second.textcommand();
needsTermination = !it->second.textnotermination();
- addTextCmd(c);
}
if (mathmode)
addMathSym(c);
+ else
+ addTextCmd(c);
}
return use_math;
}
{
EncodingList::const_iterator const it = encodinglist.find(name);
if (it == encodinglist.end())
- return 0;
+ return nullptr;
if (!allowUnsafe && it->second.unsafe())
- return 0;
+ return nullptr;
return &it->second;
}
if ((it->second.latexName() == name) && (it->second.package() & p)
&& (!it->second.unsafe() || allowUnsafe))
return &it->second;
- return 0;
+ return nullptr;
}
if ((it->second.iconvName() == n) && (it->second.package() & p)
&& (!it->second.unsafe() || allowUnsafe))
return &it->second;
- return 0;
+ return nullptr;
}
istringstream is(symbolslex.getString());
// reading symbol directly does not work if
// char_type == wchar_t.
- boost::uint32_t tmp;
+ uint32_t tmp;
if(!(is >> hex >> tmp))
break;
symbol = tmp;