mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
JKQTMathTextSymbolNode: bugfixed bar-drawing for hbar
This commit is contained in:
parent
ef25aa82b0
commit
8af79cb927
@ -217,7 +217,8 @@ double JKQTMathTextSymbolNode::draw(QPainter& painter, double x, double y, JKQTM
|
|||||||
const double yShift=symprops.yShiftFactor*tbr.height();
|
const double yShift=symprops.yShiftFactor*tbr.height();
|
||||||
const double xShift=(width-tbr.width())/2.0;
|
const double xShift=(width-tbr.width())/2.0;
|
||||||
const QPointF x0(x+xShift-tbr.x(), y+yShift);
|
const QPointF x0(x+xShift-tbr.x(), y+yShift);
|
||||||
const double italic_xcorrection=tbr.width()-tbrNonItalic.width();
|
double italic_xcorrection=fabs(tbr.width()-tbrNonItalic.width());
|
||||||
|
if (fabs(italic_xcorrection)<1e-6) italic_xcorrection=double(fm.boundingRect(' ').width())*parentMathText->getItalicCorrectionFactor();
|
||||||
|
|
||||||
//qDebug()<<"SYMB::draw(): symbolName="<<symbolName<<" font="<<f<<" sym="<<sym<<" yShiftFactor="<<symprops.yShiftFactor;
|
//qDebug()<<"SYMB::draw(): symbolName="<<symbolName<<" font="<<f<<" sym="<<sym<<" yShiftFactor="<<symprops.yShiftFactor;
|
||||||
|
|
||||||
@ -232,8 +233,8 @@ double JKQTMathTextSymbolNode::draw(QPainter& painter, double x, double y, JKQTM
|
|||||||
//qDebug()<<" -> DrawLeftHBar or DrawRightHBar";
|
//qDebug()<<" -> DrawLeftHBar or DrawRightHBar";
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(QPen(currentEv.color, fm.lineWidth()));
|
painter.setPen(QPen(currentEv.color, fm.lineWidth()));
|
||||||
const double ybar=-(fm.xHeight()+fm.ascent())/2.0;
|
const double ybar=-fm.xHeight()*1.1;
|
||||||
const double deltaybar=(fm.ascent()-fm.xHeight())*0.25;
|
const double deltaybar=fm.xHeight()*0.2;
|
||||||
const double barwidth=tbrNonItalic.width()/2.0;
|
const double barwidth=tbrNonItalic.width()/2.0;
|
||||||
const double xbarstart=(has(symflags, DrawLeftHBar))?italic_xcorrection:(tbr.width()-barwidth);
|
const double xbarstart=(has(symflags, DrawLeftHBar))?italic_xcorrection:(tbr.width()-barwidth);
|
||||||
painter.drawLine(xbarstart, ybar, xbarstart+barwidth, ybar-deltaybar);
|
painter.drawLine(xbarstart, ybar, xbarstart+barwidth, ybar-deltaybar);
|
||||||
|
Loading…
Reference in New Issue
Block a user