[apps/reader] TexParser fixed

This commit is contained in:
Mino1289
2021-10-26 17:19:23 +02:00
parent 36c984c73b
commit 0dafa539df

View File

@@ -115,13 +115,13 @@ Layout TexParser::popCommand() {
}
else if (strncmp(k_thetaCommand, m_text, strlen(k_thetaCommand)) == 0) {
m_text += strlen(k_thetaCommand);
if (*m_text == ' ') {
if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') {
return popthetaCommand();
}
}
else if (strncmp(k_piCommand, m_text, strlen(k_piCommand)) == 0) {
m_text += strlen(k_piCommand);
if (*m_text == ' ') {
if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') {
return poppiCommand();
}
}
@@ -131,16 +131,21 @@ Layout TexParser::popCommand() {
}
Layout TexParser::popFracCommand() {
return FractionLayout::Builder(popBlock(), popBlock());
Layout numerator = popBlock();
Layout denominator = popBlock();
FractionLayout l = FractionLayout::Builder(numerator, denominator);
return l;
}
Layout TexParser::popSqrtCommand() {
while (*m_text == ' ') {
m_text ++;
}
m_text++;
if (*m_text == '[') {
return NthRootLayout::Builder(popText(']'), popBlock());
m_text ++;
Layout rootFactor = popText(']');
Layout belowRoot = popBlock();
return NthRootLayout::Builder(belowRoot, rootFactor);
}
else {
return NthRootLayout::Builder(popBlock());
@@ -155,4 +160,4 @@ Layout TexParser::poppiCommand() {
return CodePointLayout::Builder(CodePoint(0x3c0));
}
}
}