2022-06-08 21:38:26 +08:00
|
|
|
/*
|
|
|
|
Copyright (c) 2008-2022 Jan W. Krieger (<jan@jkrieger.de>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This software is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License (LGPL) as published by
|
|
|
|
the Free Software Foundation, either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Lesser General Public License (LGPL) for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License (LGPL)
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "jkqtmathtext/nodes/jkqtmathtextbracenode.h"
|
|
|
|
#include "jkqtmathtext/jkqtmathtexttools.h"
|
|
|
|
#include "jkqtmathtext/jkqtmathtext.h"
|
|
|
|
#include "jkqtcommon/jkqtpcodestructuring.h"
|
|
|
|
#include "jkqtcommon/jkqtpstringtools.h"
|
|
|
|
#include <cmath>
|
|
|
|
#include <QFontMetricsF>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QFontDatabase>
|
|
|
|
#include <QFontInfo>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QPainterPath>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-19 21:11:06 +08:00
|
|
|
JKQTMathTextBraceNode::JKQTMathTextBraceNode(JKQTMathText* _parent, JKQTMathTextBraceType openbrace, JKQTMathTextBraceType closebrace, JKQTMathTextNode* child):
|
2022-06-09 05:52:22 +08:00
|
|
|
JKQTMathTextSingleChildNode(child, _parent)
|
2022-06-08 21:38:26 +08:00
|
|
|
{
|
|
|
|
this->openbrace=openbrace;
|
|
|
|
this->closebrace=closebrace;
|
|
|
|
}
|
|
|
|
|
2022-06-09 05:52:22 +08:00
|
|
|
|
2022-06-08 21:38:26 +08:00
|
|
|
JKQTMathTextBraceNode::~JKQTMathTextBraceNode() {
|
|
|
|
}
|
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
void JKQTMathTextBraceNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const JKQTMathTextNodeSize* prevNodeSize) {
|
|
|
|
double braceWidth=0, braceHeight=0;
|
|
|
|
getSizeInternalAndBrace(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos, braceWidth, braceHeight, prevNodeSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTMathTextBraceNode::getSizeInternalAndBrace(QPainter &painter, JKQTMathTextEnvironment currentEv, double &width, double &baselineHeight, double &overallHeight, double &strikeoutPos, double &bracewidth, double &braceheight, const JKQTMathTextNodeSize */*prevNodeSize*/)
|
|
|
|
{
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-09 05:52:22 +08:00
|
|
|
const JKQTMathTextEnvironment ev=currentEv;
|
2022-06-08 21:38:26 +08:00
|
|
|
child->getSize(painter, currentEv, width, baselineHeight, overallHeight, strikeoutPos);
|
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
const double cAscentAboveStrike=baselineHeight-strikeoutPos;
|
|
|
|
const double cDescentBelowStrike=overallHeight-baselineHeight+strikeoutPos;
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
//qDebug()<<"getSizeInternalAndBrace(): showOpeningBrace="<<showOpeningBrace<<", openbrace="<<openbrace<<", showClosingBrace="<<showClosingBrace<<", closebrace="<<closebrace;
|
|
|
|
//qDebug()<<"getSizeInternalAndBrace(): child: baselineHeight="<<baselineHeight<<", strikeoutPos="<<strikeoutPos<<", overallHeight="<<overallHeight;
|
|
|
|
//qDebug()<<"getSizeInternalAndBrace(): child: cAscentAboveStrike="<<cAscentAboveStrike<<", cDescentBelowStrike="<<cDescentBelowStrike;
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
const double heightAboveBelowStrike=qMax(cAscentAboveStrike, cDescentBelowStrike);
|
2022-06-08 21:38:26 +08:00
|
|
|
|
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
baselineHeight=strikeoutPos+heightAboveBelowStrike*parentMathText->getBraceFactor();
|
|
|
|
overallHeight=2.0*heightAboveBelowStrike*parentMathText->getBraceFactor(); //fm.height();
|
|
|
|
|
|
|
|
//qDebug()<<"getSizeInternalAndBrace(): heightAboveBelowStrike="<<heightAboveBelowStrike<<", baselineHeight="<<baselineHeight<<", overallHeight="<<overallHeight;
|
|
|
|
|
|
|
|
bracewidth=0;
|
|
|
|
braceheight=0;
|
|
|
|
getBraceSize(painter, ev, baselineHeight, overallHeight, bracewidth, braceheight);
|
|
|
|
|
|
|
|
bracewidth=bracewidth/parentMathText->getBraceShrinkFactor();
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-19 21:11:06 +08:00
|
|
|
if (openbrace!=MTBTNone && openbrace!=MTBTAny) width+=bracewidth;
|
|
|
|
if (closebrace!=MTBTNone && closebrace!=MTBTAny) width+=bracewidth;
|
2022-06-08 21:38:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv, const JKQTMathTextNodeSize* /*prevNodeSize*/) {
|
|
|
|
//std::cout<<"drawing brace-node: '"<<openbrace.toStdString()<<"' ... '"<<closebrace.toStdString()<<"'\n";
|
|
|
|
doDrawBoxes(painter, x, y, currentEv);
|
|
|
|
JKQTMathTextEnvironment ev=currentEv;
|
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
double nodeWidth=0;
|
|
|
|
double nodeBaselineHeight=0;
|
|
|
|
double nodeOverallHeight=0, nodeStrikeoutPos=0;
|
2022-06-08 21:38:26 +08:00
|
|
|
double bracewidth=0, braceheight=0;
|
2022-06-09 20:30:15 +08:00
|
|
|
getSizeInternalAndBrace(painter, currentEv, nodeWidth, nodeBaselineHeight, nodeOverallHeight, nodeStrikeoutPos, bracewidth, braceheight);
|
2022-06-08 21:38:26 +08:00
|
|
|
|
|
|
|
|
2022-06-09 05:52:22 +08:00
|
|
|
const double lw=qMax(0.25,ceil(currentEv.fontSize/16.0));//fm.lineWidth();
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
double xnew=x;
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-09 05:52:22 +08:00
|
|
|
const QPen pold=painter.pen();
|
2022-06-08 21:38:26 +08:00
|
|
|
QPen p=pold;
|
|
|
|
p.setWidthF(lw);
|
|
|
|
p.setColor(currentEv.color);
|
|
|
|
painter.setPen(p);
|
2022-06-09 20:30:15 +08:00
|
|
|
const double paren_fraction=0.85;
|
|
|
|
const double brace_fraction=0.65;
|
2022-06-19 21:11:06 +08:00
|
|
|
{
|
|
|
|
bool showOpeningBrace=true;
|
2022-06-09 20:30:15 +08:00
|
|
|
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);
|
2022-06-10 03:37:06 +08:00
|
|
|
if (openbrace==MTBTParenthesis) {
|
2022-06-09 20:30:15 +08:00
|
|
|
QPainterPath path;
|
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace2, y1);
|
|
|
|
path.cubicTo(xbrace1, (y1+y2)/2.0+fabs(y1-y2)/6.0, xbrace1, (y1+y2)/2.0-fabs(y1-y2)/6.0 , xbrace2, y2);
|
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (openbrace==MTBTSquareBracket) {
|
2022-06-09 20:30:15 +08:00
|
|
|
QPainterPath path;
|
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace2s, y1);
|
|
|
|
path.lineTo(xbrace1, y1);
|
|
|
|
path.lineTo(xbrace1, y2);
|
|
|
|
path.lineTo(xbrace2s, y2);
|
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (openbrace==MTBTCurlyBracket) {
|
2022-06-09 20:30:15 +08:00
|
|
|
QPainterPath path=JKQTMathTextMakeHBracePath(0,0,nodeOverallHeight, bracewidth*brace_fraction);
|
|
|
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
|
|
|
painter.translate((xbrace1+xbrace2)/2.0, y-nodeBaselineHeight+nodeOverallHeight/2.0);
|
|
|
|
painter.rotate(90);
|
|
|
|
painter.drawPath(path);
|
|
|
|
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (openbrace==MTBTFloorBracket) {
|
2022-06-09 20:30:15 +08:00
|
|
|
QPainterPath path;
|
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace2s, y1);
|
|
|
|
path.lineTo(xbrace1, y1);
|
|
|
|
path.lineTo(xbrace1, y2);
|
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (openbrace==MTBTCeilBracket) {
|
2022-06-09 20:30:15 +08:00
|
|
|
QPainterPath path;
|
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace1, y1);
|
|
|
|
path.lineTo(xbrace1, y2);
|
|
|
|
path.lineTo(xbrace2s, y2);
|
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (openbrace==MTBTSingleLine) {
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
const QLineF l(xbrace1, y1, xbrace1, y2);
|
|
|
|
if (l.length()>0) painter.drawLine(l);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (openbrace==MTBTDoubleLine) {
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
const QLineF l(xbrace1, y1, xbrace1, y2);
|
|
|
|
if (l.length()>0) painter.drawLine(l);
|
|
|
|
const QLineF l2(xbrace1+1.5*lw, y1, xbrace1+1.5*lw, y2);
|
|
|
|
if (l2.length()>0) painter.drawLine(l2);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (openbrace==MTBTAngleBracket) {
|
2022-06-09 20:30:15 +08:00
|
|
|
QPainterPath path;
|
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace2, y1);
|
|
|
|
path.lineTo(xbrace1, (y2+y1)/2.0);
|
|
|
|
path.lineTo(xbrace2, y2);
|
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else {
|
|
|
|
showOpeningBrace=false;
|
|
|
|
}
|
|
|
|
if (showOpeningBrace) {
|
|
|
|
xnew=xnew+bracewidth;
|
2022-06-09 20:30:15 +08:00
|
|
|
}
|
2022-06-08 21:38:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
painter.setPen(pold);
|
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
xnew= child->draw(painter, xnew, y, currentEv);
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-19 21:11:06 +08:00
|
|
|
{
|
|
|
|
bool showClosingBrace=true;
|
2022-06-09 20:30:15 +08:00
|
|
|
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;
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.setPen(p);
|
2022-06-19 21:11:06 +08:00
|
|
|
if (closebrace==MTBTParenthesis) {
|
2022-06-08 21:38:26 +08:00
|
|
|
QPainterPath path;
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace1, y1);
|
|
|
|
path.cubicTo(xbrace2, (y1+y2)/2.0+fabs(y1-y2)/6.0, xbrace2, (y1+y2)/2.0-fabs(y1-y2)/6.0 , xbrace1, y2);
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (closebrace==MTBTSquareBracket) {
|
2022-06-08 21:38:26 +08:00
|
|
|
QPainterPath path;
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace1s, y1);
|
|
|
|
path.lineTo(xbrace2, y1);
|
|
|
|
path.lineTo(xbrace2, y2);
|
|
|
|
path.lineTo(xbrace1s, y2);
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (closebrace==MTBTCurlyBracket) {
|
2022-06-09 20:30:15 +08:00
|
|
|
QPainterPath path=JKQTMathTextMakeHBracePath(0,0,nodeOverallHeight, bracewidth*brace_fraction);
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
2022-06-09 20:30:15 +08:00
|
|
|
painter.translate((xbrace1+xbrace2)/2.0, y-nodeBaselineHeight+nodeOverallHeight/2.0);
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.rotate(270);
|
|
|
|
painter.drawPath(path);
|
|
|
|
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (closebrace==MTBTFloorBracket) {
|
2022-06-08 21:38:26 +08:00
|
|
|
QPainterPath path;
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace1s, y1);
|
|
|
|
path.lineTo(xbrace2, y1);
|
|
|
|
path.lineTo(xbrace2, y2);
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (closebrace==MTBTCeilBracket) {
|
2022-06-08 21:38:26 +08:00
|
|
|
QPainterPath path;
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace2, y1);
|
|
|
|
path.lineTo(xbrace2, y2);
|
|
|
|
path.lineTo(xbrace1s, y2);
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (closebrace==MTBTSingleLine) {
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
const QLineF l(xbrace2, y1, xbrace2, y2);
|
2022-06-08 21:38:26 +08:00
|
|
|
if (l.length()>0) painter.drawLine(l);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (closebrace==MTBTDoubleLine) {
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
const QLineF l(xbrace2, y1, xbrace2, y2);
|
2022-06-08 21:38:26 +08:00
|
|
|
if (l.length()>0) painter.drawLine(l);
|
2022-06-09 20:30:15 +08:00
|
|
|
const QLineF l2(xbrace2-1.5*lw, y1, xbrace2-1.5*lw, y2);
|
|
|
|
if (l2.length()>0) painter.drawLine(l2);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else if (closebrace==MTBTAngleBracket) {
|
2022-06-08 21:38:26 +08:00
|
|
|
QPainterPath path;
|
2022-06-09 20:30:15 +08:00
|
|
|
const double y1=y+(nodeOverallHeight-nodeBaselineHeight);
|
|
|
|
const double y2=y-nodeBaselineHeight;
|
|
|
|
path.moveTo(xbrace1, y1);
|
|
|
|
path.lineTo(xbrace2, (y2+y1)/2.0);
|
|
|
|
path.lineTo(xbrace1, y2);
|
2022-06-08 21:38:26 +08:00
|
|
|
painter.drawPath(path);
|
2022-06-19 21:11:06 +08:00
|
|
|
} else {
|
|
|
|
showClosingBrace=false;
|
2022-06-08 21:38:26 +08:00
|
|
|
}
|
|
|
|
painter.setPen(pold);
|
2022-06-19 21:11:06 +08:00
|
|
|
if (showClosingBrace) {
|
|
|
|
xnew=xnew+bracewidth;
|
|
|
|
}
|
2022-06-08 21:38:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//qDebug()<<" ==> "<<bc<<fm.boundingRect(bc).width();
|
2022-06-09 20:30:15 +08:00
|
|
|
return xnew;
|
2022-06-08 21:38:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool JKQTMathTextBraceNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) {
|
2022-06-10 03:37:06 +08:00
|
|
|
QString ob;
|
|
|
|
QString cb;
|
2022-06-19 21:11:06 +08:00
|
|
|
if (openbrace==MTBTAngleBracket) ob="⟨";
|
|
|
|
else if (openbrace==MTBTFloorBracket) ob="⌊";
|
|
|
|
else if (openbrace==MTBTCeilBracket) ob="⌈";
|
|
|
|
else if (openbrace==MTBTParenthesis) ob="(";
|
|
|
|
else if (openbrace==MTBTSquareBracket) ob="[";
|
|
|
|
else if (openbrace==MTBTCurlyBracket) ob="{";
|
|
|
|
else if (openbrace==MTBTSingleLine) ob="|";
|
|
|
|
else if (openbrace==MTBTDoubleLine) ob="||";
|
|
|
|
if (closebrace==MTBTAngleBracket) cb="⟩";
|
|
|
|
else if (closebrace==MTBTFloorBracket) cb="⌋";
|
|
|
|
else if (closebrace==MTBTCeilBracket) cb="⌉";
|
|
|
|
else if (closebrace==MTBTParenthesis) cb=")";
|
|
|
|
else if (closebrace==MTBTSquareBracket) cb="]";
|
|
|
|
else if (closebrace==MTBTCurlyBracket) cb="}";
|
|
|
|
else if (closebrace==MTBTSingleLine) cb="|";
|
|
|
|
else if (closebrace==MTBTDoubleLine) cb="||";
|
2022-06-08 21:38:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
html=html+ob;
|
|
|
|
|
|
|
|
bool ok=child->toHtml(html, currentEv, defaultEv);
|
|
|
|
|
|
|
|
html=html+cb;
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2022-06-09 05:52:22 +08:00
|
|
|
QString JKQTMathTextBraceNode::getTypeName() const
|
2022-06-08 21:38:26 +08:00
|
|
|
{
|
2022-06-19 21:11:06 +08:00
|
|
|
return QLatin1String("MTbraceNode(")+JKQTMathTextBraceType2String(openbrace)+" "+JKQTMathTextBraceType2String(closebrace)+")";
|
2022-06-09 05:52:22 +08:00
|
|
|
}
|
2022-06-08 21:38:26 +08:00
|
|
|
|
2022-06-19 21:11:06 +08:00
|
|
|
JKQTMathTextBraceType JKQTMathTextBraceNode::getOpenbrace() const {
|
2022-06-09 05:52:22 +08:00
|
|
|
return this->openbrace;
|
2022-06-08 21:38:26 +08:00
|
|
|
}
|
|
|
|
|
2022-06-19 21:11:06 +08:00
|
|
|
JKQTMathTextBraceType JKQTMathTextBraceNode::getClosebrace() const {
|
2022-06-09 05:52:22 +08:00
|
|
|
return this->closebrace;
|
|
|
|
}
|
|
|
|
|
2022-06-09 20:30:15 +08:00
|
|
|
void JKQTMathTextBraceNode::getBraceSize(QPainter &/*painter*/, JKQTMathTextEnvironment ev, double /*baselineHeight*/, double overallHeight, double &bracewidth, double &braceheight) const
|
|
|
|
{
|
|
|
|
const double lw=qMax(0.25,ceil(ev.fontSize/12.0));
|
2022-06-09 05:52:22 +08:00
|
|
|
braceheight=overallHeight*parentMathText->getBraceFactor();
|
2022-06-08 21:38:26 +08:00
|
|
|
bracewidth=0.6*pow(braceheight, 0.6);
|
2022-06-19 21:11:06 +08:00
|
|
|
if (openbrace==MTBTCurlyBracket || closebrace==MTBTCurlyBracket) bracewidth=qMax(bracewidth, lw*3.5);
|
2022-06-08 21:38:26 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|