diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index cf64fd63f7..afd3759644 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -54,6 +54,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW: \limits and \nolimits works as in LaTeX now (before it was simply removed and the functionality implemented for a fixed list of symbols)
  • NEW: added top-corner (\ulcorner/\urcorner) and bottom-corner brackets (\llcorner/\lrcorner)
  • NEW: added \overbracket and \underbracket
  • +
  • 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
  • diff --git a/examples/jkqtmathtext_test/testform.cpp b/examples/jkqtmathtext_test/testform.cpp index 92173bcfa4..431df9d379 100644 --- a/examples/jkqtmathtext_test/testform.cpp +++ b/examples/jkqtmathtext_test/testform.cpp @@ -258,6 +258,7 @@ TestForm::TestForm(QWidget *parent) : connect(ui->cmbLastAlign, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMath())); connect(ui->cmbFont, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMath())); connect(ui->cmbScript, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMath())); + connect(ui->cmbSizeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMath())); connect(ui->cmbTestset, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMath())); connect(ui->cmbCaligraphic, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMath())); connect(ui->cmbUnicodeSans, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMath())); @@ -573,9 +574,11 @@ void TestForm::updateMath() bool ok=true; int size=sl[i].trimmed().toUInt(&ok); if (!ok) size=10+i*5; - mt.setFontSize(size); + QString unit=""; + if (ui->cmbSizeUnit->currentIndex()==0) { unit="pt"; mt.setFontSize(size); } + else {unit="px"; mt.setFontSizePixels(size); } double durationSizingMS=0, durationTimingMS=0; - Y+=draw(painter, X1, Y, mt, QString("%1, %2, %3pt").arg(ui->cmbTestset->currentText()).arg(ui->cmbFont->currentText()).arg(size), durationSizingMS, durationTimingMS); + Y+=draw(painter, X1, Y, mt, QString("%1, %2, %3"+unit).arg(ui->cmbTestset->currentText()).arg(ui->cmbFont->currentText()).arg(size), durationSizingMS, durationTimingMS); if (i==0) { ui->labError->clear(); @@ -600,8 +603,10 @@ void TestForm::updateMath() bool ok=true; int size=sl.last().trimmed().toUInt(&ok); if (!ok) size=font().pointSizeF(); - mt.setFontSize(size); - Y+=drawAligned(painter, X1, Y, mt, QString("%1, %2pt, align: %3").arg(ui->cmbTestset->currentText()).arg(size).arg(ui->cmbLastAlign->currentText())); + QString unit; + if (ui->cmbSizeUnit->currentIndex()==0) { unit="pt"; mt.setFontSize(size); } + else { unit="px"; mt.setFontSizePixels(size); } + Y+=drawAligned(painter, X1, Y, mt, QString("%1, %2"+unit+", align: %3").arg(ui->cmbTestset->currentText()).arg(size).arg(ui->cmbLastAlign->currentText())); } painter.end(); diff --git a/examples/jkqtmathtext_test/testform.ui b/examples/jkqtmathtext_test/testform.ui index 458be4d26f..a78335632e 100644 --- a/examples/jkqtmathtext_test/testform.ui +++ b/examples/jkqtmathtext_test/testform.ui @@ -588,7 +588,7 @@ - + @@ -675,6 +675,26 @@ + + + + + 0 + 0 + + + + + pt + + + + + px + + + + diff --git a/lib/jkqtmathtext/jkqtmathtext.cpp b/lib/jkqtmathtext/jkqtmathtext.cpp index fc9fd8e1b2..203ea6d2d7 100644 --- a/lib/jkqtmathtext/jkqtmathtext.cpp +++ b/lib/jkqtmathtext/jkqtmathtext.cpp @@ -61,6 +61,7 @@ JKQTMathText::JKQTMathText(QObject* parent): //qDebug()<<"init_resoucre: "<(std::chrono::high_resolution_clock::now()-t0).count()/1000.0<<"ms"; t0=std::chrono::high_resolution_clock::now(); fontSize=10; + fontSizeUnits=JKQTMathTextEnvironment::POINTS; fontColor=QColor("black"); italic_correction_factor=0.4; brace_factor=1.04; @@ -121,30 +122,6 @@ JKQTMathText::JKQTMathText(QObject* parent): #else const auto fonts=QFontDatabase::families(); #endif - //qDebug()<<"fonts:\n"<(std::chrono::high_resolution_clock::now()-t0).count()/1000.0<<"ms"; t0=std::chrono::high_resolution_clock::now(); auto checkForFonts=[&fonts](QString& targetfont, const QStringList& fontoptions) { @@ -220,6 +197,7 @@ JKQTMathText::~JKQTMathText() { void JKQTMathText::loadSettings(const QSettings& settings, const QString& group){ fontSize=settings.value(group+"font_size", fontSize).toDouble(); + 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(); @@ -261,6 +239,7 @@ void JKQTMathText::loadSettings(const QSettings& settings, const QString& group) void JKQTMathText::saveSettings(QSettings& settings, const QString& group) const{ settings.setValue(group+"font_size", fontSize); + 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); @@ -363,6 +342,24 @@ bool JKQTMathText::useASANA(bool mathModeOnly) } void JKQTMathText::useAnyUnicode(QString timesFont, const QString &sansFont, JKQTMathTextFontEncoding encodingTimes, JKQTMathTextFontEncoding encodingSans) +{ + if (!timesFont.isEmpty()) { + setFontRoman(timesFont, encodingTimes); + setFontMathRoman(timesFont, encodingTimes); + } + if (!sansFont.isEmpty()) { + setFontSans(sansFont, encodingSans); + setFontMathSans(sansFont, encodingSans); + } +} + +void JKQTMathText::useAnyUnicodeForMathOnly(QString timesFont, const QString &sansFont, JKQTMathTextFontEncoding encodingTimes, JKQTMathTextFontEncoding encodingSans) +{ + if (!timesFont.isEmpty()) { setFontMathRoman(timesFont, encodingTimes); } + if (!sansFont.isEmpty()) { setFontMathSans(sansFont, encodingSans); } +} + +void JKQTMathText::useAnyUnicodeForTextOnly(QString timesFont, const QString &sansFont, JKQTMathTextFontEncoding encodingTimes, JKQTMathTextFontEncoding encodingSans) { if (!timesFont.isEmpty()) { setFontRoman(timesFont, encodingTimes); } if (!sansFont.isEmpty()) { setFontSans(sansFont, encodingSans); } @@ -376,9 +373,11 @@ QString JKQTMathText::toHtml(bool *ok, double fontPointSize) { JKQTMathTextEnvironment ev; ev.color=fontColor; ev.fontSize=fontPointSize; + ev.fontSizeUnit=JKQTMathTextEnvironment::POINTS; JKQTMathTextEnvironment defaultev; defaultev.fontSize=fontPointSize; + defaultev.fontSizeUnit=JKQTMathTextEnvironment::POINTS; okk=getNodeTree()->toHtml(s, ev, defaultev); } @@ -399,12 +398,36 @@ QColor JKQTMathText::getFontColor() const void JKQTMathText::setFontSize(double __value) { - this->fontSize = __value; + setFontPointSize(__value); +} + +void JKQTMathText::setFontPointSize(double __value) +{ + fontSize = __value; + fontSizeUnits=JKQTMathTextEnvironment::POINTS; +} + +void JKQTMathText::setFontSizePixels(double __value) +{ + fontSize = __value; + fontSizeUnits=JKQTMathTextEnvironment::PIXELS; } double JKQTMathText::getFontSize() const { - return this->fontSize; + return getFontPointSize(); +} + +double JKQTMathText::getFontPointSize() const +{ + if (fontSizeUnits==JKQTMathTextEnvironment::POINTS) return fontSize; + else return -1; +} + +double JKQTMathText::getFontSizePixels() const +{ + if (fontSizeUnits==JKQTMathTextEnvironment::PIXELS) return fontSize; + else return -1; } void JKQTMathText::addReplacementFont(const QString &nonUseFont, const QString &useFont, JKQTMathTextFontEncoding useFontEncoding) { @@ -1638,6 +1661,7 @@ void JKQTMathText::getSizeDetail(QPainter& painter, double& width, double& ascen JKQTMathTextEnvironment ev; ev.color=fontColor; ev.fontSize=fontSize; + ev.fontSizeUnit=fontSizeUnits; double overallHeight=0; getNodeTree()->getSize(painter, ev, width, ascent, overallHeight, strikeoutPos); @@ -1658,6 +1682,7 @@ void JKQTMathText::draw(QPainter& painter, double x, double y, bool drawBoxes){ JKQTMathTextEnvironment ev; ev.color=fontColor; ev.fontSize=fontSize; + ev.fontSizeUnit=fontSizeUnits; QPen pp=painter.pen(); QPen p=pp; p.setStyle(Qt::SolidLine); @@ -1678,6 +1703,7 @@ void JKQTMathText::draw(QPainter& painter, unsigned int flags, QRectF rect, bool JKQTMathTextEnvironment ev; ev.color=fontColor; ev.fontSize=fontSize; + ev.fontSizeUnit=fontSizeUnits; getNodeTree()->setDrawBoxes(drawBoxes); painter.setPen(p); diff --git a/lib/jkqtmathtext/jkqtmathtext.h b/lib/jkqtmathtext/jkqtmathtext.h index ec462c59f9..2d3fd2e20c 100644 --- a/lib/jkqtmathtext/jkqtmathtext.h +++ b/lib/jkqtmathtext/jkqtmathtext.h @@ -294,10 +294,22 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject { void setFontColor(const QColor & __value); /** \copydoc fontColor */ QColor getFontColor() const; - /** \copydoc fontSize */ + /** \copydoc setFontPointSize() */ void setFontSize(double __value); - /** \copydoc fontSize */ + /** \brief set the default font size in points + * \see getFontSize(), fontSize, fontSizeUnits */ + void setFontPointSize(double __value); + /** \brief set the default font soze in pixels + * \see getFontSizePixels(), fontSize, fontSizeUnits */ + void setFontSizePixels(double __value); + /** \brief returns the currently set default font size in points, if it was defined in points using setFontSize(), or -1 if it was set in pixels with setFontSizePixels() + * \see setFontSize(), fontSize, fontSizeUnits */ + double getFontPointSize() const; + /** \copydoc getFontPointSize() */ double getFontSize() const; + /** \brief returns the currently set default font size in pixels, if it was defined in points using setFontSizePixels(), or -1 if it was set in points with setFontSize() + * \see setFontSizePixels(), fontSize, fontSizeUnits */ + double getFontSizePixels() const; /** \brief add a font pair to the table with font replacements * * e.g. if it is known that a certain font is not good for rendering, you can add an alternative with this function. @@ -440,8 +452,9 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject { /** \brief sets \a timesFont (with its encoding \a encodingTimes ) for serif-text and \a sansFont (with its encoding \a encodingSans ) for both mathmode and textmode fonts * - * use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. - * You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results. + * \note use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. + * You should use fonts that contain as many of the mathematical symbols as possible + * to ensure good rendering results. * * useAnyUnicode("Times New Roman", "Times New Roman"):
    \image html jkqtmathtext/jkqtmathparser_timesnewroman.png

    * useAnyUnicode("Arial", "Arial"):
    \image html jkqtmathtext/jkqtmathparser_arial.png

    @@ -449,7 +462,20 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject { * useAnyUnicode("Comic Sans MS", "Comic Sans MS"):
    \image html jkqtmathtext/jkqtmathparser_comicsans.png

    * */ - void useAnyUnicode(QString timesFont=QString(""), const QString& sansFont=QString(""), JKQTMathTextFontEncoding encodingTimes=JKQTMathTextFontEncoding::MTFEUnicode, JKQTMathTextFontEncoding encodingSans=JKQTMathTextFontEncoding::MTFEUnicode); + void useAnyUnicode(QString timesFont, const QString& sansFont, JKQTMathTextFontEncoding encodingTimes=JKQTMathTextFontEncoding::MTFEUnicode, JKQTMathTextFontEncoding encodingSans=JKQTMathTextFontEncoding::MTFEUnicode); + /** \brief sets \a timesFont (with its encoding \a encodingTimes ) for serif-text and \a sansFont (with its encoding \a encodingSans ) for mathmode fonts only + * + * \note use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. + * You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results. + * + * \see useAnyUnicodeForTextOnly(), useAnyUnicode() + */ + void useAnyUnicodeForMathOnly(QString timesFont, const QString& sansFont, JKQTMathTextFontEncoding encodingTimes=JKQTMathTextFontEncoding::MTFEUnicode, JKQTMathTextFontEncoding encodingSans=JKQTMathTextFontEncoding::MTFEUnicode); + /** \brief sets \a timesFont (with its encoding \a encodingTimes ) for serif-text and \a sansFont (with its encoding \a encodingSans ) for both mathmode fonts only + * + * \see useAnyUnicodeForMathOnly(), useAnyUnicode() + */ + void useAnyUnicodeForTextOnly(QString timesFont, const QString& sansFont, JKQTMathTextFontEncoding encodingTimes=JKQTMathTextFontEncoding::MTFEUnicode, JKQTMathTextFontEncoding encodingSans=JKQTMathTextFontEncoding::MTFEUnicode); @@ -601,8 +627,10 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject { /** \brief font color */ QColor fontColor; - /** \brief base font size in points */ + /** \brief base font size in the units defined in fontSizeUnits \see fontSizeUnits */ double fontSize; + /** \brief unit of fontSize */ + JKQTMathTextEnvironment::FontSizeUnit fontSizeUnits; /** \brief stores information about the different fonts used by LaTeX markup */ diff --git a/lib/jkqtmathtext/jkqtmathtexttools.cpp b/lib/jkqtmathtext/jkqtmathtexttools.cpp index 0e898d6091..061028c10e 100644 --- a/lib/jkqtmathtext/jkqtmathtexttools.cpp +++ b/lib/jkqtmathtext/jkqtmathtexttools.cpp @@ -415,10 +415,28 @@ bool InstructionNameMatchesJKQTMathTextBraceType(const QString &token, JKQTMathT return (bt==type); } +QString JKQTMathTextEnvironment::FontSizeUnit2String(FontSizeUnit unit) +{ + switch(unit) { + case PIXELS: return "pix"; + default: + case POINTS: return "pt"; + } +} + +JKQTMathTextEnvironment::FontSizeUnit JKQTMathTextEnvironment::String2FontSizeUnit(QString unit) +{ + unit=unit.toLower().trimmed(); + if (unit=="pt" || unit=="points" || unit=="point") return POINTS; + if (unit=="pix" || unit=="pixel" || unit=="pixels" || unit=="px") return PIXELS; + return POINTS; +} + JKQTMathTextEnvironment::JKQTMathTextEnvironment() { color=QColor("black"); font=MTEroman; fontSize=10; + fontSizeUnit=POINTS; bold=false; italic=false; smallCaps=false; @@ -489,14 +507,17 @@ QFont JKQTMathTextEnvironment::getFont(JKQTMathText* parent) const { f.setStrikeOut(strike); f.setCapitalization(QFont::MixedCase); if (smallCaps) f.setCapitalization(QFont::SmallCaps); - f.setPointSizeF(fontSize); + if (fontSizeUnit==POINTS) f.setPointSizeF(fontSize); + else if (fontSizeUnit==PIXELS) f.setPixelSize(static_cast(fontSize)); f.setStyleStrategy(QFont::NoFontMerging); return f; } QString JKQTMathTextEnvironment::toHtmlStart(JKQTMathTextEnvironment defaultEv) const { QString s; - s=s+"font-size: "+QLocale::c().toString(fontSize)+"pt; "; + if (fontSizeUnit==POINTS) s=s+"font-size: "+QLocale::c().toString(fontSize)+"pt; "; + else if (fontSizeUnit==PIXELS) s=s+"font-size: "+QLocale::c().toString(fontSize)+"px; "; + if (insideMath) { if (defaultEv.italic) { if (!italic) s=s+"font-style: italic; "; diff --git a/lib/jkqtmathtext/jkqtmathtexttools.h b/lib/jkqtmathtext/jkqtmathtexttools.h index 9248ccc61f..6df4d10a13 100644 --- a/lib/jkqtmathtext/jkqtmathtexttools.h +++ b/lib/jkqtmathtext/jkqtmathtexttools.h @@ -232,6 +232,16 @@ enum JKQTMathTextEnvironmentFont { * \ingroup jkqtmathtext_tools */ struct JKQTMATHTEXT_LIB_EXPORT JKQTMathTextEnvironment { + /** \brief units for the property JKQTMathTextEnvironment::fontSize (Points/PT or Pixels) */ + enum FontSizeUnit { + POINTS, + PIXELS + }; + /** \brief convert a FontSizeUnit to a string \see FontSizeUnit,String2FontSizeUnit() */ + static QString FontSizeUnit2String(FontSizeUnit unit); + /** \brief convert a string into a FontSizeUnit \see FontSizeUnit,FontSizeUnit2String() */ + static FontSizeUnit String2FontSizeUnit(QString unit); + JKQTMathTextEnvironment(); /** \brief current font color */ QColor color; @@ -239,8 +249,11 @@ struct JKQTMATHTEXT_LIB_EXPORT JKQTMathTextEnvironment { JKQTMathTextEnvironmentFont font; /** \brief custom font, when font==MTECustomFont */ QString customFontName; - /** \brief current font size [pt] */ + /** \brief current font size the unit is determined by fontSizeUnit */ double fontSize; + /** \brief the unit of the font size fontSize */ + FontSizeUnit fontSizeUnit; + /** \brief is the text currently bold? */ bool bold; /** \brief is the text currently italic? */ diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp index d535e87d48..e4ac8bc955 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextbracenode.cpp @@ -93,9 +93,9 @@ double JKQTMathTextBraceNode::draw(QPainter& painter, double x, double y, JKQTMa double nodeOverallHeight=0, nodeStrikeoutPos=0; double bracewidth=0, braceheight=0; getSizeInternalAndBrace(painter, currentEv, nodeWidth, nodeBaselineHeight, nodeOverallHeight, nodeStrikeoutPos, bracewidth, braceheight); + const QFontMetricsF fm(currentEv.getFont(parentMathText)); - - const double lw=qMax(0.25,ceil(currentEv.fontSize/16.0));//fm.lineWidth(); + const double lw=qMax(0.25,fm.lineWidth()); double xnew=x; @@ -425,7 +425,8 @@ JKQTMathTextBraceType JKQTMathTextBraceNode::getClosebrace() const { 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)); + const QFontMetricsF fm(ev.getFont(parentMathText)); + const double lw=qMax(0.25,fm.lineWidth()); braceheight=overallHeight*parentMathText->getBraceFactor(); bracewidth=0.6*pow(braceheight, 0.6); if (openbrace==MTBTCurlyBracket || closebrace==MTBTCurlyBracket) bracewidth=qMax(bracewidth, lw*3.5); diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp b/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp index e9dc84e51d..4f7a899744 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp +++ b/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp @@ -111,8 +111,7 @@ double JKQTMathTextWhitespaceNode::draw(QPainter &painter, double x, double y, J void JKQTMathTextWhitespaceNode::getSizeInternal(QPainter &painter, JKQTMathTextEnvironment currentEv, double &width, double &baselineHeight, double &overallHeight, double &strikeoutPos, const JKQTMathTextNodeSize *prevNodeSize) { - const double singelWidthPT=Type2PointWidth(whitespace.type, currentEv); - const double singelWidthPIX=singelWidthPT/72.0*painter.device()->logicalDpiX(); + const double singelWidthPIX=Type2PixelWidth(whitespace.type, currentEv, painter.device()); const QFontMetricsF fm(currentEv.getFont(parentMathText)); width=singelWidthPIX*static_cast(whitespace.count); baselineHeight=0; @@ -127,7 +126,7 @@ void JKQTMathTextWhitespaceNode::fillSupportedInstructions() if (supportedInstructions.size()==0) { supportedInstructions[" "]=WhitespaceProps(WSTthicker, 1); supportedInstructions["nbsp"]=WhitespaceProps(WSTNonbreaking, 1); - supportedInstructions["enspace"]=WhitespaceProps(WST1en, 1); + supportedInstructions["enspace"]=supportedInstructions["enskip"]=WhitespaceProps(WST1en, 1); supportedInstructions["quad"]=supportedInstructions["emspace"]=WhitespaceProps(WSTQuad, 1); supportedInstructions["qquad"]=WhitespaceProps(WSTQuad, 2); supportedInstructions[","]=supportedInstructions["thinspace"]=WhitespaceProps(WSTthin, 1); @@ -159,13 +158,18 @@ QString JKQTMathTextWhitespaceNode::Type2String(Types type) return "???"; } -double JKQTMathTextWhitespaceNode::Type2PointWidth(Types type, JKQTMathTextEnvironment currentEv) const +double JKQTMathTextWhitespaceNode::Type2PixelWidth(Types type, JKQTMathTextEnvironment currentEv, QPaintDevice* pd) const { - const double em=currentEv.fontSize; + const QFontMetricsF fm(currentEv.getFont(parentMathText), pd); +#if QT_VERSION >= QT_VERSION_CHECK(5,11,0) + const double em=fm.horizontalAdvance(QChar(0x2003));//currentEv.fontSize; +#else + const double em=fm.width(QChar(0x2003));//currentEv.fontSize; +#endif const double en=em/2.0; switch (type) { - case WSTNormal: return QFontMetricsF(currentEv.getFont(parentMathText)).width(' '); - case WSTNonbreaking: return QFontMetricsF(currentEv.getFont(parentMathText)).width(' '); + case WSTNormal: return fm.width(' '); + case WSTNonbreaking: return fm.width(' '); case WST1en: return en; case WST1em: return em; case WSThair: return em/12.0; diff --git a/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.h b/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.h index 6b55264770..1080946b6f 100644 --- a/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.h +++ b/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.h @@ -57,8 +57,8 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextWhitespaceNode: public JKQTMathTextNod }; /** \brief converts Types \a type into a string */ static QString Type2String(Types type); - /** \brief converts Types \a type into its width in points (pt), based on \a currentEv */ - double Type2PointWidth(Types type, JKQTMathTextEnvironment currentEv) const; + /** \brief converts Types \a type into its width in pixels, based on \a currentEv and \a pd */ + double Type2PixelWidth(Types type, JKQTMathTextEnvironment currentEv, QPaintDevice *pd) const; /** \brief checks whether a given LaTeX instruction name is supported by this node class type */ static bool supportsInstructionName(const QString& instruction); /** \brief constructs a node with count=1 and type=WSTNormal */