JKQTMathText: ensure mini size of \left/\right braces, when contained text is very small, e.g. only lower-case
JKQTMathText: improve width-calculation of \left/\right braces
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 904 B After Width: | Height: | Size: 907 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 880 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 923 B After Width: | Height: | Size: 898 B |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
@ -46,6 +46,7 @@ TestForm::TestForm(QWidget *parent) :
|
|||||||
ui->cmbTestset->addItem("math: umlaute", "$"+umla_math+"$");
|
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 \\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: 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$, $a<b$, $a>b$");
|
ui->cmbTestset->addItem("math: simple relations", "$a{\\leq}b$, $a{\\geq}b$, $a{\\equiv}b$, $a=b$, $a{\\neq}b$, $a<b$, $a>b$");
|
||||||
const auto wsExample=[](const QStringList& spaces, const QString before, const QString& after)->QString {
|
const auto wsExample=[](const QStringList& spaces, const QString before, const QString& after)->QString {
|
||||||
QString s;
|
QString s;
|
||||||
|
@ -65,7 +65,6 @@ JKQTMathText::JKQTMathText(QObject* parent):
|
|||||||
fontColor=QColor("black");
|
fontColor=QColor("black");
|
||||||
italic_correction_factor=0.4;
|
italic_correction_factor=0.4;
|
||||||
brace_factor=1.04;
|
brace_factor=1.04;
|
||||||
brace_shrink_factor=0.45;
|
|
||||||
brace_y_shift_factor=0.7;//-1;
|
brace_y_shift_factor=0.7;//-1;
|
||||||
|
|
||||||
subsuper_size_factor=0.65;
|
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());
|
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());
|
fontColor=jkqtp_String2QColor(settings.value(group+"font_color", jkqtp_QColor2String(fontColor)).toString());
|
||||||
brace_factor=settings.value(group+"brace_factor", brace_factor).toDouble();
|
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_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();
|
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();
|
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_size_units", JKQTMathTextEnvironment::FontSizeUnit2String(fontSizeUnits));
|
||||||
settings.setValue(group+"font_color", jkqtp_QColor2String(fontColor));
|
settings.setValue(group+"font_color", jkqtp_QColor2String(fontColor));
|
||||||
settings.setValue(group+ "brace_factor", brace_factor);
|
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_size_factor", subsuper_size_factor);
|
||||||
settings.setValue(group+ "subsuper_mode_selection_by_size_factor", subsuper_mode_selection_by_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);
|
settings.setValue(group+ "italic_correction_factor", italic_correction_factor);
|
||||||
@ -834,16 +831,6 @@ double JKQTMathText::getSpecialSubShiftFactor() const
|
|||||||
return special_sub_shift_factor;
|
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)
|
void JKQTMathText::setUnderbraceFactor(double __value)
|
||||||
{
|
{
|
||||||
this->underbrace_factor = __value;
|
this->underbrace_factor = __value;
|
||||||
|
@ -560,10 +560,6 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
|||||||
void setSpecialSubShiftFactor(double __value);
|
void setSpecialSubShiftFactor(double __value);
|
||||||
/** \copydoc special_sub_shift_factor */
|
/** \copydoc special_sub_shift_factor */
|
||||||
double getSpecialSubShiftFactor() const;
|
double getSpecialSubShiftFactor() const;
|
||||||
/** \copydoc brace_shrink_factor */
|
|
||||||
void setBraceShrinkFactor(double __value);
|
|
||||||
/** \copydoc brace_shrink_factor */
|
|
||||||
double getBraceShrinkFactor() const;
|
|
||||||
/** \copydoc underbrace_factor */
|
/** \copydoc underbrace_factor */
|
||||||
void setUnderbraceFactor(double __value);
|
void setUnderbraceFactor(double __value);
|
||||||
/** \copydoc underbrace_factor */
|
/** \copydoc underbrace_factor */
|
||||||
@ -704,10 +700,8 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
|||||||
JKQTMathTextBlackboradDrawingMode blackboradFontMode;
|
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;
|
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 */
|
/** \brief resizing factor for font size in sub-/superscript */
|
||||||
double subsuper_size_factor;
|
double subsuper_size_factor;
|
||||||
/** \brief this factor is used to determine how to typeset sub-/superscript.
|
/** \brief this factor is used to determine how to typeset sub-/superscript.
|
||||||
|
@ -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*/)
|
void JKQTMathTextBraceNode::getSizeInternalAndBrace(QPainter &painter, JKQTMathTextEnvironment currentEv, double &width, double &baselineHeight, double &overallHeight, double &strikeoutPos, double &bracewidth, double &braceheight, const JKQTMathTextNodeSize */*prevNodeSize*/)
|
||||||
{
|
{
|
||||||
|
width=0;
|
||||||
const JKQTMathTextEnvironment ev=currentEv;
|
baselineHeight=0;
|
||||||
|
overallHeight=0;
|
||||||
|
strikeoutPos=0;
|
||||||
getChild()->getSize(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos);
|
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;
|
double cAscentAboveStrike=0;
|
||||||
const double cDescentBelowStrike=overallHeight-baselineHeight+strikeoutPos;
|
double cDescentBelowStrike=0;
|
||||||
|
cAscentAboveStrike=qMax(minChildHeight-strikeoutPos, baselineHeight-strikeoutPos);
|
||||||
|
cDescentBelowStrike=qMax(strikeoutPos, overallHeight-baselineHeight+strikeoutPos);
|
||||||
|
|
||||||
//qDebug()<<"getSizeInternalAndBrace(): showOpeningBrace="<<showOpeningBrace<<", openbrace="<<openbrace<<", showClosingBrace="<<showClosingBrace<<", closebrace="<<closebrace;
|
//qDebug()<<"getSizeInternalAndBrace(): showOpeningBrace="<<showOpeningBrace<<", openbrace="<<openbrace<<", showClosingBrace="<<showClosingBrace<<", closebrace="<<closebrace;
|
||||||
//qDebug()<<"getSizeInternalAndBrace(): child: baselineHeight="<<baselineHeight<<", strikeoutPos="<<strikeoutPos<<", overallHeight="<<overallHeight;
|
//qDebug()<<"getSizeInternalAndBrace(): child: baselineHeight="<<baselineHeight<<", strikeoutPos="<<strikeoutPos<<", overallHeight="<<overallHeight;
|
||||||
@ -75,9 +81,7 @@ void JKQTMathTextBraceNode::getSizeInternalAndBrace(QPainter &painter, JKQTMathT
|
|||||||
|
|
||||||
bracewidth=0;
|
bracewidth=0;
|
||||||
braceheight=0;
|
braceheight=0;
|
||||||
getBraceSize(painter, ev, baselineHeight, overallHeight, bracewidth, braceheight);
|
getBraceSize(painter, currentEv, baselineHeight, overallHeight, bracewidth, braceheight);
|
||||||
|
|
||||||
bracewidth=bracewidth/parentMathText->getBraceShrinkFactor();
|
|
||||||
|
|
||||||
if (openbrace!=MTBTNone && openbrace!=MTBTAny) width+=bracewidth;
|
if (openbrace!=MTBTNone && openbrace!=MTBTAny) width+=bracewidth;
|
||||||
if (closebrace!=MTBTNone && closebrace!=MTBTAny) width+=bracewidth;
|
if (closebrace!=MTBTNone && closebrace!=MTBTAny) width+=bracewidth;
|
||||||
@ -86,7 +90,6 @@ void JKQTMathTextBraceNode::getSizeInternalAndBrace(QPainter &painter, JKQTMathT
|
|||||||
double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv, const JKQTMathTextNodeSize* /*prevNodeSize*/) {
|
double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv, const JKQTMathTextNodeSize* /*prevNodeSize*/) {
|
||||||
//std::cout<<"drawing brace-node: '"<<openbrace.toStdString()<<"' ... '"<<closebrace.toStdString()<<"'\n";
|
//std::cout<<"drawing brace-node: '"<<openbrace.toStdString()<<"' ... '"<<closebrace.toStdString()<<"'\n";
|
||||||
doDrawBoxes(painter, x, y, currentEv);
|
doDrawBoxes(painter, x, y, currentEv);
|
||||||
JKQTMathTextEnvironment ev=currentEv;
|
|
||||||
|
|
||||||
double nodeWidth=0;
|
double nodeWidth=0;
|
||||||
double nodeBaselineHeight=0;
|
double nodeBaselineHeight=0;
|
||||||
@ -95,7 +98,7 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
getSizeInternalAndBrace(painter, currentEv, nodeWidth, nodeBaselineHeight, nodeOverallHeight, nodeStrikeoutPos, bracewidth, braceheight);
|
getSizeInternalAndBrace(painter, currentEv, nodeWidth, nodeBaselineHeight, nodeOverallHeight, nodeStrikeoutPos, bracewidth, braceheight);
|
||||||
const QFontMetricsF fm(currentEv.getFont(parentMathText));
|
const QFontMetricsF fm(currentEv.getFont(parentMathText));
|
||||||
|
|
||||||
const double lw=qMax(0.25,fm.lineWidth());
|
const double lw=fm.lineWidth();
|
||||||
|
|
||||||
double xnew=x;
|
double xnew=x;
|
||||||
|
|
||||||
@ -106,16 +109,16 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
p.setCapStyle(Qt::FlatCap);
|
p.setCapStyle(Qt::FlatCap);
|
||||||
p.setJoinStyle(Qt::MiterJoin);
|
p.setJoinStyle(Qt::MiterJoin);
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
const double paren_fraction=0.85;
|
const double paren_fraction=0.75;
|
||||||
const double brace_fraction=0.65;
|
|
||||||
const double absnorm_linewidth_factor=0.75;
|
const double absnorm_linewidth_factor=0.75;
|
||||||
const double paren_topwidth=lw*0.75;
|
const double paren_topwidth=lw*0.75;
|
||||||
const double paren_centerwidth=lw*2.0;
|
const double paren_centerwidth=lw*1.75;
|
||||||
|
const double angle_centerwidth=lw*1.55;
|
||||||
{
|
{
|
||||||
bool showOpeningBrace=true;
|
bool showOpeningBrace=true;
|
||||||
const double xbrace1=xnew+lw;
|
const double xbrace1=xnew+lw;
|
||||||
const double xbrace2=xnew+qMin(paren_fraction*bracewidth, 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);
|
const double xbraceC=xnew+bracewidth/2.0;
|
||||||
if (openbrace==MTBTParenthesis) {
|
if (openbrace==MTBTParenthesis) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
||||||
@ -133,7 +136,7 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
path.lineTo(pt2);
|
path.lineTo(pt2);
|
||||||
path.cubicTo(ptc2, pbc2, pb2);
|
path.cubicTo(ptc2, pbc2, pb2);
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
painter.fillPath(path, QBrush(ev.color, Qt::SolidPattern));
|
painter.fillPath(path, QBrush(currentEv.color, Qt::SolidPattern));
|
||||||
/*painter.setPen("blue");
|
/*painter.setPen("blue");
|
||||||
painter.drawLine(pb1,pbc1);
|
painter.drawLine(pb1,pbc1);
|
||||||
painter.drawLine(pt1,ptc1);
|
painter.drawLine(pt1,ptc1);
|
||||||
@ -145,10 +148,10 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
const double y2=y-nodeBaselineHeight;
|
const double y2=y-nodeBaselineHeight;
|
||||||
const double yc=(y1+y2)/2.0;
|
const double yc=(y1+y2)/2.0;
|
||||||
const QPointF pb1(xbrace2-paren_topwidth/2.0, y1);
|
const QPointF pb1(xbrace2-paren_topwidth/2.0, y1);
|
||||||
const QPointF pc1(xbrace1-paren_centerwidth/2.0, yc);
|
const QPointF pc1(xbrace1-angle_centerwidth/2.0, yc);
|
||||||
const QPointF pt1(xbrace2-paren_topwidth/2.0, y2);
|
const QPointF pt1(xbrace2-paren_topwidth/2.0, y2);
|
||||||
const QPointF pt2(xbrace2+paren_topwidth/2.0, y2);
|
const QPointF pt2(xbrace2+paren_topwidth/2.0, y2);
|
||||||
const QPointF pc2(xbrace1+paren_centerwidth/2.0, yc);
|
const QPointF pc2(xbrace1+angle_centerwidth/2.0, yc);
|
||||||
const QPointF pb2(xbrace2+paren_topwidth/2.0, y1);
|
const QPointF pb2(xbrace2+paren_topwidth/2.0, y1);
|
||||||
path.moveTo(pb1);
|
path.moveTo(pb1);
|
||||||
path.lineTo(pc1);
|
path.lineTo(pc1);
|
||||||
@ -157,45 +160,45 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
path.lineTo(pc2);
|
path.lineTo(pc2);
|
||||||
path.lineTo(pb2);
|
path.lineTo(pb2);
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
painter.fillPath(path, QBrush(ev.color, Qt::SolidPattern));
|
painter.fillPath(path, QBrush(currentEv.color, Qt::SolidPattern));
|
||||||
} else if (openbrace==MTBTSquareBracket) {
|
} else if (openbrace==MTBTSquareBracket) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
||||||
const double y2=y-nodeBaselineHeight+lw/2.0;
|
const double y2=y-nodeBaselineHeight+lw/2.0;
|
||||||
path.moveTo(xbrace2s, y1);
|
path.moveTo(xbrace2, y1);
|
||||||
path.lineTo(xbrace1, y1);
|
path.lineTo(xbrace1, y1);
|
||||||
path.lineTo(xbrace1, y2);
|
path.lineTo(xbrace1, y2);
|
||||||
path.lineTo(xbrace2s, y2);
|
path.lineTo(xbrace2, y2);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (openbrace==MTBTTopCorner) {
|
} else if (openbrace==MTBTTopCorner) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double dx=fabs(xbrace2s-xbrace1);
|
const double dx=fabs(xbrace2-xbrace1);
|
||||||
const double y1=y-nodeBaselineHeight+lw/2.0;
|
const double y1=y-nodeBaselineHeight+lw/2.0;
|
||||||
path.moveTo(xbrace2s, y1);
|
path.moveTo(xbrace2, y1);
|
||||||
path.lineTo(xbrace1, y1);
|
path.lineTo(xbrace1, y1);
|
||||||
path.lineTo(xbrace1, y1+dx);
|
path.lineTo(xbrace1, y1+dx);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (openbrace==MTBTBottomCorner) {
|
} else if (openbrace==MTBTBottomCorner) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double dx=fabs(xbrace2s-xbrace1);
|
const double dx=fabs(xbrace2-xbrace1);
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
||||||
path.moveTo(xbrace2s, y1);
|
path.moveTo(xbrace2, y1);
|
||||||
path.lineTo(xbrace1, y1);
|
path.lineTo(xbrace1, y1);
|
||||||
path.lineTo(xbrace1, y1-dx);
|
path.lineTo(xbrace1, y1-dx);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (openbrace==MTBTCurlyBracket) {
|
} else if (openbrace==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.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(90);
|
painter.rotate(90);
|
||||||
QPen plocal=p;
|
QPen plocal=p;
|
||||||
plocal.setWidthF(0.0001);
|
plocal.setWidthF(0.0001);
|
||||||
painter.fillPath(path, QBrush(ev.color));
|
painter.fillPath(path, QBrush(currentEv.color));
|
||||||
} else if (openbrace==MTBTFloorBracket) {
|
} else if (openbrace==MTBTFloorBracket) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
||||||
const double y2=y-nodeBaselineHeight;
|
const double y2=y-nodeBaselineHeight;
|
||||||
path.moveTo(xbrace2s, y1);
|
path.moveTo(xbrace2, y1);
|
||||||
path.lineTo(xbrace1, y1);
|
path.lineTo(xbrace1, y1);
|
||||||
path.lineTo(xbrace1, y2);
|
path.lineTo(xbrace1, y2);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
@ -205,12 +208,12 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
const double y2=y-nodeBaselineHeight+lw/2.0;
|
const double y2=y-nodeBaselineHeight+lw/2.0;
|
||||||
path.moveTo(xbrace1, y1);
|
path.moveTo(xbrace1, y1);
|
||||||
path.lineTo(xbrace1, y2);
|
path.lineTo(xbrace1, y2);
|
||||||
path.lineTo(xbrace2s, y2);
|
path.lineTo(xbrace2, y2);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (openbrace==MTBTSingleLine) {
|
} else if (openbrace==MTBTSingleLine) {
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
||||||
const double y2=y-nodeBaselineHeight;
|
const double y2=y-nodeBaselineHeight;
|
||||||
const QLineF l(xbrace1, y1, xbrace1, y2);
|
const QLineF l(xbraceC, y1, xbraceC, y2);
|
||||||
QPen plocal=p;
|
QPen plocal=p;
|
||||||
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
||||||
painter.setPen(plocal);
|
painter.setPen(plocal);
|
||||||
@ -222,9 +225,9 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
QPen plocal=p;
|
QPen plocal=p;
|
||||||
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
||||||
painter.setPen(plocal);
|
painter.setPen(plocal);
|
||||||
const QLineF l(xbrace1, y1, xbrace1, y2);
|
const QLineF l(xbraceC-lw, y1, xbraceC-lw, y2);
|
||||||
if (l.length()>0) painter.drawLine(l);
|
if (l.length()>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);
|
if (l2.length()>0) painter.drawLine(l2);
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
} else {
|
} else {
|
||||||
@ -242,8 +245,8 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
{
|
{
|
||||||
bool showClosingBrace=true;
|
bool showClosingBrace=true;
|
||||||
const double xbrace1=qMax(xnew+bracewidth-paren_fraction*bracewidth, xnew+lw/2.0);
|
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 xbrace2=xnew+bracewidth-lw;
|
||||||
|
const double xbraceC=xnew+bracewidth/2.0;
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
if (closebrace==MTBTParenthesis) {
|
if (closebrace==MTBTParenthesis) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
@ -262,7 +265,7 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
path.lineTo(pt2);
|
path.lineTo(pt2);
|
||||||
path.cubicTo(ptc2, pbc2, pb2);
|
path.cubicTo(ptc2, pbc2, pb2);
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
painter.fillPath(path, QBrush(ev.color, Qt::SolidPattern));
|
painter.fillPath(path, QBrush(currentEv.color, Qt::SolidPattern));
|
||||||
/*painter.setPen("blue");
|
/*painter.setPen("blue");
|
||||||
painter.drawLine(pb1,pbc1);
|
painter.drawLine(pb1,pbc1);
|
||||||
painter.drawLine(pt1,ptc1);
|
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 y2=y-nodeBaselineHeight;
|
||||||
const double yc=(y1+y2)/2.0;
|
const double yc=(y1+y2)/2.0;
|
||||||
const QPointF pb1(xbrace1-paren_topwidth/2.0, y1);
|
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 pt1(xbrace1-paren_topwidth/2.0, y2);
|
||||||
const QPointF pt2(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);
|
const QPointF pb2(xbrace1+paren_topwidth/2.0, y1);
|
||||||
path.moveTo(pb1);
|
path.moveTo(pb1);
|
||||||
path.lineTo(pc1);
|
path.lineTo(pc1);
|
||||||
@ -286,52 +289,45 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
path.lineTo(pc2);
|
path.lineTo(pc2);
|
||||||
path.lineTo(pb2);
|
path.lineTo(pb2);
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
painter.fillPath(path, QBrush(ev.color, Qt::SolidPattern));
|
painter.fillPath(path, QBrush(currentEv.color, Qt::SolidPattern));
|
||||||
} else if (closebrace==MTBTSquareBracket) {
|
} else if (closebrace==MTBTSquareBracket) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
||||||
const double y2=y-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, y1);
|
||||||
path.lineTo(xbrace2, y2);
|
path.lineTo(xbrace2, y2);
|
||||||
path.lineTo(xbrace1s, y2);
|
path.lineTo(xbrace1, y2);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (closebrace==MTBTBottomCorner) {
|
} else if (closebrace==MTBTBottomCorner) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double dx=fabs(xbrace1s-xbrace2);
|
const double dx=fabs(xbrace1-xbrace2);
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
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);
|
||||||
path.lineTo(xbrace2, y1-dx);
|
path.lineTo(xbrace2, y1-dx);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (closebrace==MTBTTopCorner) {
|
} else if (closebrace==MTBTTopCorner) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double dx=fabs(xbrace1s-xbrace2);
|
const double dx=fabs(xbrace1-xbrace2);
|
||||||
const double y1=y-nodeBaselineHeight+lw/2.0;
|
const double y1=y-nodeBaselineHeight+lw/2.0;
|
||||||
path.moveTo(xbrace1s, y1);
|
path.moveTo(xbrace1, y1);
|
||||||
path.lineTo(xbrace2, y1);
|
path.lineTo(xbrace2, y1);
|
||||||
path.lineTo(xbrace2, y1+dx);
|
path.lineTo(xbrace2, y1+dx);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (closebrace==MTBTCurlyBracket) {
|
} 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.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);
|
painter.rotate(270);
|
||||||
QPen plocal=p;
|
QPen plocal=p;
|
||||||
plocal.setWidthF(0.0001);
|
plocal.setWidthF(0.0001);
|
||||||
painter.fillPath(path, QBrush(ev.color));
|
painter.fillPath(path, QBrush(currentEv.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);*/
|
|
||||||
|
|
||||||
} else if (closebrace==MTBTFloorBracket) {
|
} else if (closebrace==MTBTFloorBracket) {
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight)-lw/2.0;
|
||||||
const double y2=y-nodeBaselineHeight;
|
const double y2=y-nodeBaselineHeight;
|
||||||
path.moveTo(xbrace1s, y1);
|
path.moveTo(xbrace1, y1);
|
||||||
path.lineTo(xbrace2, y1);
|
path.lineTo(xbrace2, y1);
|
||||||
path.lineTo(xbrace2, y2);
|
path.lineTo(xbrace2, y2);
|
||||||
painter.drawPath(path);
|
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;
|
const double y2=y-nodeBaselineHeight+lw/2.0;
|
||||||
path.moveTo(xbrace2, y1);
|
path.moveTo(xbrace2, y1);
|
||||||
path.lineTo(xbrace2, y2);
|
path.lineTo(xbrace2, y2);
|
||||||
path.lineTo(xbrace1s, y2);
|
path.lineTo(xbrace1, y2);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
} else if (closebrace==MTBTSingleLine) {
|
} else if (closebrace==MTBTSingleLine) {
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
||||||
const double y2=y-nodeBaselineHeight;
|
const double y2=y-nodeBaselineHeight;
|
||||||
const QLineF l(xbrace2, y1, xbrace2, y2);
|
const QLineF l(xbraceC, y1, xbraceC, y2);
|
||||||
QPen plocal=p;
|
QPen plocal=p;
|
||||||
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
||||||
painter.setPen(plocal);
|
painter.setPen(plocal);
|
||||||
@ -355,12 +351,12 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa
|
|||||||
} else if (closebrace==MTBTDoubleLine) {
|
} else if (closebrace==MTBTDoubleLine) {
|
||||||
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
||||||
const double y2=y-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;
|
QPen plocal=p;
|
||||||
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
plocal.setWidthF(plocal.widthF()*absnorm_linewidth_factor);
|
||||||
painter.setPen(plocal);
|
painter.setPen(plocal);
|
||||||
if (l.length()>0) painter.drawLine(l);
|
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);
|
if (l2.length()>0) painter.drawLine(l2);
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
} else {
|
} else {
|
||||||
@ -423,13 +419,19 @@ JKQTMathTextBraceType JKQTMathTextBraceNode::getClosebrace() const {
|
|||||||
return this->closebrace;
|
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 QFontMetricsF fm(ev.getFont(parentMathText), painter.device());
|
||||||
const double lw=qMax(0.25,fm.lineWidth());
|
const double lw=fm.lineWidth();
|
||||||
|
const double dblline_distance=2.0*lw;
|
||||||
braceheight=overallHeight*parentMathText->getBraceFactor();
|
braceheight=overallHeight*parentMathText->getBraceFactor();
|
||||||
bracewidth=0.6*pow(braceheight, 0.6);
|
bracewidth=lw*5.0;
|
||||||
if (openbrace==MTBTCurlyBracket || closebrace==MTBTCurlyBracket) bracewidth=qMax(bracewidth, lw*3.5);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,8 +318,9 @@ JKQTMathTextMatrixNode::LayoutInfo JKQTMathTextMatrixNode::calcLayout(QPainter &
|
|||||||
const QFontMetricsF fm(currentEv.getFont(parentMathText), painter.device());
|
const QFontMetricsF fm(currentEv.getFont(parentMathText), painter.device());
|
||||||
JKQTMathTextEnvironment ev1=currentEv;
|
JKQTMathTextEnvironment ev1=currentEv;
|
||||||
|
|
||||||
const double xheight=fm.strikeOutPos();
|
const double strikepos=fm.strikeOutPos();
|
||||||
const double xwidth=fm.boundingRect("x").width();
|
const double xwidth=fm.boundingRect("x").width();
|
||||||
|
const double lw=fm.lineWidth()*1.5;
|
||||||
const double XPadding=parentMathText->getMatrixXPaddingFactor()*xwidth;
|
const double XPadding=parentMathText->getMatrixXPaddingFactor()*xwidth;
|
||||||
const double YPadding=parentMathText->getMatrixYPaddingFactor()*xwidth;
|
const double YPadding=parentMathText->getMatrixYPaddingFactor()*xwidth;
|
||||||
const double XSeparation=parentMathText->getMatrixXSeparationFactor()*xwidth;
|
const double XSeparation=parentMathText->getMatrixXSeparationFactor()*xwidth;
|
||||||
@ -329,10 +330,10 @@ JKQTMathTextMatrixNode::LayoutInfo JKQTMathTextMatrixNode::calcLayout(QPainter &
|
|||||||
l.rowheight.resize(lines);
|
l.rowheight.resize(lines);
|
||||||
l.rowascent.resize(lines);
|
l.rowascent.resize(lines);
|
||||||
l.cellwidth.resize(lines);
|
l.cellwidth.resize(lines);
|
||||||
l.leftPadding=(verticalLineLeft==LTnone)?0:XPadding;
|
l.leftPadding=(verticalLineLeft==LTnone)?lw:XPadding;
|
||||||
l.rightPadding=(verticalLineRHSColumn.value(columns-1,LTnone)==LTnone)?0:XPadding;
|
l.rightPadding=(verticalLineRHSColumn.value(columns-1,LTnone)==LTnone)?lw:XPadding;
|
||||||
l.topPadding=(horizontalLineTop==LTnone)?0:YPadding;
|
l.topPadding=(horizontalLineTop==LTnone)?lw:YPadding;
|
||||||
l.bottomPadding=(horizontalLineBottomRow.value(lines-1,LTnone)==LTnone)?0:YPadding;
|
l.bottomPadding=(horizontalLineBottomRow.value(lines-1,LTnone)==LTnone)?lw:YPadding;
|
||||||
for (int ll=0; ll<lines; ll++) l.cellwidth[ll]=QVector<double>(columns, 0.0);
|
for (int ll=0; ll<lines; ll++) l.cellwidth[ll]=QVector<double>(columns, 0.0);
|
||||||
QVector<double> rowdescent;
|
QVector<double> rowdescent;
|
||||||
rowdescent.resize(lines);
|
rowdescent.resize(lines);
|
||||||
@ -355,8 +356,8 @@ JKQTMathTextMatrixNode::LayoutInfo JKQTMathTextMatrixNode::calcLayout(QPainter &
|
|||||||
l.width=(columns-1)*XSeparation+l.leftPadding+l.rightPadding;
|
l.width=(columns-1)*XSeparation+l.leftPadding+l.rightPadding;
|
||||||
for (int i=0; i<columns; i++) l.width=l.width+l.colwidth[i];
|
for (int i=0; i<columns; i++) l.width=l.width+l.colwidth[i];
|
||||||
for (int i=0; i<lines; i++) l.overallHeight=l.overallHeight+l.rowheight[i];
|
for (int i=0; i<lines; i++) l.overallHeight=l.overallHeight+l.rowheight[i];
|
||||||
l.baselineHeight=l.overallHeight/2.0+xheight;
|
l.baselineHeight=l.overallHeight/2.0+strikepos;
|
||||||
l.strikeoutPos=xheight;
|
l.strikeoutPos=strikepos;
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
@ -377,10 +378,7 @@ double JKQTMathTextMatrixNode::draw(QPainter& painter, double x, double y, JKQTM
|
|||||||
|
|
||||||
const LayoutInfo l=calcLayout(painter, currentEv);
|
const LayoutInfo l=calcLayout(painter, currentEv);
|
||||||
|
|
||||||
const double xheight=fm.strikeOutPos();
|
|
||||||
const double xwidth=fm.boundingRect("x").width();
|
const double xwidth=fm.boundingRect("x").width();
|
||||||
//const double XPadding=parentMathText->getMatrixXPaddingFactor()*xwidth;
|
|
||||||
//const double YPadding=parentMathText->getMatrixYPaddingFactor()*xwidth;
|
|
||||||
const double XSeparation=parentMathText->getMatrixXSeparationFactor()*xwidth;
|
const double XSeparation=parentMathText->getMatrixXSeparationFactor()*xwidth;
|
||||||
const double YSeparation=parentMathText->getMatrixYSeparationFactor()*xwidth;
|
const double YSeparation=parentMathText->getMatrixYSeparationFactor()*xwidth;
|
||||||
const double yTop=y-l.baselineHeight+l.topPadding;
|
const double yTop=y-l.baselineHeight+l.topPadding;
|
||||||
|