From 2d2acc3b19ac8ab07034966ce627fa8e6db6d93e Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sun, 26 Jun 2022 21:17:42 +0200 Subject: [PATCH] NEW: JKQTMathText: added top-corner (\ulcorner/\urcorner) and bottom-corner brackets (\llcorner/\lrcorner) --- doc/dox/whatsnew.dox | 1 + .../jkqtmathtext_brace_bottomcorner.png | Bin 0 -> 1004 bytes .../jkqtmathtext_brace_topcorner.png | Bin 0 -> 1022 bytes examples/jkqtmathtext_test/testform.cpp | 42 ++++++++++-------- lib/jkqtmathtext/jkqtmathtexttools.cpp | 10 +++++ lib/jkqtmathtext/jkqtmathtexttools.h | 2 + .../nodes/jkqtmathtextbracenode.cpp | 40 ++++++++++++++++- .../nodes/jkqtmathtextsymbolnode.cpp | 18 +++++++- 8 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 doc/images/jkqtmathtext/jkqtmathtext_brace_bottomcorner.png create mode 100644 doc/images/jkqtmathtext/jkqtmathtext_brace_topcorner.png diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index bc4dce3fe4..aed4d70b8c 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -46,6 +46,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW: LaTeX-Parser understands optional instruction parameters in [...] now
  • NEW: LaTeX-Parser simplifies parrse-tree to increase speed of execution
  • NEW: \limits and \nolimits works as in LaTeX now (before it was simply removed and the functionality implemented for a fixed list of symbols)
  • +
  • NEW: added top-corner (\ulcorner/\urcorner) and bottom-corner brackets (\llcorner/\lrcorner)
  • diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_bottomcorner.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_bottomcorner.png new file mode 100644 index 0000000000000000000000000000000000000000..4fa65e8f12b060e96ababc3fe7e1f5bd372226a4 GIT binary patch literal 1004 zcmVPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D01|XXSaefwW^{L9 za%BKVa%E+1b7*gLUR4MM000AHNkl-4PyQBbDoJlI-er$9ZQMNxFlQbO$Br4ocD;l-lYhRSN&CQU0p+&b;oIR1I}= z`9=0_{Qrae$%U12_`j01(yeSiSGUDA#XP^sHO2Fg*GD%pNB77n%-Qs1q&SJ>QNIE@ zNT@I7Ih_+m9q;bUw_P`xNIyhagE|CvYZJLV``iX1){W+|ROj9ixeV$uCT3|~$GeWY zvkErdNR0JqaK2p*>Sb=Pg-5JAm&~_^ZqJ#k*6p?Kl6AX0ayqr&(MGg>|NXKD3?xWh zP5~wOmzePIB9F8OD#3KS=JLT7g4{`6#`ySk*J|B8|KS_yt|)xFHUjIGT~nN_p(^F* zhAQ}^N?rQUxkf?u1xQ_Lgwp-;NcLvu@u!rf3$%<ySB^GRkiV?2JJG*CB@?fp}ZKj!X58mF7s@_Z|R?1($pX_#)D>3^^<_|M-Y-S}W% z?;64Glk0RJ4u{o+?RE>Tw}+4J5-yPpSb(|Q>2v~*tJQkFhE_@UWHKRTFoVGWT5k_` z-8iEx*X(p#3hs70vOr9y(}C7z=*GkCmk9FbaLdr?tqG0Qo$s1d6DraAhT;We$EBNn zsd7Jj?78H@s}++p&!NC$j!3tl!@TkAq2wc0u|K3-)fi{ph#w-G%?8F*gUy0+%#H;xjX)Ej*Xu!6aorO0`5eY26wqY=niPz>m&;|l-G)&LNw)=y?tZ@ygCyOE z*=%Mqo^)F<>F##B$Kw$Osk#x1#o|@Re!qti35Dr&3Ys{^<1z0Vq0ycAePx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D01|XXSaefwW^{L9 za%BKVa%E+1b7*gLUR4MM000AZNkl8nu5PY?M%Ms&fWm|Kpg=|g1?+n9WWbBdpOeIYS)_7;==;DWB=0DGqE2!K7XlH| zjSA^TMbmvco&LEvpU*IZus9x%ph@9yIKZ$@rF*yAjYgw^i}iX9lL(9Pcnq3!X0sX0 zPypTg{od!ALAnF@bTj7jIZP@5-K*6Krnn&80Rp;*!y!y6aO?h}v)OFqG{R;wnSdq% z7!+Kko82ziNkp*SZownzMu2pqLb_2Q-Kbop`~CfWTENuHP9g&KBNIGMr_1FMdJ8}| zfdlDAg><7rx=|tBsC1zF^+|js-7h|%g8_XUtv@#~bt_I8rB=P0ldo|M-5-m4@Tel4 z+O9d-`u=p?Zr2R1)GeFw^a|mb(Pc4N@W0_8>tngv#(h=VhgtIq4?@0`yJOwi9%3&Y z>b^bMUFy!cW_TgpsE}?{NH;2^82-RX|H?v`~ox#e={l%vfU{QC3P*I4H`MRGU#ood^{xG6kja^17x*>_EN5+uZglGlrI)xaZ>{rZ*MS1Bmk7aP(yuHrc>&UepSk%*5r+6m%;e=^o{A3>SBV+ zl{wMhCpV>A$d3P%Q;vCTk{i-3Y{l0BPIbg1^W2PX9vOeI3(}shThYxAcDiduSx-o} zj~0qZ1zbREy6koHh_+mpr#m`f-n#kpa1mkt8dMp%d_q~uSa-c^kxk1a^Lvsf%kG=* z@=aB{>GHnRp{mt`9QWa>+Z>`-x-}jCjaN6N9z9F=CMBxo^g?&Yf_2Qp$_#9SuJEM# sq0zJ2-FHYgDx@0~(v1q~M&xq&4__?DjcXBepa1{>07*qoM6N<$f)1bY#{d8T literal 0 HcmV?d00001 diff --git a/examples/jkqtmathtext_test/testform.cpp b/examples/jkqtmathtext_test/testform.cpp index b3af7a8bb8..baa6e6b043 100644 --- a/examples/jkqtmathtext_test/testform.cpp +++ b/examples/jkqtmathtext_test/testform.cpp @@ -105,30 +105,36 @@ TestForm::TestForm(QWidget *parent) : ui->cmbTestset->addItem("math: stfrac test", "$\\stfrac{a}{b}+\\stfrac{g}{a}-\\stfrac{a^2}{b^2}\\cdot\\stfrac{a^2}{b^{\\stfrac{1}{2}}}$"); ui->cmbTestset->addItem("text: number fractions test", "frac: \\frac{1}{2}, \\frac{3}{4},\\ \\ \\ tfrac: \\tfrac{1}{2}, \\tfrac{3}{4},\\ \\ \\ sfrac: \\sfrac{1}{2}, \\sfrac{3}{4},\\ \\ \\ stfrac: \\stfrac{1}{2}, \\stfrac{3}{4},\\ \\ \\ "); ui->cmbTestset->addItem("math: stackrel test", "$\\stackrel{a}{b}+\\stackrel{g}{a}-\\stackrel{a^2}{b^2}\\cdot\\stackrel{a^2}{b^{\\stackrel{1}{2}}}$"); - ui->cmbTestset->addItem("text/math: brace0 test", "text: \\langle\\langle -- math: $\\langle\\langle$"); - ui->cmbTestset->addItem("text/math: brace1 test", "text: \\langle\\langle r^{123} -- math: $\\langle\\langle r^{123}$"); - ui->cmbTestset->addItem("text/math: brace2 test", "text: \\langle\\langle r^{123}\\rangle\\rangle -- math: $\\langle\\langle r^{123}\\rangle\\rangle$"); - ui->cmbTestset->addItem("text/math: brace3 test", "text: \\left\\langle r^{123}\\right\\rangle -- math: $\\left\\langle r^{123}\\right\\rangle$"); - ui->cmbTestset->addItem("text/math: brace4 test", "text: \\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle -- math: $\\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle$"); + ui->cmbTestset->addItem("text/math: brace test langle", "text: \\langle\\langle -- math: $\\langle\\langle$"); + ui->cmbTestset->addItem("text/math: brace test lange+super 1", "text: \\langle\\langle r^{123} -- math: $\\langle\\langle r^{123}$"); + ui->cmbTestset->addItem("text/math: brace test lange+super 2", "text: \\langle\\langle r^{123}\\rangle\\rangle -- math: $\\langle\\langle r^{123}\\rangle\\rangle$"); + ui->cmbTestset->addItem("text/math: brace test left-langle 1", "text: \\left\\langle r^{123}\\right\\rangle -- math: $\\left\\langle r^{123}\\right\\rangle$"); + ui->cmbTestset->addItem("text/math: brace test left-langle 2", "text: \\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle -- math: $\\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle$"); auto fAddBraceTest=[](const QString& open, const QString& close) { QString res= "\\left"+open+"\\left"+open+"\\left"+open+" r^{123}\\right"+close+"\\right"+close+"\\right"+close; res += "\\left"+open+"\\left"+open+"\\left"+open+" r_{123}\\right"+close+"\\right"+close+"\\right"+close; res += "\\left"+open+"\\left"+open+"\\left"+open+" r_{123}^{123}\\right"+close+"\\right"+close+"\\right"+close; return res; }; - ui->cmbTestset->addItem("text/math: brace5 test: ( )", "text: "+fAddBraceTest("(",")")+" -- math: $"+fAddBraceTest("(",")")+"$"); - ui->cmbTestset->addItem("text/math: brace6 test: [ ]", "text: "+fAddBraceTest("[","]")+" -- math: $"+fAddBraceTest("[","]")+"$"); - ui->cmbTestset->addItem("text/math: brace7 test: { }", "text: "+fAddBraceTest("\\{","\\}")+" -- math: $"+fAddBraceTest("\\{","\\}")+"$"); - ui->cmbTestset->addItem("text/math: brace8 test: || ||", "text: "+fAddBraceTest("\\|","\\|")+" -- math: $"+fAddBraceTest("\\|","\\|")+"$"); - ui->cmbTestset->addItem("text/math: brace9 test: | |", "text: "+fAddBraceTest("|","|")+" -- math: $"+fAddBraceTest("|","|")+"$"); - ui->cmbTestset->addItem("text/math: brace10 test", "text: \\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\} -- math: $\\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\}$"); - ui->cmbTestset->addItem("text/math: brace11 test: floor", "text: \\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor -- math: $\\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor$"); - ui->cmbTestset->addItem("text/math: brace12 test: ceil", "text: \\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil -- math: $\\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil$"); - ui->cmbTestset->addItem("text/math: brace13 test: non-left/right ( )", "text: (((r^{123}))) -- math: $(((r^{123})))$"); - ui->cmbTestset->addItem("text/math: brace14 test: non-left/right [ ]", "text: [[[r^{123}]]] -- math: $[[[r^{123}]]]$"); - ui->cmbTestset->addItem("text/math: brace15 test: non-left/right { }", "text: \\{\\{\\{r^{123}\\}\\}\\} -- math: $\\{\\{\\{ r^{123}\\}\\}\\}$"); - ui->cmbTestset->addItem("text/math: brace16 test: non-left/right | |", "text: |||r^{123}||| -- math: $|||r^{123}|||$"); - ui->cmbTestset->addItem("text/math: brace17 test: non-left/right { | }", "text: \\{r^{123}|r\\equiv 5\\} -- math: $\\{r^{123}|r\\equiv 5\\}$"); + ui->cmbTestset->addItem("text/math: brace test: left/right ( )", "text: "+fAddBraceTest("(",")")+" -- math: $"+fAddBraceTest("(",")")+"$"); + ui->cmbTestset->addItem("text/math: brace test: left/right [ ]", "text: "+fAddBraceTest("[","]")+" -- math: $"+fAddBraceTest("[","]")+"$"); + ui->cmbTestset->addItem("text/math: brace test: left/right { }", "text: "+fAddBraceTest("\\{","\\}")+" -- math: $"+fAddBraceTest("\\{","\\}")+"$"); + ui->cmbTestset->addItem("text/math: brace test: left/right || ||", "text: "+fAddBraceTest("\\|","\\|")+" -- math: $"+fAddBraceTest("\\|","\\|")+"$"); + ui->cmbTestset->addItem("text/math: brace test: left/right | |", "text: "+fAddBraceTest("|","|")+" -- math: $"+fAddBraceTest("|","|")+"$"); + ui->cmbTestset->addItem("text/math: brace test: left/right floor", "text: \\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor -- math: $\\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor$"); + ui->cmbTestset->addItem("text/math: brace test: left/right ceil", "text: \\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil -- math: $\\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil$"); + ui->cmbTestset->addItem("text/math: brace test: left/right top-corner", "text: "+fAddBraceTest("\\ulcorner","\\urcorner")+" -- math: $"+fAddBraceTest("\\ulcorner","\\urcorner")+"$"); + ui->cmbTestset->addItem("text/math: brace test: left/right bottom-corner", "text: "+fAddBraceTest("\\llcorner","\\lrcorner")+" -- math: $"+fAddBraceTest("\\llcorner","\\lrcorner")+"$"); + ui->cmbTestset->addItem("text/math: brace test: left/right mixed", "text: \\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\} -- math: $\\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\}$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right ( )", "text: (((r^{123}))) -- math: $(((r^{123})))$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right [ ]", "text: [[[r^{123}]]] -- math: $[[[r^{123}]]]$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right { }", "text: \\{\\{\\{r^{123}\\}\\}\\} -- math: $\\{\\{\\{ r^{123}\\}\\}\\}$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right | |", "text: |||r^{123}||| -- math: $|||r^{123}|||$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right floor", "text: \\lfloor\\lfloor\\lfloor r^{123}\\rfloor\\rfloor\\rfloor -- math: $\\lfloor\\lfloor\\lfloor r^{123}\\rfloor\\rfloor\\rfloor$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right ceil", "text: \\lceil\\lceil\\lceil r^{123}\\rceil\\rceil\\rceil -- math: $\\lceil\\lceil\\lceil r^{123}\\rceil\\rceil\\rceil$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right top-corner", "text: \\ulcorner\\ulcorner\\ulcorner r^{123}\\urcorner\\urcorner\\urcorner -- math: $\\ulcorner\\ulcorner\\ulcorner r^{123}\\urcorner\\urcorner\\urcorner$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right bottom-corner", "text: \\llcorner\\llcorner\\llcorner r^{123}\\lrcorner\\lrcorner\\lrcorner -- math: $\\llcorner\\llcorner\\llcorner r^{123}\\lrcorner\\lrcorner\\lrcorner$"); + ui->cmbTestset->addItem("text/math: brace test: non-left/right { | }", "text: \\{r^{123}|r\\equiv 5\\} -- math: $\\{r^{123}|r\\equiv 5\\}$"); ui->cmbTestset->addItem("text/math: sub-, superscript test", "text: r^{1234}_{321} r_{321}^{1234} -- math: $r^{1234}_{321} r_{321}^{1234} -- \\kappa^2 -- \\kappa_2 -- \\kappa_2^2$"); ui->cmbTestset->addItem("text/math: super-, subscript test", "text: r^{123}_{4321} r_{4321}^{123} -- math: $r^{123}_{4321} r_{4321}^{123} -- \\kappa^2 -- \\kappa_2 -- \\kappa_2^2$"); //ui->cmbTestset->addItem("", ""); diff --git a/lib/jkqtmathtext/jkqtmathtexttools.cpp b/lib/jkqtmathtext/jkqtmathtexttools.cpp index 0559a886e7..0c02f76a47 100644 --- a/lib/jkqtmathtext/jkqtmathtexttools.cpp +++ b/lib/jkqtmathtext/jkqtmathtexttools.cpp @@ -345,6 +345,10 @@ QString JKQTMathTextBraceType2String(JKQTMathTextBraceType type) { return "parenhesis"; case MTBTSingleLine: return "single_line"; + case MTBTTopCorner: + return "top_corner"; + case MTBTBottomCorner: + return "bottom_corner"; case MTBTAny: return "any"; case MTBTNone: @@ -363,6 +367,8 @@ JKQTMathTextBraceType TokenName2JKQTMathTextBraceType(const QString &tokenName) if (tokenName=="<" || tokenName==">" || tokenName=="langle" || tokenName=="rangle") return MTBTAngleBracket; if (tokenName=="_" || tokenName=="lfloor" || tokenName=="rfloor") return MTBTFloorBracket; if (tokenName=="~" || tokenName=="lceil" || tokenName=="rceil") return MTBTCeilBracket; + if (tokenName=="ulcorner" || tokenName=="urcorner"||tokenName=="tlcorner" || tokenName=="trcorner") return MTBTTopCorner; + if (tokenName=="blcorner" || tokenName=="brcorner"||tokenName=="llcorner" || tokenName=="lrcorner") return MTBTBottomCorner; if (tokenName=="any") return MTBTAny; if (tokenName=="." || tokenName=="" || tokenName=="none") return MTBTNone; return MTBTUnknown; @@ -375,6 +381,8 @@ JKQTMathTextBraceType InstructionName2OpeningJKQTMathTextBraceType(const QString if (tokenName=="langle") return MTBTAngleBracket; if (tokenName=="lfloor") return MTBTFloorBracket; if (tokenName=="lceil") return MTBTCeilBracket; + if (tokenName=="tlcorner"||tokenName=="ulcorner") return MTBTTopCorner; + if (tokenName=="blcorner"||tokenName=="llcorner") return MTBTBottomCorner; return MTBTUnknown; } @@ -385,6 +393,8 @@ JKQTMathTextBraceType InstructionName2JKQTMathTextBraceType(const QString &token if (tokenName=="langle" || tokenName=="rangle") return MTBTAngleBracket; if (tokenName=="lfloor" || tokenName=="rfloor") return MTBTFloorBracket; if (tokenName=="lceil" || tokenName=="rceil") return MTBTCeilBracket; + if (tokenName=="ulcorner" || tokenName=="urcorner"||tokenName=="tlcorner" || tokenName=="trcorner") return MTBTTopCorner; + if (tokenName=="blcorner" || tokenName=="brcorner"||tokenName=="llcorner" || tokenName=="lrcorner") return MTBTBottomCorner; return MTBTUnknown; } diff --git a/lib/jkqtmathtext/jkqtmathtexttools.h b/lib/jkqtmathtext/jkqtmathtexttools.h index eff09ed409..97008adb44 100644 --- a/lib/jkqtmathtext/jkqtmathtexttools.h +++ b/lib/jkqtmathtext/jkqtmathtexttools.h @@ -149,6 +149,8 @@ enum JKQTMathTextBraceType { MTBTFloorBracket, /*!< \brief floor brackets \image html jkqtmathtext/jkqtmathtext_brace_floor.png */ MTBTDoubleLine, /*!< \brief double-line brackets (norm ||...||) \image html jkqtmathtext/jkqtmathtext_brace_dblline.png */ MTBTSingleLine, /*!< \brief single-line brackets (abs |...|) \image html jkqtmathtext/jkqtmathtext_brace_oneline.png */ + MTBTTopCorner, /*!< \brief top-corner brackets \image html jkqtmathtext/jkqtmathtext_brace_topcorner.png */ + MTBTBottomCorner, /*!< \brief bottom-corner brackets \image html jkqtmathtext/jkqtmathtext_brace_bottomcorner.png */ MTBTNone, /*!< \brief no bracket */ MTBTAny, /*!< \brief any bracket, used by JKQTMathText::parseLatexString() */ MTBTUnknown /*!< \brief an unknown tokenName presented to TokenName2JKQTMathTextBraceType() */ diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp index 26198b4e3c..9ac123819c 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp @@ -109,8 +109,8 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa { bool showOpeningBrace=true; const double xbrace1=xnew+lw; - const double xbrace2=qMin(xnew+paren_fraction*bracewidth, xnew+bracewidth-lw/2.0); - const double xbrace2s=qMin(xnew+brace_fraction*bracewidth, xnew+bracewidth-lw/2.0); + const double xbrace2=xnew+qMin(paren_fraction*bracewidth, bracewidth-lw/2.0); + const double xbrace2s=xnew+qMin(brace_fraction*bracewidth, bracewidth-lw/2.0); if (openbrace==MTBTParenthesis) { QPainterPath path; const double y1=y+(nodeOverallHeight-nodeBaselineHeight); @@ -127,6 +127,22 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa path.lineTo(xbrace1, y2); path.lineTo(xbrace2s, y2); painter.drawPath(path); + } else if (openbrace==MTBTTopCorner) { + QPainterPath path; + const double dx=fabs(xbrace2s-xbrace1); + const double y1=y-nodeBaselineHeight; + path.moveTo(xbrace2s, y1); + path.lineTo(xbrace1, y1); + path.lineTo(xbrace1, y1+dx); + painter.drawPath(path); + } else if (openbrace==MTBTBottomCorner) { + QPainterPath path; + const double dx=fabs(xbrace2s-xbrace1); + const double y1=y+(nodeOverallHeight-nodeBaselineHeight); + path.moveTo(xbrace2s, y1); + path.lineTo(xbrace1, y1); + path.lineTo(xbrace1, y1-dx); + painter.drawPath(path); } else if (openbrace==MTBTCurlyBracket) { QPainterPath path=JKQTMathTextMakeHBracePath(0,0,nodeOverallHeight, bracewidth*brace_fraction); painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); @@ -204,6 +220,22 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa path.lineTo(xbrace2, y2); path.lineTo(xbrace1s, y2); painter.drawPath(path); + } else if (closebrace==MTBTBottomCorner) { + QPainterPath path; + const double dx=fabs(xbrace1s-xbrace2); + const double y1=y+(nodeOverallHeight-nodeBaselineHeight); + path.moveTo(xbrace1s, y1); + path.lineTo(xbrace2, y1); + path.lineTo(xbrace2, y1-dx); + painter.drawPath(path); + } else if (closebrace==MTBTTopCorner) { + QPainterPath path; + const double dx=fabs(xbrace1s-xbrace2); + const double y1=y-nodeBaselineHeight; + path.moveTo(xbrace1s, y1); + path.lineTo(xbrace2, y1); + path.lineTo(xbrace2, y1+dx); + painter.drawPath(path); } else if (closebrace==MTBTCurlyBracket) { QPainterPath path=JKQTMathTextMakeHBracePath(0,0,nodeOverallHeight, bracewidth*brace_fraction); painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); @@ -271,6 +303,8 @@ bool JKQTMathTextBraceNode::toHtml(QString &html, JKQTMathTextEnvironment curren else if (openbrace==MTBTCurlyBracket) ob="{"; else if (openbrace==MTBTSingleLine) ob="|"; else if (openbrace==MTBTDoubleLine) ob="||"; + else if (openbrace==MTBTTopCorner) ob="⌜"; + else if (openbrace==MTBTBottomCorner) ob="⌞"; if (closebrace==MTBTAngleBracket) cb="⟩"; else if (closebrace==MTBTFloorBracket) cb="⌋"; else if (closebrace==MTBTCeilBracket) cb="⌉"; @@ -279,6 +313,8 @@ bool JKQTMathTextBraceNode::toHtml(QString &html, JKQTMathTextEnvironment curren else if (closebrace==MTBTCurlyBracket) cb="}"; else if (closebrace==MTBTSingleLine) cb="|"; else if (closebrace==MTBTDoubleLine) cb="||"; + else if (closebrace==MTBTTopCorner) ob="⌝"; + else if (closebrace==MTBTBottomCorner) ob="⌟"; html=html+ob; diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextsymbolnode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextsymbolnode.cpp index e169713ad9..ef5534fb56 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextsymbolnode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextsymbolnode.cpp @@ -513,6 +513,14 @@ bool JKQTMathTextSymbolNode::getUnicodeFullSymbolProp(JKQTMathTextSymbolNode::Sy unicodeSymbol.insert("rceil", QChar(0x2309)); unicodeSymbol.insert("lfloor", QChar(0x230A)); unicodeSymbol.insert("rfloor", QChar(0x230B)); + unicodeSymbol.insert("llcorner", QChar(0x231E)); + unicodeSymbol.insert("lrcorner", QChar(0x231F)); + unicodeSymbol.insert("ulcorner", QChar(0x231C)); + unicodeSymbol.insert("urcorner", QChar(0x231D)); + unicodeSymbol.insert("blcorner", QChar(0x231E)); + unicodeSymbol.insert("brcorner", QChar(0x231F)); + unicodeSymbol.insert("tlcorner", QChar(0x231C)); + unicodeSymbol.insert("trcorner", QChar(0x231D)); unicodeSymbol.insert("subsetnot", QChar(0x2284)); unicodeSymbol.insert("DC", QChar(0x2393)); unicodeSymbol.insert("bot", QChar(0x22A4)); @@ -916,7 +924,7 @@ void JKQTMathTextSymbolNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvi else if (symbolName=="longleftrightarrow") { width=JKQTMathTextGetTightBoundingRect(f, "X", painter.device()).width()*3.5; symb="x"; } else if (symbolName=="Longleftrightarrow") { width=JKQTMathTextGetTightBoundingRect(f, "X", painter.device()).width()*3.5; symb="x"; } } - const QRectF tbr=JKQTMathTextGetTightBoundingRect(f, symb, painter.device()); + const QRectF tbr=(symb.isEmpty())?JKQTMathTextGetTightBoundingRect(f, "X", painter.device()):JKQTMathTextGetTightBoundingRect(f, symb, painter.device()); overallHeight=tbr.height();// fm.height(); baselineHeight=tbr.height()-tbr.bottom(); if (props.exactAscent) { @@ -1208,6 +1216,14 @@ bool JKQTMathTextSymbolNode::toHtml(QString &html, JKQTMathTextEnvironment curre entitylut.insert("exists", "∃"); entitylut.insert("cong", "∼"); entitylut.insert("bot", "⊥"); + entitylut.insert("llcorner", "⌜"); + entitylut.insert("lrcorner", "⌝"); + entitylut.insert("ulcorner", "⌜"); + entitylut.insert("urcorner", "⌝"); + entitylut.insert("blcorner", "⌞"); + entitylut.insert("brcorner", "⌞"); + entitylut.insert("tlcorner", "⌟"); + entitylut.insert("trcorner", "⌟"); entitylut.insert("ll", "<<");