[apps/reader] Fix rendering bug

This commit is contained in:
Mino1289
2021-11-07 20:52:21 +01:00
parent 7dec23dd91
commit 9d5904396d

View File

@@ -4,7 +4,7 @@
namespace Reader {
// List of available Symbols
static char const * k_SymbolsCommands[] = {
static constexpr char const * k_SymbolsCommands[] = {
"times", "div", "forall", "partial", "exists", "pm", "approx", "infty", "neq", "equiv", "leq", "geq",
"leftarrow", "uparrow", "rightarrow", "downarrow", "leftrightarrow", "updownarrow", "Leftarrow", "Uparrow", "Rightarrow", "Downarrow",
"Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda",
@@ -14,7 +14,7 @@ namespace Reader {
};
//List of the available Symbol's CodePoints in the same order of the Symbol's list
static uint32_t const k_SymbolsCodePoints[] = {
static constexpr uint32_t const k_SymbolsCodePoints[] = {
0xd7, 0xf7, 0x2200, 0x2202, 0x2203, 0xb1, 0x2248, 0x221e, 0x2260, 0x2261, 0x2264, 0x2265,
0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x2195, 0x21d0, 0x21d1, 0x21d2, 0x21d3,
0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39a, 0x39b,
@@ -24,7 +24,7 @@ namespace Reader {
};
// List of available Function Commands that don't require a specific handling
static char const * k_FunctionCommands[] = {
static constexpr char const * k_FunctionCommands[] = {
"arcos", "arcsin", "arctan", "arg", "cos", "cosh", "cot", "coth",
"csc", "deg", "det", "dim", "exp", "gcd", "hom", "inf",
"ker", "lg", "lim", "liminf", "limsup", "ln", "log", "max",
@@ -144,8 +144,8 @@ Layout TexParser::popCommand() {
for (int i = 0; i < k_NumberOfSymbols; i++) {
if (strncmp(k_SymbolsCommands[i], m_text, strlen(k_SymbolsCommands[i])) == 0) {
m_text += strlen(m_text);
if (*m_text == ' ' || *m_text == '{') {
m_text += strlen(k_SymbolsCommands[i]);
if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') {
return popSymbolCommand(i);
}
}