From 5fbc7feaa179e6b01b0ac553f124029f9b78663f Mon Sep 17 00:00:00 2001 From: Mino1289 Date: Sun, 31 Oct 2021 23:18:32 +0100 Subject: [PATCH] [apps/reader] Ajout de \leq et \neq --- apps/reader/tex_parser.cpp | 21 +++++++++++++++++++++ apps/reader/tex_parser.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/apps/reader/tex_parser.cpp b/apps/reader/tex_parser.cpp index 1815d43d1..ee4f3b3af 100644 --- a/apps/reader/tex_parser.cpp +++ b/apps/reader/tex_parser.cpp @@ -173,6 +173,19 @@ Layout TexParser::popCommand() { return popequivCommand(); } } + else if (strncmp(k_leqCommand, m_text, strlen(k_leqCommand)) == 0) { + m_text += strlen(k_leqCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popleqCommand(); + } + } + else if (strncmp(k_geqCommand, m_text, strlen(k_geqCommand)) == 0) { + m_text += strlen(k_geqCommand); + if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { + return popgeqCommand(); + } + } + else if (strncmp(k_leftarrowCommand, m_text, strlen(k_leftarrowCommand)) == 0) { m_text += strlen(k_leftarrowCommand); if (*m_text == ' ' || *m_text == '\\' || *m_text == '$') { @@ -586,6 +599,14 @@ Layout TexParser::popequivCommand() { return CodePointLayout::Builder(CodePoint(0x2261)); } +Layout TexParser::popleqCommand() { + return CodePointLayout::Builder(CodePoint(0x2264)); +} + +Layout TexParser::popgeqCommand() { + return CodePointLayout::Builder(CodePoint(0x2265)); +} + Layout TexParser::popleftarrowCommand() { return CodePointLayout::Builder(CodePoint(0x2190)); } diff --git a/apps/reader/tex_parser.h b/apps/reader/tex_parser.h index 0e27fe791..be718a848 100644 --- a/apps/reader/tex_parser.h +++ b/apps/reader/tex_parser.h @@ -34,6 +34,8 @@ private: Layout popapproxCommand(); Layout popneqCommand(); Layout popequivCommand(); + Layout popleqCommand(); + Layout popgeqCommand(); // Arrows Layout popleftarrowCommand(); @@ -118,6 +120,9 @@ private: static constexpr char const * k_approxCommand = "approx"; static constexpr char const * k_neqCommand = "neq"; static constexpr char const * k_equivCommand = "equiv"; + static constexpr char const * k_leqCommand = "leq"; + static constexpr char const * k_geqCommand = "geq"; + // Arrows static constexpr char const * k_leftarrowCommand = "leftarrow";