diff --git a/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSans.png b/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSans.png index e70618de7e..e662bcc806 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSans.png and b/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSans.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSerif.png b/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSerif.png index fefd528d6f..f0af95478d 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSerif.png and b/doc/images/jkqtmathtext/jkqtmathtext_DejaVuSerif.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_OldEnglish.png b/doc/images/jkqtmathtext/jkqtmathtext_OldEnglish.png index 5ca973f9f5..89334b3d1e 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_OldEnglish.png and b/doc/images/jkqtmathtext/jkqtmathtext_OldEnglish.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_arial.png b/doc/images/jkqtmathtext/jkqtmathtext_arial.png index 541fbbbb57..fe6ddf5b82 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_arial.png and b/doc/images/jkqtmathtext/jkqtmathtext_arial.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_array.png b/doc/images/jkqtmathtext/jkqtmathtext_array.png index bd5d2af5b4..10db78de9b 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_array.png and b/doc/images/jkqtmathtext/jkqtmathtext_array.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_asana.png b/doc/images/jkqtmathtext/jkqtmathtext_asana.png index e3a8067a13..dcfe66e8e3 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_asana.png and b/doc/images/jkqtmathtext/jkqtmathtext_asana.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_bbmatrix.png b/doc/images/jkqtmathtext/jkqtmathtext_bbmatrix.png index 2c8cbbaee9..2d462c2f7f 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_bbmatrix.png and b/doc/images/jkqtmathtext/jkqtmathtext_bbmatrix.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_bmatrix.png b/doc/images/jkqtmathtext/jkqtmathtext_bmatrix.png index 892c5cba57..641bcdb22f 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_bmatrix.png and b/doc/images/jkqtmathtext/jkqtmathtext_bmatrix.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_bbig.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_bbig.png index 8e13ddcdff..e0e35cecfb 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_bbig.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_bbig.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_bbigg.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_bbigg.png index 612ffe9144..a4a82b5e74 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_bbigg.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_bbigg.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_begincases.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_begincases.png index e6e55d8a30..ead065311d 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_begincases.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_begincases.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_big.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_big.png index 75229651bc..95c7a55ba7 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_big.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_big.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_bigfamily.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_bigfamily.png index 649aaf1bc0..cbefb2dfdc 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_bigfamily.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_bigfamily.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_bigg.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_bigg.png index 04b4dfc5d0..c081ccf5b9 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_bigg.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_bigg.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_ceil.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_ceil.png index 379bcbe733..f705f943e5 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_ceil.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_ceil.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_curly.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_curly.png index 12ee2dee09..db86d45b7c 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_curly.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_curly.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_dblline.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_dblline.png index d460238b38..d5dc1e6ed8 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_dblline.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_dblline.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_dot.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_dot.png index b69ce91ba6..ec308d5995 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_dot.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_dot.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_floor.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_floor.png index 80aea671bf..fc17c9d336 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_floor.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_floor.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_lcorner.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_lcorner.png index da29c3aeb4..f941f38763 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_lcorner.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_lcorner.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_oneline.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_oneline.png index a60fcd0df9..88ea9f6088 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_oneline.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_oneline.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_rect.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_rect.png index 9653c62c5b..91bc59b1c8 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_rect.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_rect.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_round.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_round.png index 99051a8d84..e4476f28a0 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_round.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_round.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_stackrel.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_stackrel.png index 5c9e362171..732e3073bd 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_stackrel.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_stackrel.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_tri.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_tri.png index 3bb3338d42..440e1cae96 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_tri.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_tri.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_brace_ucorner.png b/doc/images/jkqtmathtext/jkqtmathtext_brace_ucorner.png index 3801e23135..62487d2603 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_brace_ucorner.png and b/doc/images/jkqtmathtext/jkqtmathtext_brace_ucorner.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_comicsans.png b/doc/images/jkqtmathtext/jkqtmathtext_comicsans.png index b6f7bda482..f603aa35aa 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_comicsans.png and b/doc/images/jkqtmathtext/jkqtmathtext_comicsans.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_comicsans_textonly.png b/doc/images/jkqtmathtext/jkqtmathtext_comicsans_textonly.png index 67dc0bdd7b..0f4b1f2933 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_comicsans_textonly.png and b/doc/images/jkqtmathtext/jkqtmathtext_comicsans_textonly.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_computermodern.png b/doc/images/jkqtmathtext/jkqtmathtext_computermodern.png index e066caf512..2d3563f065 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_computermodern.png and b/doc/images/jkqtmathtext/jkqtmathtext_computermodern.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_couriernew.png b/doc/images/jkqtmathtext/jkqtmathtext_couriernew.png index 8efebe6f38..c1ceb9b01e 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_couriernew.png and b/doc/images/jkqtmathtext/jkqtmathtext_couriernew.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_fira.png b/doc/images/jkqtmathtext/jkqtmathtext_fira.png index b9880c7568..1bd68866a6 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_fira.png and b/doc/images/jkqtmathtext/jkqtmathtext_fira.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_mathaccents.png b/doc/images/jkqtmathtext/jkqtmathtext_mathaccents.png index 60061851a8..52eeb048d9 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_mathaccents.png and b/doc/images/jkqtmathtext/jkqtmathtext_mathaccents.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_mathmode_and_textmode.png b/doc/images/jkqtmathtext/jkqtmathtext_mathmode_and_textmode.png index 00e5b19bb5..4e72ad51a2 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_mathmode_and_textmode.png and b/doc/images/jkqtmathtext/jkqtmathtext_mathmode_and_textmode.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_mathoperator_width_factor.png b/doc/images/jkqtmathtext/jkqtmathtext_mathoperator_width_factor.png index 2478da921f..bd7d320250 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_mathoperator_width_factor.png and b/doc/images/jkqtmathtext/jkqtmathtext_mathoperator_width_factor.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_matrix.png b/doc/images/jkqtmathtext/jkqtmathtext_matrix.png index 2ca4d01277..a07de8b284 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_matrix.png and b/doc/images/jkqtmathtext/jkqtmathtext_matrix.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_mssegoeui.png b/doc/images/jkqtmathtext/jkqtmathtext_mssegoeui.png index eb8f59e497..f3038d7882 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_mssegoeui.png and b/doc/images/jkqtmathtext/jkqtmathtext_mssegoeui.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_pmatrix.png b/doc/images/jkqtmathtext/jkqtmathtext_pmatrix.png index 06b3d71b29..ad752bd583 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_pmatrix.png and b/doc/images/jkqtmathtext/jkqtmathtext_pmatrix.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_stix.png b/doc/images/jkqtmathtext/jkqtmathtext_stix.png index 665dd13715..9e88e98645 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_stix.png and b/doc/images/jkqtmathtext/jkqtmathtext_stix.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_textaccents.png b/doc/images/jkqtmathtext/jkqtmathtext_textaccents.png index 8dec679b50..a4c85deac7 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_textaccents.png and b/doc/images/jkqtmathtext/jkqtmathtext_textaccents.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_timesnewroman.png b/doc/images/jkqtmathtext/jkqtmathtext_timesnewroman.png index 84ccdd1e16..98ed2f0ae8 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_timesnewroman.png and b/doc/images/jkqtmathtext/jkqtmathtext_timesnewroman.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_vmatrix.png b/doc/images/jkqtmathtext/jkqtmathtext_vmatrix.png index a799b1ee64..28519adc4a 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_vmatrix.png and b/doc/images/jkqtmathtext/jkqtmathtext_vmatrix.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_vvmatrix.png b/doc/images/jkqtmathtext/jkqtmathtext_vvmatrix.png index 3d9cd102e1..cb5d78d27b 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_vvmatrix.png and b/doc/images/jkqtmathtext/jkqtmathtext_vvmatrix.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_xits.png b/doc/images/jkqtmathtext/jkqtmathtext_xits.png index b6b9db1eef..6c3183beed 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_xits.png and b/doc/images/jkqtmathtext/jkqtmathtext_xits.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_xits_all.png b/doc/images/jkqtmathtext/jkqtmathtext_xits_all.png index b6b9db1eef..6c3183beed 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_xits_all.png and b/doc/images/jkqtmathtext/jkqtmathtext_xits_all.png differ diff --git a/doc/images/jkqtmathtext/schreq_mathmode.png b/doc/images/jkqtmathtext/schreq_mathmode.png index 1d8f57b3e9..7f4ca81d53 100644 Binary files a/doc/images/jkqtmathtext/schreq_mathmode.png and b/doc/images/jkqtmathtext/schreq_mathmode.png differ diff --git a/doc/images/jkqtmathtext/schreq_normalmode.png b/doc/images/jkqtmathtext/schreq_normalmode.png index 5775770e43..384b34b0c1 100644 Binary files a/doc/images/jkqtmathtext/schreq_normalmode.png and b/doc/images/jkqtmathtext/schreq_normalmode.png differ diff --git a/examples/jkqtmathtext_test/testform.cpp b/examples/jkqtmathtext_test/testform.cpp index 33fb34e0f0..e32a9f52a6 100644 --- a/examples/jkqtmathtext_test/testform.cpp +++ b/examples/jkqtmathtext_test/testform.cpp @@ -46,6 +46,7 @@ TestForm::TestForm(QWidget *parent) : ui->cmbTestset->addItem("math: umlaute", "$"+umla_math+"$"); ui->cmbTestset->addItem("math: umlaute and \\text{...}", "\\${\\backslash}text\\{...\\}\\$: $\\text{"+umla+"}\\ \\ \\ \\$...\\$: "+umla+"$"); ui->cmbTestset->addItem("math: umlaute and fonts", "base: $"+testTextUmla_math+"$, rm: $\\mathrm{"+testTextUmla_math+"}$, sf: $\\mathsf{"+testTextUmla_math+"}$, tt: $\\mathtt{"+testTextUmla_math+"}$, cal: $\\mathcal{"+testTextUmla_math+"}$, scr: $\\mathscr{"+testTextUmla_math+"}$, bb: $\\mathbb{"+testTextUmla_math+"}$, frak: $\\mathfrak{"+testTextUmla_math+"}$, "); + ui->cmbTestset->addItem("math: sin", "$f(\\omega)=\\sin\\left(\\pi\\cdot\\omega\\right)\\neq\\cos\\bigl(\\pi\\cdot\\omega\\bigr)+2$"); ui->cmbTestset->addItem("math: simple relations", "$a{\\leq}b$, $a{\\geq}b$, $a{\\equiv}b$, $a=b$, $a{\\neq}b$, $ab$"); const auto wsExample=[](const QStringList& spaces, const QString before, const QString& after)->QString { QString s; diff --git a/lib/jkqtmathtext/jkqtmathtext.cpp b/lib/jkqtmathtext/jkqtmathtext.cpp index 74fdacefad..58ebc58af7 100644 --- a/lib/jkqtmathtext/jkqtmathtext.cpp +++ b/lib/jkqtmathtext/jkqtmathtext.cpp @@ -65,7 +65,6 @@ JKQTMathText::JKQTMathText(QObject* parent): fontColor=QColor("black"); italic_correction_factor=0.4; brace_factor=1.04; - brace_shrink_factor=0.45; brace_y_shift_factor=0.7;//-1; subsuper_size_factor=0.65; @@ -205,7 +204,6 @@ void JKQTMathText::loadSettings(const QSettings& settings, const QString& group) fontSizeUnits=JKQTMathTextEnvironment::String2FontSizeUnit(settings.value(group+"font_size_units", JKQTMathTextEnvironment::FontSizeUnit2String(fontSizeUnits)).toString()); fontColor=jkqtp_String2QColor(settings.value(group+"font_color", jkqtp_QColor2String(fontColor)).toString()); brace_factor=settings.value(group+"brace_factor", brace_factor).toDouble(); - brace_shrink_factor=settings.value(group+"brace_shrink_factor", brace_shrink_factor).toDouble(); subsuper_size_factor=settings.value(group+"subsuper_size_factor", subsuper_size_factor).toDouble(); subsuper_mode_selection_by_size_factor=settings.value(group+"subsuper_mode_selection_by_size_factor", subsuper_mode_selection_by_size_factor).toDouble(); italic_correction_factor=settings.value(group+"italic_correction_factor", italic_correction_factor).toDouble(); @@ -254,7 +252,6 @@ void JKQTMathText::saveSettings(QSettings& settings, const QString& group) const settings.setValue(group+"font_size_units", JKQTMathTextEnvironment::FontSizeUnit2String(fontSizeUnits)); settings.setValue(group+"font_color", jkqtp_QColor2String(fontColor)); settings.setValue(group+ "brace_factor", brace_factor); - settings.setValue(group+ "brace_shrink_factor", brace_shrink_factor); settings.setValue(group+ "subsuper_size_factor", subsuper_size_factor); settings.setValue(group+ "subsuper_mode_selection_by_size_factor", subsuper_mode_selection_by_size_factor); settings.setValue(group+ "italic_correction_factor", italic_correction_factor); @@ -834,16 +831,6 @@ double JKQTMathText::getSpecialSubShiftFactor() const return special_sub_shift_factor; } -void JKQTMathText::setBraceShrinkFactor(double __value) -{ - this->brace_shrink_factor = __value; -} - -double JKQTMathText::getBraceShrinkFactor() const -{ - return this->brace_shrink_factor; -} - void JKQTMathText::setUnderbraceFactor(double __value) { this->underbrace_factor = __value; diff --git a/lib/jkqtmathtext/jkqtmathtext.h b/lib/jkqtmathtext/jkqtmathtext.h index fc30822e8b..90989ce132 100644 --- a/lib/jkqtmathtext/jkqtmathtext.h +++ b/lib/jkqtmathtext/jkqtmathtext.h @@ -560,10 +560,6 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject { void setSpecialSubShiftFactor(double __value); /** \copydoc special_sub_shift_factor */ double getSpecialSubShiftFactor() const; - /** \copydoc brace_shrink_factor */ - void setBraceShrinkFactor(double __value); - /** \copydoc brace_shrink_factor */ - double getBraceShrinkFactor() const; /** \copydoc underbrace_factor */ void setUnderbraceFactor(double __value); /** \copydoc underbrace_factor */ @@ -704,10 +700,8 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject { JKQTMathTextBlackboradDrawingMode blackboradFontMode; - /** \brief resizing factor for braces in math mode */ + /** \brief for \c \\left / \c \\right braces: The brace is this factor higher than the child block it surrounds */ double brace_factor; - /** \brief shrinking the width of braces in math mode 0: reduce to 0 pixel width, 1: leave unchanged*/ - double brace_shrink_factor; /** \brief resizing factor for font size in sub-/superscript */ double subsuper_size_factor; /** \brief this factor is used to determine how to typeset sub-/superscript. diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp index e4ac8bc955..d843d52803 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp @@ -54,12 +54,18 @@ void JKQTMathTextBraceNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvir void JKQTMathTextBraceNode::getSizeInternalAndBrace(QPainter &painter, JKQTMathTextEnvironment currentEv, double &width, double &baselineHeight, double &overallHeight, double &strikeoutPos, double &bracewidth, double &braceheight, const JKQTMathTextNodeSize */*prevNodeSize*/) { - - const JKQTMathTextEnvironment ev=currentEv; + width=0; + baselineHeight=0; + overallHeight=0; + strikeoutPos=0; getChild()->getSize(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos); + const QFontMetricsF fm(currentEv.getFont(parentMathText), painter.device()); + const double minChildHeight=fm.tightBoundingRect("l").height(); - const double cAscentAboveStrike=baselineHeight-strikeoutPos; - const double cDescentBelowStrike=overallHeight-baselineHeight+strikeoutPos; + double cAscentAboveStrike=0; + double cDescentBelowStrike=0; + cAscentAboveStrike=qMax(minChildHeight-strikeoutPos, baselineHeight-strikeoutPos); + cDescentBelowStrike=qMax(strikeoutPos, overallHeight-baselineHeight+strikeoutPos); //qDebug()<<"getSizeInternalAndBrace(): showOpeningBrace="<0) painter.drawLine(l); - const QLineF l2(xbrace1+2.5*lw, y1, xbrace1+2.5*lw, y2); + const QLineF l2(xbraceC+lw, y1, xbraceC+lw, y2); if (l2.length()>0) painter.drawLine(l2); painter.setPen(p); } else { @@ -242,8 +245,8 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa { bool showClosingBrace=true; const double xbrace1=qMax(xnew+bracewidth-paren_fraction*bracewidth, xnew+lw/2.0); - const double xbrace1s=qMax(xnew+bracewidth-brace_fraction*bracewidth, xnew+lw/2.0); const double xbrace2=xnew+bracewidth-lw; + const double xbraceC=xnew+bracewidth/2.0; painter.setPen(p); if (closebrace==MTBTParenthesis) { QPainterPath path; @@ -262,7 +265,7 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa path.lineTo(pt2); path.cubicTo(ptc2, pbc2, pb2); path.closeSubpath(); - painter.fillPath(path, QBrush(ev.color, Qt::SolidPattern)); + painter.fillPath(path, QBrush(currentEv.color, Qt::SolidPattern)); /*painter.setPen("blue"); painter.drawLine(pb1,pbc1); painter.drawLine(pt1,ptc1); @@ -274,10 +277,10 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa const double y2=y-nodeBaselineHeight; const double yc=(y1+y2)/2.0; const QPointF pb1(xbrace1-paren_topwidth/2.0, y1); - const QPointF pc1(xbrace2-paren_centerwidth/2.0, yc); + const QPointF pc1(xbrace2-angle_centerwidth/2.0, yc); const QPointF pt1(xbrace1-paren_topwidth/2.0, y2); const QPointF pt2(xbrace1+paren_topwidth/2.0, y2); - const QPointF pc2(xbrace2+paren_centerwidth/2.0, yc); + const QPointF pc2(xbrace2+angle_centerwidth/2.0, yc); const QPointF pb2(xbrace1+paren_topwidth/2.0, y1); path.moveTo(pb1); path.lineTo(pc1); @@ -286,52 +289,45 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa path.lineTo(pc2); path.lineTo(pb2); path.closeSubpath(); - painter.fillPath(path, QBrush(ev.color, Qt::SolidPattern)); + painter.fillPath(path, QBrush(currentEv.color, Qt::SolidPattern)); } else if (closebrace==MTBTSquareBracket) { QPainterPath path; const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0; const double y2=y-nodeBaselineHeight+lw/2.0; - path.moveTo(xbrace1s, y1); + path.moveTo(xbrace1, y1); path.lineTo(xbrace2, y1); path.lineTo(xbrace2, y2); - path.lineTo(xbrace1s, y2); + path.lineTo(xbrace1, y2); painter.drawPath(path); } else if (closebrace==MTBTBottomCorner) { QPainterPath path; - const double dx=fabs(xbrace1s-xbrace2); + const double dx=fabs(xbrace1-xbrace2); const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0; - path.moveTo(xbrace1s, y1); + path.moveTo(xbrace1, 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 dx=fabs(xbrace1-xbrace2); const double y1=y-nodeBaselineHeight+lw/2.0; - path.moveTo(xbrace1s, y1); + path.moveTo(xbrace1, y1); path.lineTo(xbrace2, y1); path.lineTo(xbrace2, y1+dx); painter.drawPath(path); } else if (closebrace==MTBTCurlyBracket) { - const QPainterPath path=JKQTMathTextMakeHBracePath(0,0,nodeOverallHeight, bracewidth*brace_fraction, p.widthF()); + const QPainterPath path=JKQTMathTextMakeHBracePath(0,0,nodeOverallHeight, bracewidth*paren_fraction, p.widthF()); painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); - painter.translate((xbrace1+xbrace2)/2.0, y-nodeBaselineHeight+nodeOverallHeight/2.0); + painter.translate(xbraceC, y-nodeBaselineHeight+nodeOverallHeight/2.0); painter.rotate(270); QPen plocal=p; plocal.setWidthF(0.0001); - painter.fillPath(path, QBrush(ev.color)); - /*QRectF r(0,0,nodeOverallHeight, bracewidth*brace_fraction); - r.moveCenter(QPointF(0,0)); - painter.setPen("blue"); - painter.drawRect(r); - painter.setPen("darkgreen"); - painter.drawPath(path);*/ - + painter.fillPath(path, QBrush(currentEv.color)); } else if (closebrace==MTBTFloorBracket) { QPainterPath path; const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0; const double y2=y-nodeBaselineHeight; - path.moveTo(xbrace1s, y1); + path.moveTo(xbrace1, y1); path.lineTo(xbrace2, y1); path.lineTo(xbrace2, y2); painter.drawPath(path); @@ -341,12 +337,12 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa const double y2=y-nodeBaselineHeight+lw/2.0; path.moveTo(xbrace2, y1); path.lineTo(xbrace2, y2); - path.lineTo(xbrace1s, y2); + path.lineTo(xbrace1, y2); painter.drawPath(path); } else if (closebrace==MTBTSingleLine) { const double y1=y+(nodeOverallHeight-nodeBaselineHeight); const double y2=y-nodeBaselineHeight; - const QLineF l(xbrace2, y1, xbrace2, y2); + const QLineF l(xbraceC, y1, xbraceC, y2); QPen plocal=p; plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor); painter.setPen(plocal); @@ -355,12 +351,12 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa } else if (closebrace==MTBTDoubleLine) { const double y1=y+(nodeOverallHeight-nodeBaselineHeight); const double y2=y-nodeBaselineHeight; - const QLineF l(xbrace2, y1, xbrace2, y2); + const QLineF l(xbraceC-lw, y1, xbraceC-lw, y2); QPen plocal=p; plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor); painter.setPen(plocal); if (l.length()>0) painter.drawLine(l); - const QLineF l2(xbrace2-2.5*lw, y1, xbrace2-2.5*lw, y2); + const QLineF l2(xbraceC+lw, y1, xbraceC+lw, y2); if (l2.length()>0) painter.drawLine(l2); painter.setPen(p); } else { @@ -423,13 +419,19 @@ JKQTMathTextBraceType JKQTMathTextBraceNode::getClosebrace() const { return this->closebrace; } -void JKQTMathTextBraceNode::getBraceSize(QPainter &/*painter*/, JKQTMathTextEnvironment ev, double /*baselineHeight*/, double overallHeight, double &bracewidth, double &braceheight) const +void JKQTMathTextBraceNode::getBraceSize(QPainter &painter, JKQTMathTextEnvironment ev, double /*baselineHeight*/, double overallHeight, double &bracewidth, double &braceheight) const { - const QFontMetricsF fm(ev.getFont(parentMathText)); - const double lw=qMax(0.25,fm.lineWidth()); + const QFontMetricsF fm(ev.getFont(parentMathText), painter.device()); + const double lw=fm.lineWidth(); + const double dblline_distance=2.0*lw; braceheight=overallHeight*parentMathText->getBraceFactor(); - bracewidth=0.6*pow(braceheight, 0.6); - if (openbrace==MTBTCurlyBracket || closebrace==MTBTCurlyBracket) bracewidth=qMax(bracewidth, lw*3.5); + bracewidth=lw*5.0; + if (openbrace==MTBTCurlyBracket || closebrace==MTBTCurlyBracket) bracewidth=lw*6.5; + if (openbrace==MTBTParenthesis || closebrace==MTBTParenthesis) bracewidth=lw*6.0; + if (openbrace==MTBTDoubleLine || closebrace==MTBTDoubleLine) bracewidth=dblline_distance+3.0*lw; + if (openbrace==MTBTSingleLine || closebrace==MTBTSingleLine) bracewidth=3.0*lw; + const double overSizeFactor=braceheight/fm.height(); + if (overSizeFactor>1.2) bracewidth=bracewidth*sqrt(overSizeFactor); } diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextmatrixnode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextmatrixnode.cpp index e2783afad8..76d727fa49 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextmatrixnode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextmatrixnode.cpp @@ -318,8 +318,9 @@ JKQTMathTextMatrixNode::LayoutInfo JKQTMathTextMatrixNode::calcLayout(QPainter & const QFontMetricsF fm(currentEv.getFont(parentMathText), painter.device()); JKQTMathTextEnvironment ev1=currentEv; - const double xheight=fm.strikeOutPos(); + const double strikepos=fm.strikeOutPos(); const double xwidth=fm.boundingRect("x").width(); + const double lw=fm.lineWidth()*1.5; const double XPadding=parentMathText->getMatrixXPaddingFactor()*xwidth; const double YPadding=parentMathText->getMatrixYPaddingFactor()*xwidth; const double XSeparation=parentMathText->getMatrixXSeparationFactor()*xwidth; @@ -329,10 +330,10 @@ JKQTMathTextMatrixNode::LayoutInfo JKQTMathTextMatrixNode::calcLayout(QPainter & l.rowheight.resize(lines); l.rowascent.resize(lines); l.cellwidth.resize(lines); - l.leftPadding=(verticalLineLeft==LTnone)?0:XPadding; - l.rightPadding=(verticalLineRHSColumn.value(columns-1,LTnone)==LTnone)?0:XPadding; - l.topPadding=(horizontalLineTop==LTnone)?0:YPadding; - l.bottomPadding=(horizontalLineBottomRow.value(lines-1,LTnone)==LTnone)?0:YPadding; + l.leftPadding=(verticalLineLeft==LTnone)?lw:XPadding; + l.rightPadding=(verticalLineRHSColumn.value(columns-1,LTnone)==LTnone)?lw:XPadding; + l.topPadding=(horizontalLineTop==LTnone)?lw:YPadding; + l.bottomPadding=(horizontalLineBottomRow.value(lines-1,LTnone)==LTnone)?lw:YPadding; for (int ll=0; ll(columns, 0.0); QVector rowdescent; rowdescent.resize(lines); @@ -355,8 +356,8 @@ JKQTMathTextMatrixNode::LayoutInfo JKQTMathTextMatrixNode::calcLayout(QPainter & l.width=(columns-1)*XSeparation+l.leftPadding+l.rightPadding; for (int i=0; igetMatrixXPaddingFactor()*xwidth; - //const double YPadding=parentMathText->getMatrixYPaddingFactor()*xwidth; const double XSeparation=parentMathText->getMatrixXSeparationFactor()*xwidth; const double YSeparation=parentMathText->getMatrixYSeparationFactor()*xwidth; const double yTop=y-l.baselineHeight+l.topPadding;