From b38ccc5fbcf880c56a39c1f522a947eb31a9522c Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Mon, 1 Aug 2022 15:17:34 +0200 Subject: [PATCH] JKQTMathText: added \dashbox() and \dotbox{} --- doc/dox/whatsnew.dox | 2 ++ .../jkqtmathtext/jkqtmathtext_dashbox.png | Bin 0 -> 1423 bytes .../jkqtmathtext/jkqtmathtext_dottedbox.png | Bin 0 -> 1384 bytes examples/jkqtmathtext_test/testform.cpp | 2 +- lib/jkqtmathtext/jkqtmathtext.h | 2 ++ .../nodes/jkqtmathtextinstructionnode.cpp | 27 ++++++++++++++++++ 6 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 doc/images/jkqtmathtext/jkqtmathtext_dashbox.png create mode 100644 doc/images/jkqtmathtext/jkqtmathtext_dottedbox.png diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index 68b19c3566..75ce7912c5 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -64,6 +64,8 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW: added top-corner (\c \\ulcorner/\c \\urcorner ) and bottom-corner brackets (\c \\llcorner/\c \\lrcorner )
  • NEW: added \c \\overbracket and \c \\underbracket
  • NEW: added \c \\shaded{color}{...}
  • +
  • NEW: added \c \\dashbox{...}
  • +
  • NEW: added \c \\dottedbox{...}
  • NEW: added \c \\acute{X}, \c \\grave{X}, \c \\acute{X}
  • NEW: added functions to set the font-size in pixels (as alternative to the existing functions that set them in points), implements request #76 from user:igormironchik
  • NEW: added \c \\userfont{SystemFontName}{Text} instruction
  • diff --git a/doc/images/jkqtmathtext/jkqtmathtext_dashbox.png b/doc/images/jkqtmathtext/jkqtmathtext_dashbox.png new file mode 100644 index 0000000000000000000000000000000000000000..cba434387e561c8f56698b7733454223cf3f39a4 GIT binary patch literal 1423 zcmV;A1#tR_P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D01|X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cdot y\\ \\ x\\geq 4\\ \\ x~4$"); ui->cmbTestset->addItem("text: color test", "\\textcolor{red}{RED}\\textcolor{blue}{BLUE}"); - ui->cmbTestset->addItem("text: boxed test", "test: {\\backslash}boxed: \\boxed{boxed text} {\\backslash}doublebox: \\doublebox{boxed text} {\\backslash}ovalbox: \\ovalbox{boxed text} {\\backslash}Ovalbox: \\Ovalbox{boxed text} {\\backslash}ovaldoublebox: \\ovaldoublebox{boxed text} {\\backslash}colorbox\\{red\\}: \\colorbox{red}{boxed text} {\\backslash}shaded\\{AliceBlue\\}: \\shaded{AliceBlue}{boxed text} {\\backslash}fcolorbox\\{red\\}\\{AliceBlue\\}: \\fcolorbox{red}{AliceBlue}{boxed text} in the middle"); + ui->cmbTestset->addItem("text: boxed test", "test: {\\backslash}boxed: \\boxed{boxed text} {\\backslash}doublebox: \\doublebox{boxed text} {\\backslash}ovalbox: \\ovalbox{boxed text} {\\backslash}Ovalbox: \\Ovalbox{boxed text} {\\backslash}ovaldoublebox: \\ovaldoublebox{boxed text} {\\backslash}dashbox\\{...\\}: \\dashbox{boxed text} {\\backslash}dottedbox\\{...\\}: \\dottedbox{boxed text} {\\backslash}colorbox\\{red\\}: \\colorbox{red}{boxed text} {\\backslash}shaded\\{AliceBlue\\}: \\shaded{AliceBlue}{boxed text} {\\backslash}fcolorbox\\{red\\}\\{AliceBlue\\}: \\fcolorbox{red}{AliceBlue}{boxed text} in the middle"); ui->cmbTestset->addItem("mathboxed test", "$\\fbox{2^{2^{\\colorbox{red}{2^{x}}}}}$"); ui->cmbTestset->addItem("axiom of power test", "$\\forall A \\, \\exists P \\, \\forall B \\, [B \\in P \\iff \\forall C \\, (C \\in B \\Rightarrow C \\in A)]$"); ui->cmbTestset->addItem("math: De Morgan's law", "$\\neg(P\\land Q)\\iff(\\neg P)\\lor(\\neg Q)$ or $\\overline{\\bigcap_{i \\in I} A_{i}}\\equiv\\bigcup_{i \\in I} \\overline{A_{i}}$ or $\\overline{A \\cup B}\\equiv\\overline{A} \\cap \\overline{B}$"); diff --git a/lib/jkqtmathtext/jkqtmathtext.h b/lib/jkqtmathtext/jkqtmathtext.h index 30efdf5052..1e409dc73e 100644 --- a/lib/jkqtmathtext/jkqtmathtext.h +++ b/lib/jkqtmathtext/jkqtmathtext.h @@ -127,6 +127,8 @@ class JKQTMathTextNode; // forward - \c \\doublebox{...} : draw text with a rounded box around it \image html jkqtmathtext/jkqtmathtext_doublebox.png - \c \\ovalbox{...} : draw text with a rounded box around it \image html jkqtmathtext/jkqtmathtext_ovalboxed.png - \c \\Ovalbox{...} : draw a thick oval box \image html jkqtmathtext/jkqtmathtext_oovalbox.png + - \c \\dashbox{...} , \c \\dbox{...} : draw a dashed box \image html jkqtmathtext/jkqtmathtext_dashbox.png + - \c \\dottedbox{...} : draw a dottted box \image html jkqtmathtext/jkqtmathtext_dottedbox.png - \c \\ovaldoublebox{...} : draw a double oval box \image html jkqtmathtext/jkqtmathtext_doubleovalbox.png - \c \\colorbox{bordercolor}{...} : draw a colored box \image html jkqtmathtext/jkqtmathtext_colorbox.png - \c \\shaded{backgroundcolor}{...} : draw a filled box \image html jkqtmathtext/jkqtmathtext_shaded.png diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextinstructionnode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextinstructionnode.cpp index 62fe27060a..51bf8dd183 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextinstructionnode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextinstructionnode.cpp @@ -788,6 +788,33 @@ void JKQTMathTextBoxInstructionNode::fillInstructions() /*Nparams=*/1); instructions["colorbox"] = i; } + { + InstructionProperties i(InstructionProperties::NoModification, + [](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){ + QPen p=InstructionProperties::DefaultPen(ev, parameters, parent); + p.setStyle(Qt::DashLine); + return p; + }, + InstructionProperties::NoBrush, + InstructionProperties::DefaultPadding, + /*Nparams=*/0); + instructions["dashbox"] = i; + instructions["dashedbox"] = i; + instructions["dbox"] = i; + } + { + InstructionProperties i(InstructionProperties::NoModification, + [](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){ + QPen p=InstructionProperties::DefaultPen(ev, parameters, parent); + p.setStyle(Qt::DotLine); + return p; + }, + InstructionProperties::NoBrush, + InstructionProperties::DefaultPadding, + /*Nparams=*/0); + instructions["dottedbox"] = i; + instructions["dotbox"] = i; + } { InstructionProperties i(InstructionProperties::NoModification, InstructionProperties::NoPen,