#include "LyXRC.h"
#include "support/debug.h"
+#include "support/gettext.h"
#include "support/FileName.h"
#include "support/lstrings.h"
#include "support/textutils.h"
}
+pair<docstring, docstring> Encoding::latexString(docstring const input, bool dryrun) const
+{
+ docstring result;
+ docstring uncodable;
+ bool terminate = false;
+ for (size_t n = 0; n < input.size(); ++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, '\\')
+ && !prefixIs(latex, '{')
+ && !prefixIs(latex, '}')) {
+ // Prevent eating of a following
+ // space or command corruption by
+ // following characters
+ if (latex == " ")
+ result += "{}";
+ else
+ result += " ";
+ }
+ result += latex;
+ terminate = latex_char.second;
+ } catch (EncodingException & /* e */) {
+ LYXERR0("Uncodable character in latexString!");
+ if (dryrun) {
+ result += "<" + _("LyX Warning: ")
+ + _("uncodable character") + " '";
+ result += docstring(1, input[n]);
+ result += "'>";
+ } else
+ uncodable += input[n];
+ }
+ }
+ return make_pair(result, uncodable);
+}
+
+
vector<char_type> Encoding::symbolsList() const
{
// assure the used encoding is properly initialized
bool const use_text = (for_mathed && isTextCmd(c)) ||
(!for_mathed && !it->second.textcommand.empty());
bool const plain_utf8 = (features.runparams().encoding->name() == "utf8-plain");
+ bool const unicode_math = (features.isRequired("unicode-math")
+ && features.isAvailable("unicode-math"));
// with utf8-plain, we only load packages when in mathed (see #7766)
- if (math_mode || (use_math && !plain_utf8)) {
+ // and if we do not use unicode-math
+ if ((math_mode && !unicode_math)
+ || (use_math && !plain_utf8)) {
if (!it->second.mathpreamble.empty()) {
if (it->second.mathfeature()) {
string feats = it->second.mathpreamble;
Encodings::Encodings()
-{
-}
+{}
void Encodings::read(FileName const & encfile, FileName const & symbolsfile)