JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
|
this class parses a mathematical markup string and can then draw the contained text/equation onto a QPainter More...
#include <jkqtmathtext.h>
Public Member Functions | |
JKQTMathText (QObject *parent=nullptr, bool useFontsForGUI=false) | |
class constructor with a paren QObject parent and calls useGuiFonts() if useFontsForGUI =true | |
~JKQTMathText () | |
class destructor | |
Determine the Size of the Output | |
QSizeF | getSize (QPainter &painter) |
get the size of the drawn representation. returns an invalid size if no text has been parsed. | |
QSize | getIntSize (QPainter &painter) |
get the rounded (using ceil) to an integer size of the drawn representation. returns QSize(0,0) if no text has been parsed. | |
double | getDescent (QPainter &painter) |
return the descent, i.e. the distance from the baseline to the lowest part of the representation | |
double | getAscent (QPainter &painter) |
return the ascentt, i.e. the distance from the baseline to the highest part of the representation | |
void | getSizeDetail (QPainter &painter, double &width, double &ascent, double &descent, double &strikeoutPos) |
return the detailes sizes of the text | |
JKQTMathTextNodeSize | getSizeDetail (QPainter &painter) |
return the detailes sizes of the text | |
Rendering | |
void | draw (QPainter &painter, QPointF x, bool drawBoxes=false) |
draw a representation to the object at the specified position x , y | |
double | draw (QPainter &painter, double x, double y, bool drawBoxes=false) |
draw a representation to the object at the specified position x , y | |
void | draw (QPainter &painter, unsigned int flags, QRectF rect, bool drawBoxes=false) |
draw into a rectangle rect with alignment defined in flags (see below) | |
QPixmap | drawIntoPixmap (bool drawBoxes=false, QColor backgroundColor=QColor(Qt::white), int sizeincrease=0, qreal devicePixelRatio=1.0) |
render the last parse result into a QPixmap | |
QImage | drawIntoImage (bool drawBoxes=false, QColor backgroundColor=QColor(Qt::white), int sizeincrease=0, qreal devicePixelRatio=1.0, unsigned int resolution_dpi=96) |
render the last parse result into a QImage | |
QPicture | drawIntoPicture (bool drawBoxes=false) |
render the last parse result into a QPicture | |
QString | toHtml (bool *ok=nullptr, double fontPointSize=10) |
convert LaTeX to HTML. returns ok=true on success and ok=false else. | |
(Defining) Rendering Details | |
void | loadSettings (const QSettings &settings, const QString &group=QString("mathtext/")) |
load the object settings from the given QSettings object with the given name prefix | |
void | saveSettings (QSettings &settings, const QString &group=QString("mathtext/")) const |
store the object settings to the given QSettings object with the given name prefix | |
void | setBraceFactor (double __value) |
for \left / \right braces: The brace is this factor higher than the child block it surrounds | |
double | getBraceFactor () const |
for \left / \right braces: The brace is this factor higher than the child block it surrounds | |
void | setSubsuperSizeFactor (double __value) |
resizing factor for font size in sub-/superscript | |
double | getSubsuperSizeFactor () const |
resizing factor for font size in sub-/superscript | |
void | setSubsuperModeSelectionBySizeFactor (double __value) |
this factor is used to determine how to typeset sub-/superscript. | |
double | getSubsuperModeSelectionBySizeFactor () const |
this factor is used to determine how to typeset sub-/superscript. | |
void | setOperatorsubsuperSizeFactor (double __value) |
like subsuper_size_factor, but for operators (\sum , \int , ...) where the text is placed above/below the symbol | |
double | getOperatorsubsuperSizeFactor () const |
like subsuper_size_factor, but for operators (\sum , \int , ...) where the text is placed above/below the symbol | |
void | setOperatorsubsuperDistanceFactor (double __value) |
for operators (\sum , \int , ...) where the text is placed above/below the symbol, this is the distance between the operator symbol and the sub-/super-text if multiplied by xHeight | |
double | getOperatorsubsuperDistanceFactor () const |
for operators (\sum , \int , ...) where the text is placed above/below the symbol, this is the distance between the operator symbol and the sub-/super-text if multiplied by xHeight | |
void | setOperatorsubsuperExtraSpaceFactor (double __value) |
for operators (\sum , \int , ...) where the text is placed above/below the symbol, this is the additional width added to the width of maximum width of the operator, above and below | |
double | getOperatorsubsuperExtraSpaceFactor () const |
for operators (\sum , \int , ...) where the text is placed above/below the symbol, this is the additional width added to the width of maximum width of the operator, above and below | |
void | setMathoperatorWidthFactor (double __value) |
factor, used to extend the size of an operator in math mode | |
double | getMathoperatorWidthFactor () const |
factor, used to extend the size of an operator in math mode | |
void | setIntSubSuperXCorrectionFactor (double __value) |
for integrals (\int , \oint , ...) the sub-/superscripts above/below the symbol have to be shifted a bit to the left/right to accomodate the shape of the operator symbol (i.e. some free space at the top-left and bottom-right) | |
double | getIntSubSuperXCorrectionFactor () const |
for integrals (\int , \oint , ...) the sub-/superscripts above/below the symbol have to be shifted a bit to the left/right to accomodate the shape of the operator symbol (i.e. some free space at the top-left and bottom-right) | |
void | setIntSubBesidesXCorrectionXFactor (double __value) |
for integrals (\int , \oint , ...) the subscripts besides the symbol have to be shifted to the left a bit to the left to accomodate the shape of the operator symbol (i.e. some free space at the bottom-right) | |
double | getIntSubBesidesXCorrectionXFactor () const |
for integrals (\int , \oint , ...) the subscripts besides the symbol have to be shifted to the left a bit to the left to accomodate the shape of the operator symbol (i.e. some free space at the bottom-right) | |
void | setBigMathoperatorFontFactor (double __value) |
factor, used to increase the font size for big math operators, such as \sum , \prod , ... | |
double | getBigMathoperatorFontFactor () const |
factor, used to increase the font size for big math operators, such as \sum , \prod , ... | |
void | setSuperShiftFactor (double __value) |
relative shift of text in superscript to normal text, factor is multiplied by font.xHeight() | |
double | getSuperShiftFactor () const |
relative shift of text in superscript to normal text, factor is multiplied by font.xHeight() | |
void | setSubShiftFactor (double __value) |
relative shift of text in subscript to normal text, factor is multiplied by font.xHeight() | |
double | getSubShiftFactor () const |
relative shift of text in subscript to normal text, factor is multiplied by font.xHeight() | |
void | setSpecialSuperShiftFactor (double __value) |
relative shift of text in superscript to normal text in special superscript mode (after large previous nodes): 0= superscript descent coincides with the previous node's baselineHeight, 1: top of previous node and top of the superscript nodes coincide | |
double | getSpecialSuperShiftFactor () const |
relative shift of text in superscript to normal text in special superscript mode (after large previous nodes): 0= superscript descent coincides with the previous node's baselineHeight, 1: top of previous node and top of the superscript nodes coincide | |
void | setSpecialSubShiftFactor (double __value) |
relative shift of text in subscript to normal text in special superscript mode (after large previous nodes): 0=child's baseline at the descent of the previous node, 1: subscript-node starts at the descent of the previous node | |
double | getSpecialSubShiftFactor () const |
relative shift of text in subscript to normal text in special superscript mode (after large previous nodes): 0=child's baseline at the descent of the previous node, 1: subscript-node starts at the descent of the previous node | |
void | setUnderbraceFactor (double __value) |
scaling factor for font of underbrace/overbrace text | |
double | getUnderbraceFactor () const |
scaling factor for font of underbrace/overbrace text | |
void | setUnderbraceSeparationXFactor (double __value) |
additional space between the main text to the curly brace and the brace to underbrace/overbrace, multiplied with height("x") | |
double | getUnderbraceSeparationXFactor () const |
additional space between the main text to the curly brace and the brace to underbrace/overbrace, multiplied with height("x") | |
void | setUnderbraceBraceSizeXFactor (double __value) |
height of the brace in underbrace/overbrace, multiplied with ascent | |
double | getUnderbraceBraceSizeXFactor () const |
height of the brace in underbrace/overbrace, multiplied with ascent | |
void | setUndersetFactor (double __value) |
scaling factor for font of underset/overset text | |
double | getUndersetFactor () const |
scaling factor for font of underset/overset text | |
void | setFracFactor (double __value) |
scaling factor for font size of nominator and denominator of a fraction | |
double | getFracFactor () const |
scaling factor for font size of nominator and denominator of a fraction | |
void | setFracNestedFactor (double __value) |
scaling factor for font size of nominator and denominator of a nested fraction | |
double | getFracNestedFactor () const |
scaling factor for font size of nominator and denominator of a nested fraction | |
void | setFracShiftFactor (double __value) |
shift of denominator/nummerator away from central line of a frac | |
double | getFracShiftFactor () const |
shift of denominator/nummerator away from central line of a frac | |
void | setBraceYShiftFactor (double __value) |
fraction of the brace ascent that the brace is shifted downwards, when scaled | |
double | getBraceYShiftFactor () const |
fraction of the brace ascent that the brace is shifted downwards, when scaled | |
void | setDecorationHeightFactor (double __value) |
size of the decorations (dot, tilde, ...), as fraction of the ascent | |
double | getDecorationHeightFactor () const |
size of the decorations (dot, tilde, ...), as fraction of the ascent | |
void | setDecorationSeparationXFactor (double __value) |
separation between the text and the decorations (dot, tilde, ...), as fraction of the ascent | |
double | getDecorationSeparationFactor () const |
separation between the text and the decorations (dot, tilde, ...), as fraction of the ascent | |
void | setDecorationWidthReductionFactor (double __value) |
a decoration has a size, which is slightly smaller than the text- width. the width is reduced by decoration_width_reduction_Xfactor*width ("X") and the position is centered around the child-box. Also an italic correction is applied: | |
double | getDecorationWidthReductionXFactor () const |
a decoration has a size, which is slightly smaller than the text- width. the width is reduced by decoration_width_reduction_Xfactor*width ("X") and the position is centered around the child-box. Also an italic correction is applied: | |
void | setSqrtWidthXFactor (double __value) |
width of the sqrt-symbol, as factor to width("X") | |
double | getSqrtWidthXFactor () const |
width of the sqrt-symbol, as factor to width("X") | |
void | setSqrtHeightFactor (double __value) |
height-increase of the sqrt-symbol, as factor of the child's height | |
double | getSqrtHeightFactor () const |
height-increase of the sqrt-symbol, as factor of the child's height | |
void | setSqrtSmallFontFactor (double __value) |
scaling factor for the small font used to indicate the degree of the sqrt | |
double | getSqrtSmallFontFactor () const |
scaling factor for the small font used to indicate the degree of the sqrt | |
double | getMatrixLinewidthThinFactor () |
width of thin table lines, this factor is multiplied with the current font.linewidth() | |
void | setMatrixLinewidthThinFactor (double factor) |
width of thin table lines, this factor is multiplied with the current font.linewidth() | |
double | getMatrixLinewidthHeavyFactor () |
width of heavy table lines, this factor is multiplied with the current font.linewidth() | |
void | setMatrixLinewidthHeavyFactor (double factor) |
width of heavy table lines, this factor is multiplied with the current font.linewidth() | |
double | getMatrixLineSeparationFactor () |
separation of double-lines in tables, this factor is multiplied with the font.linewidth() | |
void | setMatrixLineSeparationFactor (double factor) |
separation of double-lines in tables, this factor is multiplied with the font.linewidth() | |
double | getMatrixXSeparationFactor () |
x-separation of two columns, this factor is multiplied with the font.width ("x") | |
void | setMatrixXSeparationFactor (double factor) |
x-separation of two columns, this factor is multiplied with the font.width ("x") | |
double | getMatrixYSeparationFactor () |
y-separation of two columns, this factor is multiplied with the font.width ("x") | |
void | setMatrixYSeparationFactor (double factor) |
y-separation of two columns, this factor is multiplied with the font.width ("x") | |
double | getMatrixXPaddingFactor () |
x-padding of two columns, this factor is multiplied with the font.width ("x") | |
void | setMatrixXPaddingFactor (double factor) |
x-padding of two columns, this factor is multiplied with the font.width ("x") | |
double | getMatrixYPaddingFactor () |
y-padding of two columns, this factor is multiplied with the font.width ("x") | |
void | setMatrixYPaddingFactor (double factor) |
y-padding of two columns, this factor is multiplied with the font.width ("x") | |
Static Public Attributes | |
static const double | ABS_MIN_LINEWIDTH |
minimum linewidth allowed in a JKQTMathText (given in pt) | |
Protected Member Functions | |
void | deleteParsedNode () |
this function moves a delete parsedNode -call into the cpp-file, as JKQTMathTextNode is "only" forward declared here and therefore, deleting it may cause undefined behaviour | |
void | modifyEnvironmentFromFontSettings (JKQTMathTextEnvironment &ev) const |
sets all properties of JKQTMathTextEnvironment ev from the fon settings stored in this class (e.g. fontSize, fontOptions, ...) | |
Protected Attributes | |
double | bigmathoperator_font_factor |
factor, used to increase the font size for big math operators, such as \sum , \prod , ... | |
JKQTMathTextBlackboradDrawingMode | blackboradFontMode |
specifies how to draw blackboard font characters (i.e. \mathbb{N} ) | |
double | brace_factor |
for \left / \right braces: The brace is this factor higher than the child block it surrounds | |
double | brace_y_shift_factor |
fraction of the brace ascent that the brace is shifted downwards, when scaled | |
double | decoration_height_factor |
size of the decorations (dot, tilde, ...), as fraction of the ascent | |
double | decoration_separation_factor |
separation between the text and the decorations (dot, tilde, ...), as fraction of the ascent | |
double | decoration_width_reduction_Xfactor |
a decoration has a size, which is slightly smaller than the text- width. the width is reduced by decoration_width_reduction_Xfactor*width ("X") and the position is centered around the child-box. Also an italic correction is applied: | |
QColor | fontColor |
font color | |
QHash< JKQTMathTextEnvironmentFont, JKQTMathTextFontDefinition > | fontDefinitions |
stores information about the different fonts used by LaTeX markup | |
QMap< QString, JKQTMathTextFontEncoding > | fontEncodingReplacements |
acompanies fontReplacements and collects the encodings of the replacement fonts, if no entry is present, the default encoding is used, as given to the setter! | |
BaseFontOptions | fontOptions |
additional options for the base fonts | |
QMap< QString, QString > | fontReplacements |
table with font replacements to use (e.g. if it is known that a certain font is not good for rendering, you can add an alternative using addReplacementFont(). These are automatically applied, when setting a new font name! | |
double | fontSize |
base font size in the units defined in fontSizeUnits | |
JKQTMathTextEnvironment::FontSizeUnit | fontSizeUnits |
unit of fontSize | |
double | frac_factor |
scaling factor for font size of nominator and denominator of a fraction | |
double | frac_nested_factor |
scaling factor for font size of nominator and denominator of a nested fraction | |
double | frac_shift_factor |
shift of denominator/nummerator away from central line of a frac | |
double | intsubbesides_xcorrection_xfactor |
for integrals (\int , \oint , ...) the subscripts besides the symbol have to be shifted to the left a bit to the left to accomodate the shape of the operator symbol (i.e. some free space at the bottom-right) | |
double | intsubsuper_xcorrection_factor |
for integrals (\int , \oint , ...) the sub-/superscripts above/below the symbol have to be shifted a bit to the left/right to accomodate the shape of the operator symbol (i.e. some free space at the top-left and bottom-right) | |
double | mathoperator_width_factor |
factor, used to extend the size of an operator in math mode | |
double | matrix_line_separation_factor |
separation of double-lines in tables, this factor is multiplied with the font.linewidth() | |
double | matrix_linewidth_heavy_factor |
width of heavy table lines, this factor is multiplied with the current font.linewidth() | |
double | matrix_linewidth_thin_factor |
width of thin table lines, this factor is multiplied with the current font.linewidth() | |
double | matrix_xPadding_factor |
x-padding of two columns, this factor is multiplied with the font.width ("x") | |
double | matrix_xSeparation_factor |
x-separation of two columns, this factor is multiplied with the font.width ("x") | |
double | matrix_yPadding_factor |
y-padding of two columns, this factor is multiplied with the font.width ("x") | |
double | matrix_ySeparation_factor |
y-separation of two columns, this factor is multiplied with the font.width ("x") | |
double | operatorsubsuper_distance_factor |
for operators (\sum , \int , ...) where the text is placed above/below the symbol, this is the distance between the operator symbol and the sub-/super-text if multiplied by xHeight | |
double | operatorsubsuper_extraspace_factor |
for operators (\sum , \int , ...) where the text is placed above/below the symbol, this is the additional width added to the width of maximum width of the operator, above and below | |
double | operatorsubsuper_size_factor |
like subsuper_size_factor, but for operators (\sum , \int , ...) where the text is placed above/below the symbol | |
JKQTMathTextNode * | parsedNode |
the syntax tree of JKQTMathTextNode's that was created by the last parse() call | |
double | special_sub_shift_factor |
relative shift of text in subscript to normal text in special superscript mode (after large previous nodes): 0=child's baseline at the descent of the previous node, 1: subscript-node starts at the descent of the previous node | |
double | special_super_shift_factor |
relative shift of text in superscript to normal text in special superscript mode (after large previous nodes): 0= superscript descent coincides with the previous node's baselineHeight, 1: top of previous node and top of the superscript nodes coincide | |
double | sqrt_height_factor |
height-increase of the sqrt-symbol, as factor of the child's height | |
double | sqrt_smallfont_factor |
scaling factor for the small font used to indicate the degree of the sqrt | |
double | sqrt_width_Xfactor |
width of the sqrt-symbol, as factor to width("X") | |
double | sub_shift_factor |
relative shift of text in subscript to normal text, factor is multiplied by font.xHeight() | |
double | subsuper_mode_selection_by_size_factor |
this factor is used to determine how to typeset sub-/superscript. | |
double | subsuper_size_factor |
resizing factor for font size in sub-/superscript | |
double | super_shift_factor |
relative shift of text in superscript to normal text, factor is multiplied by font.xHeight() | |
double | underbrace_bracesize_xfactor |
height of the brace in underbrace/overbrace, multiplied with ascent | |
double | underbrace_factor |
scaling factor for font of underbrace/overbrace text | |
double | underbrace_separation_xfactor |
additional space between the main text to the curly brace and the brace to underbrace/overbrace, multiplied with height("x") | |
double | underset_factor |
scaling factor for font of underset/overset text | |
Static Protected Attributes | |
static QString | init_blackboardFont |
initial choice for "blackboard" font | |
static QString | init_caligraphicFont |
initial choice for "caligraphic" font | |
static QString | init_fracturFont |
initial choice for "fraktur" font | |
static QString | init_sansFont |
initial choice for "sans-erif" font | |
static QString | init_scriptFont |
initial choice for "script" font | |
static QString | init_serifFont |
initial choice for "serif" font | |
static QString | init_symbolFont |
initial choice for "fallback symbol" font | |
static QString | init_typewriterFont |
initial choice for "typewriter" font | |
static bool | s_firstStart |
used to check for the first construction of a JKQTMathText ... if true several static variables are initialized in the constructor | |
static std::mutex | s_mutex |
mutex to protect the static members | |
Friends | |
class | JKQTMathTextNode |
class | JKQTMathTextParser |
Parsing Math Markup | |
enum | ParseOption { AddSpaceBeforeAndAfter = 0x01 , StartWithMathMode = 0x02 , AllowLinebreaks = 0x04 , DefaultParseOptions =AllowLinebreaks } |
options for parse() More... | |
enum | DefaultParserTypes { LatexParser , DefaultParser =LatexParser } |
lists the parser classes that are available by default (convenience interface to the templated parse()-funktion More... | |
typedef QFlags< ParseOption > | ParseOptions |
bool | parse (const QString &markup, DefaultParserTypes markupType=DefaultParser, ParseOptions options=DefaultParseOptions) |
parse the given math markup string with a parser derived from markupType. | |
template<class TParser > | |
bool | parse (const QString &markup, ParseOptions options=DefaultParseOptions) |
parse the given math markup string, using the given parser class TParser | |
JKQTMathTextNode * | getNodeTree () |
returns the syntax tree of JKQTMathTextNode's that was created by the last parse() call | |
const JKQTMathTextNode * | getNodeTree () const |
the syntax tree of JKQTMathTextNode's that was created by the last parse() call | |
Font Handling | |
enum | BaseFontOption { BaseFontBold = 0x01 , BaseFontItalic = 0x02 , BaseFontUnderlined = 0x04 , BaseFontSmallCaps = 0x08 , BaseFontDefault =0x00 } |
options for the base font More... | |
typedef QFlags< BaseFontOption > | BaseFontOptions |
void | setFontColor (const QColor &__value) |
font color | |
QColor | getFontColor () const |
font color | |
void | setFontSize (double __value) |
set the default font size in points | |
void | setFontPointSize (double __value) |
set the default font size in points | |
void | setFontSizePixels (double __value) |
set the default font soze in pixels | |
double | getFontPointSize () const |
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() | |
double | getFontSize () const |
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() | |
double | getFontSizePixels () const |
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() | |
void | setFontOptions (BaseFontOptions opts) |
set (overwrite) the options applied to the base font | |
void | setFontOption (BaseFontOption opt, bool enabled=true) |
en/disable the given base font option | |
BaseFontOptions | getFontOptions () const |
returns the options applied to the base font | |
void | addReplacementFont (const QString &nonUseFont, const QString &useFont) |
add a font pair to the table with font replacements | |
void | addReplacementFont (const QString &nonUseFont, const QString &useFont, JKQTMathTextFontEncoding useFontEncoding) |
add a font pair to the table with font replacements | |
QPair< QString, JKQTMathTextFontEncoding > | getReplacementFont (const QString &nonUseFont, const QString &defaultFont, JKQTMathTextFontEncoding defaultFontEncoding) const |
retrieves a replacement for the given font name nonUseFont, including its encoding. Returns the given default values defaultFont and/or defaultFontEncoding if one of the two is not found | |
QPair< QString, JKQTMathTextFontEncoding > | getFontData (JKQTMathTextEnvironmentFont font, bool in_math_environment=false) const |
retrieve the font and encoding to be used for font, which might optionally be typeset inside a math environment, specified by in_math_environment, possibly for the given font subclass subclass | |
void | setFontRomanOrSpecial (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font by parsing a special syntax defined in the description of JKQTMathTextFontSpecifier | |
void | setFontRomanOrSpecial (const JKQTMathTextFontSpecifier &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font by an instance of JKQTMathTextFontSpecifier | |
void | setFontSpecial (const QString &fontSpec) |
set font(s) from parsing a font specifier | |
void | setFontRoman (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEroman | |
void | setFontRomanAndMath (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text and math, i.e. the logical font MTEroman and MTEmathRoman | |
QString | getFontRoman () const |
retrieves the font to be used for text in the logical font MTEroman | |
void | setFontSans (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEsans | |
QString | getFontSans () const |
retrieves the font to be used for text in the logical font MTEsans | |
void | setFontTypewriter (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEtypewriter | |
QString | getFontTypewriter () const |
retrieves the font to be used for text in the logical font MTEtypewriter | |
void | setFontScript (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEscript | |
QString | getFontScript () const |
retrieves the font to be used for text in the logical font MTEscript | |
void | setFontFraktur (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEfraktur | |
QString | getFontFraktur () const |
retrieves the font to be used for text in the logical font MTEfraktur | |
void | setFontCaligraphic (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEcaligraphic | |
QString | getFontCaligraphic () const |
retrieves the font to be used for text in the logical font MTEcaligraphic | |
void | setFontBlackboard (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEblackboard | |
JKQTMathTextBlackboradDrawingMode | getFontBlackboradMode () const |
specifies how to draw blackboard font characters (i.e. \mathbb{N} ) | |
void | setFontBlackboradMode (JKQTMathTextBlackboradDrawingMode mode) |
specifies how to draw blackboard font characters (i.e. \mathbb{N} ) | |
QString | getFontBlackboard () const |
retrieves the font to be used for text in the logical font MTEblackboard | |
void | setFallbackFontSymbols (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for symbols in the logical font font | |
QString | getFallbackFontSymbols () const |
retrieves the font to be used for symbols in the logical font font | |
JKQTMathTextFontEncoding | getFontEncodingFallbackFontSymbols () const |
retrieves the encoding used for the symbol font to be used for symbols | |
JKQTMathTextFontEncoding | getFontEncodingScript () const |
retrieves the encoding used for the script font | |
JKQTMathTextFontEncoding | getFontEncodingFraktur () const |
retrieves the encoding used for the Fraktur font | |
JKQTMathTextFontEncoding | getFontEncodingTypewriter () const |
retrieves the encoding used for the typewriter font | |
JKQTMathTextFontEncoding | getFontEncodingSans () const |
retrieves the encoding used for the sans-serif font | |
JKQTMathTextFontEncoding | getFontEncodingRoman () const |
retrieves the encoding used for the roman font | |
JKQTMathTextFontEncoding | getFontEncodingBlackboard () const |
retrieves the encoding used for the blackboard font | |
JKQTMathTextFontEncoding | getFontEncodingCaligraphic () const |
retrieves the encoding used for the caligraphic font | |
void | setFontMathRoman (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEmathRoman | |
QString | getFontMathRoman () const |
retrieves the font to be used for text in the logical font MTEroman | |
void | setFontMathSans (const QString &fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEmathSans | |
QString | getFontMathSans () const |
retrieves the font to be used for text in the logical font MTEsans | |
JKQTMathTextFontEncoding | getFontEncodingMathSans () const |
retrieves the encoding used for the math-mode sans-serif font | |
JKQTMathTextFontEncoding | getFontEncodingMathRoman () const |
retrieves the encoding used for the math-mode roman font | |
bool | useSTIX (bool mathModeOnly=true, bool useAsFallbackSymbol=true) |
configures the class to use the STIX fonts in mathmode | |
bool | useXITS (bool mathModeOnly=true, bool useAsFallbackSymbol=true) |
configures the class to use the XITS fonts in mathmode | |
bool | useFiraMath (bool mathModeOnly=true, bool useAsFallbackSymbol=true) |
configures the class to use the Fira Math fonts in mathmode | |
bool | useASANA (bool mathModeOnly=true, bool useAsFallbackSymbol=true) |
configures the class to use the ASANA fonts in mathmode | |
bool | useGuiFonts () |
configures the class to be used for GUI output, i.e. tries to find fonts that are harmonious for the default GUI font, sets the default GUI font for "roman" and finds an oppposite font for "sans", which means that "sans" may actually be a serif font,when the app font is sans serif! | |
void | useAnyUnicode (QString timesFont, const QString &sansFont, JKQTMathTextFontEncoding encodingTimes=JKQTMathTextFontEncoding::MTFEUnicode, JKQTMathTextFontEncoding encodingSans=JKQTMathTextFontEncoding::MTFEUnicode) |
sets timesFont (with its encoding encodingTimes ) for serif-text and sansFont (with its encoding encodingSans ) for both mathmode and textmode fonts | |
void | useAnyUnicodeForMathOnly (QString timesFont, const QString &sansFont, JKQTMathTextFontEncoding encodingTimes=JKQTMathTextFontEncoding::MTFEUnicode, JKQTMathTextFontEncoding encodingSans=JKQTMathTextFontEncoding::MTFEUnicode) |
sets timesFont (with its encoding encodingTimes ) for serif-text and sansFont (with its encoding encodingSans ) for mathmode fonts only | |
void | useAnyUnicodeForTextOnly (QString timesFont, const QString &sansFont, JKQTMathTextFontEncoding encodingTimes=JKQTMathTextFontEncoding::MTFEUnicode, JKQTMathTextFontEncoding encodingSans=JKQTMathTextFontEncoding::MTFEUnicode) |
sets timesFont (with its encoding encodingTimes ) for serif-text and sansFont (with its encoding encodingSans ) for both mathmode fonts only | |
static QString | BaseFontOptions2String (BaseFontOptions opt) |
convert BaseFontOptions to a string (e.g. BOLD+ITALIC | |
static BaseFontOptions | String2BaseFontOptions (const QString &s) |
convert a string (generated by BaseFontOptions2String() to BaseFontOptions | |
Error Handling | |
QStringList | error_list |
a list that will be filled with error messages while parsing, if any error occur | |
QStringList | getErrorList () const |
a list that will be filled with error messages while parsing, if any error occur | |
bool | hadErrors () const |
returns true when errors were registered in the system | |
void | addToErrorList (const QString &error) |
a list that will be filled with error messages while parsing, if any error occur | |
void | clearErrorList () |
clears all registered errors (see error_list) | |
this class parses a mathematical markup string and can then draw the contained text/equation onto a QPainter
JKQTMathText is a self-contained mathematical markup renderer for Qt. It is used to renderer labels in JKQTPlotter/JKQTBasePlotter, but can be used independently. The class does not depend on any library, except Qt.
The implementation is split over several classes:
In particular JKQTMathTextLatexParser actually parses e.g. a LaTeX string and draws it in pure C++. It does NOT rely on an installed LaTeX for the rendering! See Supported LaTeX-Subset for a description of the supported LaTeX subset.
More generally these pages describe how the class renders math markup:
All functions in this class are reentrant. Therefore different instances off JKQTMathtext can be used in parallel in different threads. DO NOT however use the same instance from multiple threads, as the functions are not thread-safe!
Also note that there are certain caches that reuse information (e.g. about fonts) from previous runs, which allow different instances (also over different threads) to profit from each other. On the other hand, this strategy requires a bit of overhead due to synchronization, but usually the speedup outweighs the overhead significantly!
The class provieds two flavours of a parsing function:
parse(markup, markupType)
that accepts the markup, the type of markup (as enum DefaultParserTypes) and parser options. This function determines the appropriate parser class, based on the markup type.The class provides different variants of the drawing function draw() that paints using an externlly provided QPainter. These variants either paint into a QRect, or starting from a single location (x,y).
The QRect-variants can align the render result inside the rectangle, whereas the location-variants draw from a position that is on the left-hand side of the output's baseline:
Note that you first need to call one of the Parsing Functions so there is anything to render!
Alternatively you can use these methods to directly generate a QPixmap or QPicture:
In addition there are also functions that allow to calculate the size of the equation, before drawing it (just like the functions in QFontMetrics or QFontMetricsF):
Finally, there is also a QLabel-derived class JKQTMathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
The class is designed to be as robust as possible and will still return some output, even if the equation contains some errors. Nevertheless, several errors are detected while parsing. You can get a list of error messages using getErrorList() after calling parse(). Also parse() will return false
if an error occured while parsing.
This small piece of C++ code may serve as an example of the usage and capabilities of the class:
Alternatively you can also use this class with a QPainter:
The method toHtml() may be used to get a HTML representation of the LaTeX string, if possible (only for simple LaTeX equations!). Whether the transformation was possible is returned as a call by value argument!
Examples for the usage of this class can be found here:
typedef QFlags< BaseFontOption > JKQTMathText::BaseFontOptions |
typedef QFlags< ParseOption > JKQTMathText::ParseOptions |
options for the base font
lists the parser classes that are available by default (convenience interface to the templated parse()-funktion
Enumerator | |
---|---|
LatexParser | use the LaTeX parser from JKQTMathTextLatexParser |
DefaultParser |
options for parse()
JKQTMathText::JKQTMathText | ( | QObject * | parent = nullptr , |
bool | useFontsForGUI = false |
||
) |
class constructor with a paren QObject parent and calls useGuiFonts() if useFontsForGUI =true
JKQTMathText::~JKQTMathText | ( | ) |
class destructor
void JKQTMathText::addReplacementFont | ( | const QString & | nonUseFont, |
const QString & | useFont | ||
) |
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. These are automatically applied, when setting a new font name!
nonUseFont | the font not to use |
useFont | replacement font for nonUseFont |
The entry in the encodings for this font is kept empty (or even deleted), so the default encoding of the font to be replaced is used!
void JKQTMathText::addReplacementFont | ( | const QString & | nonUseFont, |
const QString & | useFont, | ||
JKQTMathTextFontEncoding | useFontEncoding | ||
) |
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. These are automatically applied, when setting a new font name!
nonUseFont | the font not to use |
useFont | replacement font for nonUseFont |
useFontEncoding | encoding of the replacement font |
|
protected |
a list that will be filled with error messages while parsing, if any error occur
This list of errors is (mostly) filled during a call to parse(). During rendering (e.g. with draw() ) only very few errors will be detected, as most errors are caused by wrong markup.
A call to parse() also clears this list.
|
static |
convert BaseFontOptions to a string (e.g. BOLD+ITALIC
|
protected |
clears all registered errors (see error_list)
|
protected |
this function moves a delete parsedNode
-call into the cpp-file, as JKQTMathTextNode is "only" forward declared here and therefore, deleting it may cause undefined behaviour
double JKQTMathText::draw | ( | QPainter & | painter, |
double | x, | ||
double | y, | ||
bool | drawBoxes = false |
||
) |
draw a representation to the object at the specified position x , y
painter | the QPainter to use for drawing |
x | x-position of the left border of the text/expression to be drawn (see sketch below) |
y | y-position of the baseline of the text/expression to be drawn (see sketch below) |
drawBoxes | if true boxes defining the size of each node are drawn, example output: |
Here is an illustration of the geometry of the drawn text/expression:
void JKQTMathText::draw | ( | QPainter & | painter, |
QPointF | x, | ||
bool | drawBoxes = false |
||
) |
draw a representation to the object at the specified position x , y
painter | the QPainter to use for drawing |
x | position of the left border of the text/expression to be drawn (see sketch below) |
drawBoxes | if true boxes defining the size of each node are drawn, example output: |
Here is an illustration of the geometry of the drawn text/expression:
void JKQTMathText::draw | ( | QPainter & | painter, |
unsigned int | flags, | ||
QRectF | rect, | ||
bool | drawBoxes = false |
||
) |
draw into a rectangle rect with alignment defined in flags (see below)
painter | the QPainter to use for drawing |
rect | rectangle to draw the text/expression into (see sketch below) |
flags | alignment within rect (see below), use e.g. Qt::AlignHCenter | Qt::AlignVCenter to center the expression inside rect The flags (dark-red is the rectangle rect) are interpreted in the following way: |
drawBoxes | if true boxes defining the size of each node are drawn, example output: |
QImage JKQTMathText::drawIntoImage | ( | bool | drawBoxes = false , |
QColor | backgroundColor = QColor(Qt::white) , |
||
int | sizeincrease = 0 , |
||
qreal | devicePixelRatio = 1.0 , |
||
unsigned int | resolution_dpi = 96 |
||
) |
render the last parse result into a QImage
drawBoxes | if true boxes defining the size of each node are drawn, example output: |
backgroundColor | fill color for the returnes QPixmap |
sizeincrease | margin around the tight size of the rendering result for the returned QPixmap |
devicePixelRatio | the devicePixelRatio of the returned QImage |
resolution_dpi | resolution in dots/inch |
QPicture JKQTMathText::drawIntoPicture | ( | bool | drawBoxes = false | ) |
render the last parse result into a QPicture
drawBoxes | if true boxes defining the size of each node are drawn, example output: |
QPixmap JKQTMathText::drawIntoPixmap | ( | bool | drawBoxes = false , |
QColor | backgroundColor = QColor(Qt::white) , |
||
int | sizeincrease = 0 , |
||
qreal | devicePixelRatio = 1.0 |
||
) |
render the last parse result into a QPixmap
drawBoxes | if true boxes defining the size of each node are drawn, example output: |
backgroundColor | fill color for the returnes QPixmap |
sizeincrease | margin around the tight size of the rendering result for the returned QPixmap |
devicePixelRatio | the devicePixelRatio of the returned QPixmap |
double JKQTMathText::getAscent | ( | QPainter & | painter | ) |
return the ascentt, i.e. the distance from the baseline to the highest part of the representation
double JKQTMathText::getBigMathoperatorFontFactor | ( | ) | const |
factor, used to increase the font size for big math operators, such as \sum
, \prod
, ...
double JKQTMathText::getBraceFactor | ( | ) | const |
for \left
/ \right
braces: The brace is this factor higher than the child block it surrounds
double JKQTMathText::getBraceYShiftFactor | ( | ) | const |
fraction of the brace ascent that the brace is shifted downwards, when scaled
double JKQTMathText::getDecorationHeightFactor | ( | ) | const |
size of the decorations (dot, tilde, ...), as fraction of the ascent
double JKQTMathText::getDecorationSeparationFactor | ( | ) | const |
separation between the text and the decorations (dot, tilde, ...), as fraction of the ascent
double JKQTMathText::getDecorationWidthReductionXFactor | ( | ) | const |
a decoration has a size, which is slightly smaller than the text- width. the width is reduced by decoration_width_reduction_Xfactor*width
("X") and the position is centered around the child-box. Also an italic correction is applied:
double JKQTMathText::getDescent | ( | QPainter & | painter | ) |
return the descent, i.e. the distance from the baseline to the lowest part of the representation
QStringList JKQTMathText::getErrorList | ( | ) | const |
a list that will be filled with error messages while parsing, if any error occur
This list of errors is (mostly) filled during a call to parse(). During rendering (e.g. with draw() ) only very few errors will be detected, as most errors are caused by wrong markup.
A call to parse() also clears this list.
QString JKQTMathText::getFallbackFontSymbols | ( | ) | const |
retrieves the font to be used for symbols in the logical font font
QString JKQTMathText::getFontBlackboard | ( | ) | const |
retrieves the font to be used for text in the logical font MTEblackboard
JKQTMathTextBlackboradDrawingMode JKQTMathText::getFontBlackboradMode | ( | ) | const |
specifies how to draw blackboard font characters (i.e. \mathbb{N}
)
Blackboard fonts are not widely available on target systems (viable fonts are e.g. "Double Stroke", "CloisterOpenFace BT", "GoudyHandtooled BT", "Castellar", "MathJax_AMS", "Castellar Standard", "MathJax_AMS Standard", "Colonna MT"
). But the most important blackboard characters are usually available in the higher unicode codepoints of Fonts specialized for math (e.g. XIST, STIX, ASANA).
Therefore JKQTMathText supports using these characters, or simulating a blackboard font in addition to using one of the fonts above. You can set that by setting JKQTMathText::setFontBlackboradMode() with one of the options from JKQTMathTextBlackboradDrawingMode:
QString JKQTMathText::getFontCaligraphic | ( | ) | const |
retrieves the font to be used for text in the logical font MTEcaligraphic
QColor JKQTMathText::getFontColor | ( | ) | const |
font color
QPair< QString, JKQTMathTextFontEncoding > JKQTMathText::getFontData | ( | JKQTMathTextEnvironmentFont | font, |
bool | in_math_environment = false |
||
) | const |
retrieve the font and encoding to be used for font, which might optionally be typeset inside a math environment, specified by in_math_environment, possibly for the given font subclass subclass
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingBlackboard | ( | ) | const |
retrieves the encoding used for the blackboard font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingCaligraphic | ( | ) | const |
retrieves the encoding used for the caligraphic font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingFallbackFontSymbols | ( | ) | const |
retrieves the encoding used for the symbol font to be used for symbols
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingFraktur | ( | ) | const |
retrieves the encoding used for the Fraktur font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingMathRoman | ( | ) | const |
retrieves the encoding used for the math-mode roman font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingMathSans | ( | ) | const |
retrieves the encoding used for the math-mode sans-serif font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingRoman | ( | ) | const |
retrieves the encoding used for the roman font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingSans | ( | ) | const |
retrieves the encoding used for the sans-serif font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingScript | ( | ) | const |
retrieves the encoding used for the script font
JKQTMathTextFontEncoding JKQTMathText::getFontEncodingTypewriter | ( | ) | const |
retrieves the encoding used for the typewriter font
QString JKQTMathText::getFontFraktur | ( | ) | const |
retrieves the font to be used for text in the logical font MTEfraktur
QString JKQTMathText::getFontMathRoman | ( | ) | const |
retrieves the font to be used for text in the logical font MTEroman
QString JKQTMathText::getFontMathSans | ( | ) | const |
retrieves the font to be used for text in the logical font MTEsans
BaseFontOptions JKQTMathText::getFontOptions | ( | ) | const |
returns the options applied to the base font
double JKQTMathText::getFontPointSize | ( | ) | const |
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()
QString JKQTMathText::getFontRoman | ( | ) | const |
retrieves the font to be used for text in the logical font MTEroman
QString JKQTMathText::getFontSans | ( | ) | const |
retrieves the font to be used for text in the logical font MTEsans
QString JKQTMathText::getFontScript | ( | ) | const |
retrieves the font to be used for text in the logical font MTEscript
double JKQTMathText::getFontSize | ( | ) | const |
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()
double JKQTMathText::getFontSizePixels | ( | ) | const |
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()
QString JKQTMathText::getFontTypewriter | ( | ) | const |
retrieves the font to be used for text in the logical font MTEtypewriter
double JKQTMathText::getFracFactor | ( | ) | const |
scaling factor for font size of nominator and denominator of a fraction
double JKQTMathText::getFracNestedFactor | ( | ) | const |
scaling factor for font size of nominator and denominator of a nested fraction
double JKQTMathText::getFracShiftFactor | ( | ) | const |
shift of denominator/nummerator away from central line of a frac
QSize JKQTMathText::getIntSize | ( | QPainter & | painter | ) |
get the rounded (using ceil) to an integer size of the drawn representation. returns QSize(0,0)
if no text has been parsed.
double JKQTMathText::getIntSubBesidesXCorrectionXFactor | ( | ) | const |
for integrals (\int
, \oint
, ...) the subscripts besides the symbol have to be shifted to the left a bit to the left to accomodate the shape of the operator symbol (i.e. some free space at the bottom-right)
This factor is multiplied by the width of an x: xshift=intsubbesides_xcorrection_xfactor*xWidth Then the subscript besides the symbol is shifted by xshift to the left
This correction is applied to \int, \iint, \iiint, \oint, ...
double JKQTMathText::getIntSubSuperXCorrectionFactor | ( | ) | const |
for integrals (\int
, \oint
, ...) the sub-/superscripts above/below the symbol have to be shifted a bit to the left/right to accomodate the shape of the operator symbol (i.e. some free space at the top-left and bottom-right)
This factor is multiplied by the symbol width: xshift=intsubsuper_xcorrection_factor*symbolWidth Then the subscript below is placed at centerx(symbol)-xshift and the superscript at centerx(symbol)+shiftx. This is also used to correct a subset next to the symbol by shifting it to rightx(symbol)-xshift.
This correction is applied to \int, \iint, \iiint, \oint, ...
double JKQTMathText::getMathoperatorWidthFactor | ( | ) | const |
factor, used to extend the size of an operator in math mode
The next image demonstrates the effect of this property, which adds extra space around certain math operators in math mode:
double JKQTMathText::getMatrixLineSeparationFactor | ( | ) |
separation of double-lines in tables, this factor is multiplied with the font.linewidth()
double JKQTMathText::getMatrixLinewidthHeavyFactor | ( | ) |
width of heavy table lines, this factor is multiplied with the current font.linewidth()
double JKQTMathText::getMatrixLinewidthThinFactor | ( | ) |
width of thin table lines, this factor is multiplied with the current font.linewidth()
double JKQTMathText::getMatrixXPaddingFactor | ( | ) |
x-padding of two columns, this factor is multiplied with the font.width
("x")
double JKQTMathText::getMatrixXSeparationFactor | ( | ) |
x-separation of two columns, this factor is multiplied with the font.width
("x")
double JKQTMathText::getMatrixYPaddingFactor | ( | ) |
y-padding of two columns, this factor is multiplied with the font.width
("x")
double JKQTMathText::getMatrixYSeparationFactor | ( | ) |
y-separation of two columns, this factor is multiplied with the font.width
("x")
JKQTMathTextNode * JKQTMathText::getNodeTree | ( | ) |
returns the syntax tree of JKQTMathTextNode's that was created by the last parse() call
const JKQTMathTextNode * JKQTMathText::getNodeTree | ( | ) | const |
the syntax tree of JKQTMathTextNode's that was created by the last parse() call
double JKQTMathText::getOperatorsubsuperDistanceFactor | ( | ) | const |
for operators (\sum
, \int
, ...) where the text is placed above/below the symbol, this is the distance between the operator symbol and the sub-/super-text if multiplied by xHeight
double JKQTMathText::getOperatorsubsuperExtraSpaceFactor | ( | ) | const |
for operators (\sum
, \int
, ...) where the text is placed above/below the symbol, this is the additional width added to the width of maximum width of the operator, above and below
double JKQTMathText::getOperatorsubsuperSizeFactor | ( | ) | const |
like subsuper_size_factor, but for operators (\sum
, \int
, ...) where the text is placed above/below the symbol
QPair< QString, JKQTMathTextFontEncoding > JKQTMathText::getReplacementFont | ( | const QString & | nonUseFont, |
const QString & | defaultFont, | ||
JKQTMathTextFontEncoding | defaultFontEncoding | ||
) | const |
retrieves a replacement for the given font name nonUseFont, including its encoding. Returns the given default values defaultFont and/or defaultFontEncoding if one of the two is not found
QSizeF JKQTMathText::getSize | ( | QPainter & | painter | ) |
get the size of the drawn representation. returns an invalid size if no text has been parsed.
JKQTMathTextNodeSize JKQTMathText::getSizeDetail | ( | QPainter & | painter | ) |
return the detailes sizes of the text
void JKQTMathText::getSizeDetail | ( | QPainter & | painter, |
double & | width, | ||
double & | ascent, | ||
double & | descent, | ||
double & | strikeoutPos | ||
) |
return the detailes sizes of the text
double JKQTMathText::getSpecialSubShiftFactor | ( | ) | const |
relative shift of text in subscript to normal text in special superscript mode (after large previous nodes): 0=child's baseline at the descent of the previous node, 1: subscript-node starts at the descent of the previous node
double JKQTMathText::getSpecialSuperShiftFactor | ( | ) | const |
relative shift of text in superscript to normal text in special superscript mode (after large previous nodes): 0= superscript descent coincides with the previous node's baselineHeight, 1: top of previous node and top of the superscript nodes coincide
double JKQTMathText::getSqrtHeightFactor | ( | ) | const |
height-increase of the sqrt-symbol, as factor of the child's height
double JKQTMathText::getSqrtSmallFontFactor | ( | ) | const |
scaling factor for the small font used to indicate the degree of the sqrt
double JKQTMathText::getSqrtWidthXFactor | ( | ) | const |
width of the sqrt-symbol, as factor to width("X")
double JKQTMathText::getSubShiftFactor | ( | ) | const |
relative shift of text in subscript to normal text, factor is multiplied by font.xHeight()
double JKQTMathText::getSubsuperModeSelectionBySizeFactor | ( | ) | const |
this factor is used to determine how to typeset sub-/superscript.
If the ascent for superscript of descent for subscript of the previous character is >=subsuper_mode_selection_by_size_factor*ascent
(currentFont) or <=subsuper_mode_selection_by_size_factor*descent
(currentFont) respectively, the sub/superscript is typeset, aligned with the ascent or descent of the previous character. Otherwise it is aligned with the default method:
Default mode:
Special mode:
This method fixes problems with characters that are significantyl larger that normal text character of the fonst, such as generated by \sum
,\int,... .
double JKQTMathText::getSubsuperSizeFactor | ( | ) | const |
resizing factor for font size in sub-/superscript
double JKQTMathText::getSuperShiftFactor | ( | ) | const |
relative shift of text in superscript to normal text, factor is multiplied by font.xHeight()
double JKQTMathText::getUnderbraceBraceSizeXFactor | ( | ) | const |
height of the brace in underbrace/overbrace, multiplied with ascent
double JKQTMathText::getUnderbraceFactor | ( | ) | const |
scaling factor for font of underbrace/overbrace text
double JKQTMathText::getUnderbraceSeparationXFactor | ( | ) | const |
additional space between the main text to the curly brace and the brace to underbrace/overbrace, multiplied with height("x")
double JKQTMathText::getUndersetFactor | ( | ) | const |
scaling factor for font of underset/overset text
bool JKQTMathText::hadErrors | ( | ) | const |
returns true
when errors were registered in the system
void JKQTMathText::loadSettings | ( | const QSettings & | settings, |
const QString & | group = QString("mathtext/") |
||
) |
load the object settings from the given QSettings object with the given name prefix
|
protected |
sets all properties of JKQTMathTextEnvironment ev from the fon settings stored in this class (e.g. fontSize, fontOptions, ...)
bool JKQTMathText::parse | ( | const QString & | markup, |
DefaultParserTypes | markupType = DefaultParser , |
||
ParseOptions | options = DefaultParseOptions |
||
) |
parse the given math markup string with a parser derived from markupType.
markup | the string of math markup |
markupType | defines the language the markup is written in (and is used to derive the parser to use) |
options | Options for parsing, |
true
on success.
|
inline |
parse the given math markup string, using the given parser class TParser
TParser | the parser (deived from JKQTMathTextParser) to be used |
markup | the string of math markup |
options | Options for parsing, |
true
on success. void JKQTMathText::saveSettings | ( | QSettings & | settings, |
const QString & | group = QString("mathtext/") |
||
) | const |
store the object settings to the given QSettings object with the given name prefix
void JKQTMathText::setBigMathoperatorFontFactor | ( | double | __value | ) |
factor, used to increase the font size for big math operators, such as \sum
, \prod
, ...
void JKQTMathText::setBraceFactor | ( | double | __value | ) |
for \left
/ \right
braces: The brace is this factor higher than the child block it surrounds
void JKQTMathText::setBraceYShiftFactor | ( | double | __value | ) |
fraction of the brace ascent that the brace is shifted downwards, when scaled
void JKQTMathText::setDecorationHeightFactor | ( | double | __value | ) |
size of the decorations (dot, tilde, ...), as fraction of the ascent
void JKQTMathText::setDecorationSeparationXFactor | ( | double | __value | ) |
separation between the text and the decorations (dot, tilde, ...), as fraction of the ascent
void JKQTMathText::setDecorationWidthReductionFactor | ( | double | __value | ) |
a decoration has a size, which is slightly smaller than the text- width. the width is reduced by decoration_width_reduction_Xfactor*width
("X") and the position is centered around the child-box. Also an italic correction is applied:
void JKQTMathText::setFallbackFontSymbols | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for symbols in the logical font font
void JKQTMathText::setFontBlackboard | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEblackboard
void JKQTMathText::setFontBlackboradMode | ( | JKQTMathTextBlackboradDrawingMode | mode | ) |
specifies how to draw blackboard font characters (i.e. \mathbb{N}
)
Blackboard fonts are not widely available on target systems (viable fonts are e.g. "Double Stroke", "CloisterOpenFace BT", "GoudyHandtooled BT", "Castellar", "MathJax_AMS", "Castellar Standard", "MathJax_AMS Standard", "Colonna MT"
). But the most important blackboard characters are usually available in the higher unicode codepoints of Fonts specialized for math (e.g. XIST, STIX, ASANA).
Therefore JKQTMathText supports using these characters, or simulating a blackboard font in addition to using one of the fonts above. You can set that by setting JKQTMathText::setFontBlackboradMode() with one of the options from JKQTMathTextBlackboradDrawingMode:
void JKQTMathText::setFontCaligraphic | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEcaligraphic
void JKQTMathText::setFontColor | ( | const QColor & | __value | ) |
font color
void JKQTMathText::setFontFraktur | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEfraktur
void JKQTMathText::setFontMathRoman | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEmathRoman
void JKQTMathText::setFontMathSans | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEmathSans
void JKQTMathText::setFontOption | ( | BaseFontOption | opt, |
bool | enabled = true |
||
) |
en/disable the given base font option
void JKQTMathText::setFontOptions | ( | BaseFontOptions | opts | ) |
set (overwrite) the options applied to the base font
void JKQTMathText::setFontPointSize | ( | double | __value | ) |
set the default font size in points
void JKQTMathText::setFontRoman | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEroman
void JKQTMathText::setFontRomanAndMath | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text and math, i.e. the logical font MTEroman and MTEmathRoman
void JKQTMathText::setFontRomanOrSpecial | ( | const JKQTMathTextFontSpecifier & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font by an instance of JKQTMathTextFontSpecifier
This allows to set the text-mode and math-mode roman fonts.
void JKQTMathText::setFontRomanOrSpecial | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font by parsing a special syntax defined in the description of JKQTMathTextFontSpecifier
This allows to set the text-mode and math-mode roman fonts.
void JKQTMathText::setFontSans | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEsans
void JKQTMathText::setFontScript | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEscript
void JKQTMathText::setFontSize | ( | double | __value | ) |
set the default font size in points
void JKQTMathText::setFontSizePixels | ( | double | __value | ) |
set the default font soze in pixels
void JKQTMathText::setFontSpecial | ( | const QString & | fontSpec | ) |
set font(s) from parsing a font specifier
This function understands a font-specifier in the following forms:
fontRoman
- set "roman" and "math-roman" to fontRoman "sans"/"math-sans" are reset to the default, when constructing the objectfontRoman/fontSans
- set "roman" and "math-roman" to fontRoman and "sans" and "math-sans" to fontSansfontRoman/fontSans/fontMathRoman/fontMathSans
- sets all four majpr fonts+XITS
use XITS for math/symbols, calls useXITS()+ASANA
use ASANA for math/symbols, calls useASANA()+STIX
use STIX for math/symbols, calls useSTIX()+FIRA
use Fira Math for math/symbols, calls useFiraMath()+BOLD
make font initially bold+ITALIC
make font initially italic+UNDERLINED
make font initially underlines+SMALLCAPS
make font initially smallcapsGUI
use GUI-fonts, calls useGuiFonts()Font names can also be one of the special names, specified in the documentation of JKQTMathTextFontSpecifier and JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts()
void JKQTMathText::setFontTypewriter | ( | const QString & | fontName, |
JKQTMathTextFontEncoding | encoding = JKQTMathTextFontEncoding::MTFEStandard |
||
) |
set the font fontName and it's encoding encoding to be used for text in the logical font MTEtypewriter
void JKQTMathText::setFracFactor | ( | double | __value | ) |
scaling factor for font size of nominator and denominator of a fraction
void JKQTMathText::setFracNestedFactor | ( | double | __value | ) |
scaling factor for font size of nominator and denominator of a nested fraction
void JKQTMathText::setFracShiftFactor | ( | double | __value | ) |
shift of denominator/nummerator away from central line of a frac
void JKQTMathText::setIntSubBesidesXCorrectionXFactor | ( | double | __value | ) |
for integrals (\int
, \oint
, ...) the subscripts besides the symbol have to be shifted to the left a bit to the left to accomodate the shape of the operator symbol (i.e. some free space at the bottom-right)
This factor is multiplied by the width of an x: xshift=intsubbesides_xcorrection_xfactor*xWidth Then the subscript besides the symbol is shifted by xshift to the left
This correction is applied to \int, \iint, \iiint, \oint, ...
void JKQTMathText::setIntSubSuperXCorrectionFactor | ( | double | __value | ) |
for integrals (\int
, \oint
, ...) the sub-/superscripts above/below the symbol have to be shifted a bit to the left/right to accomodate the shape of the operator symbol (i.e. some free space at the top-left and bottom-right)
This factor is multiplied by the symbol width: xshift=intsubsuper_xcorrection_factor*symbolWidth Then the subscript below is placed at centerx(symbol)-xshift and the superscript at centerx(symbol)+shiftx. This is also used to correct a subset next to the symbol by shifting it to rightx(symbol)-xshift.
This correction is applied to \int, \iint, \iiint, \oint, ...
void JKQTMathText::setMathoperatorWidthFactor | ( | double | __value | ) |
factor, used to extend the size of an operator in math mode
The next image demonstrates the effect of this property, which adds extra space around certain math operators in math mode:
void JKQTMathText::setMatrixLineSeparationFactor | ( | double | factor | ) |
separation of double-lines in tables, this factor is multiplied with the font.linewidth()
void JKQTMathText::setMatrixLinewidthHeavyFactor | ( | double | factor | ) |
width of heavy table lines, this factor is multiplied with the current font.linewidth()
void JKQTMathText::setMatrixLinewidthThinFactor | ( | double | factor | ) |
width of thin table lines, this factor is multiplied with the current font.linewidth()
void JKQTMathText::setMatrixXPaddingFactor | ( | double | factor | ) |
x-padding of two columns, this factor is multiplied with the font.width
("x")
void JKQTMathText::setMatrixXSeparationFactor | ( | double | factor | ) |
x-separation of two columns, this factor is multiplied with the font.width
("x")
void JKQTMathText::setMatrixYPaddingFactor | ( | double | factor | ) |
y-padding of two columns, this factor is multiplied with the font.width
("x")
void JKQTMathText::setMatrixYSeparationFactor | ( | double | factor | ) |
y-separation of two columns, this factor is multiplied with the font.width
("x")
void JKQTMathText::setOperatorsubsuperDistanceFactor | ( | double | __value | ) |
for operators (\sum
, \int
, ...) where the text is placed above/below the symbol, this is the distance between the operator symbol and the sub-/super-text if multiplied by xHeight
void JKQTMathText::setOperatorsubsuperExtraSpaceFactor | ( | double | __value | ) |
for operators (\sum
, \int
, ...) where the text is placed above/below the symbol, this is the additional width added to the width of maximum width of the operator, above and below
void JKQTMathText::setOperatorsubsuperSizeFactor | ( | double | __value | ) |
like subsuper_size_factor, but for operators (\sum
, \int
, ...) where the text is placed above/below the symbol
void JKQTMathText::setSpecialSubShiftFactor | ( | double | __value | ) |
relative shift of text in subscript to normal text in special superscript mode (after large previous nodes): 0=child's baseline at the descent of the previous node, 1: subscript-node starts at the descent of the previous node
void JKQTMathText::setSpecialSuperShiftFactor | ( | double | __value | ) |
relative shift of text in superscript to normal text in special superscript mode (after large previous nodes): 0= superscript descent coincides with the previous node's baselineHeight, 1: top of previous node and top of the superscript nodes coincide
void JKQTMathText::setSqrtHeightFactor | ( | double | __value | ) |
height-increase of the sqrt-symbol, as factor of the child's height
void JKQTMathText::setSqrtSmallFontFactor | ( | double | __value | ) |
scaling factor for the small font used to indicate the degree of the sqrt
void JKQTMathText::setSqrtWidthXFactor | ( | double | __value | ) |
width of the sqrt-symbol, as factor to width("X")
void JKQTMathText::setSubShiftFactor | ( | double | __value | ) |
relative shift of text in subscript to normal text, factor is multiplied by font.xHeight()
void JKQTMathText::setSubsuperModeSelectionBySizeFactor | ( | double | __value | ) |
this factor is used to determine how to typeset sub-/superscript.
If the ascent for superscript of descent for subscript of the previous character is >=subsuper_mode_selection_by_size_factor*ascent
(currentFont) or <=subsuper_mode_selection_by_size_factor*descent
(currentFont) respectively, the sub/superscript is typeset, aligned with the ascent or descent of the previous character. Otherwise it is aligned with the default method:
Default mode:
Special mode:
This method fixes problems with characters that are significantyl larger that normal text character of the fonst, such as generated by \sum
,\int,... .
void JKQTMathText::setSubsuperSizeFactor | ( | double | __value | ) |
resizing factor for font size in sub-/superscript
void JKQTMathText::setSuperShiftFactor | ( | double | __value | ) |
relative shift of text in superscript to normal text, factor is multiplied by font.xHeight()
void JKQTMathText::setUnderbraceBraceSizeXFactor | ( | double | __value | ) |
height of the brace in underbrace/overbrace, multiplied with ascent
void JKQTMathText::setUnderbraceFactor | ( | double | __value | ) |
scaling factor for font of underbrace/overbrace text
void JKQTMathText::setUnderbraceSeparationXFactor | ( | double | __value | ) |
additional space between the main text to the curly brace and the brace to underbrace/overbrace, multiplied with height("x")
void JKQTMathText::setUndersetFactor | ( | double | __value | ) |
scaling factor for font of underset/overset text
|
static |
convert a string (generated by BaseFontOptions2String() to BaseFontOptions
QString JKQTMathText::toHtml | ( | bool * | ok = nullptr , |
double | fontPointSize = 10 |
||
) |
convert LaTeX to HTML. returns ok=true
on success and ok=false
else.
void JKQTMathText::useAnyUnicode | ( | QString | timesFont, |
const QString & | sansFont, | ||
JKQTMathTextFontEncoding | encodingTimes = JKQTMathTextFontEncoding::MTFEUnicode , |
||
JKQTMathTextFontEncoding | encodingSans = JKQTMathTextFontEncoding::MTFEUnicode |
||
) |
sets timesFont (with its encoding encodingTimes ) for serif-text and sansFont (with its encoding encodingSans ) for both mathmode and textmode fonts
useAnyUnicode("Comic Sans MS", "Comic Sans MS")
:
br
useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS");
:
useAnyUnicodeForMathOnly("Comic Sans MS", "Comic Sans MS");
:
void JKQTMathText::useAnyUnicodeForMathOnly | ( | QString | timesFont, |
const QString & | sansFont, | ||
JKQTMathTextFontEncoding | encodingTimes = JKQTMathTextFontEncoding::MTFEUnicode , |
||
JKQTMathTextFontEncoding | encodingSans = JKQTMathTextFontEncoding::MTFEUnicode |
||
) |
sets timesFont (with its encoding encodingTimes ) for serif-text and sansFont (with its encoding encodingSans ) for mathmode fonts only
useAnyUnicode("Comic Sans MS", "Comic Sans MS")
:
br
useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS");
:
useAnyUnicodeForMathOnly("Comic Sans MS", "Comic Sans MS");
:
void JKQTMathText::useAnyUnicodeForTextOnly | ( | QString | timesFont, |
const QString & | sansFont, | ||
JKQTMathTextFontEncoding | encodingTimes = JKQTMathTextFontEncoding::MTFEUnicode , |
||
JKQTMathTextFontEncoding | encodingSans = JKQTMathTextFontEncoding::MTFEUnicode |
||
) |
sets timesFont (with its encoding encodingTimes ) for serif-text and sansFont (with its encoding encodingSans ) for both mathmode fonts only
useAnyUnicode("Comic Sans MS", "Comic Sans MS")
:
br
useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS");
:
useAnyUnicodeForMathOnly("Comic Sans MS", "Comic Sans MS");
:
bool JKQTMathText::useASANA | ( | bool | mathModeOnly = true , |
bool | useAsFallbackSymbol = true |
||
) |
configures the class to use the ASANA fonts in mathmode
use the ASANA fonts from https://ctan.org/tex-archive/fonts/Asana-Math/ in math-mode or in math and text-mode (if mathModeOnly ==false
)
If useAsFallbackSymbol
is set ==true
then the XITS fonts are also used as MTEFallbackSymbols
This function does not only use default font-names for ASANA, but searches the font database of the system with several different variants, using JKQTMathTextFontSpecifier::getASANAFamilies(). It also sets the special math-variant of ASANA for math mode and the normal variant for text-mode
bool JKQTMathText::useFiraMath | ( | bool | mathModeOnly = true , |
bool | useAsFallbackSymbol = true |
||
) |
configures the class to use the Fira Math fonts in mathmode
use Fira Math fonts from https://github.com/firamath/firamath in math-mode or in math and text-mode (if mathModeOnly ==false
).
If useAsFallbackSymbol
is set ==true
then the Fira Math fonts are also used as MTEFallbackSymbols
JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS
is set to ON (default: ON). Then the Fira Math fonts are added as Qt-Ressources to the library binary. If this is not the case, you have to provide the Fira Math fonts on the target system by other means, if you want to use them.This function does not only use default font-names for Fira Math, but searches the font database of the system with several different variants, using JKQTMathTextFontSpecifier::getFIRAFamilies(). It also sets the special math-variant of Fira for math mode and the normal variant for text-mode
bool JKQTMathText::useGuiFonts | ( | ) |
configures the class to be used for GUI output, i.e. tries to find fonts that are harmonious for the default GUI font, sets the default GUI font for "roman" and finds an oppposite font for "sans", which means that "sans" may actually be a serif font,when the app font is sans serif!
bool JKQTMathText::useSTIX | ( | bool | mathModeOnly = true , |
bool | useAsFallbackSymbol = true |
||
) |
configures the class to use the STIX fonts in mathmode
use STIX (1.x/2.x) fonts from https://www.stixfonts.org/ in math-mode or in math and text-mode (if mathModeOnly ==false
)
If useAsFallbackSymbol
is set ==true
then the XITS fonts are also used as MTEFallbackSymbols
This function does not only use default font-names for STIX, but searches the font database of the system with several different variants, using JKQTMathTextFontSpecifier::getSTIXFamilies(). It also sets the special math-variant of STIX for math mode and the normal variant for text-mode
bool JKQTMathText::useXITS | ( | bool | mathModeOnly = true , |
bool | useAsFallbackSymbol = true |
||
) |
configures the class to use the XITS fonts in mathmode
use XITS fonts from https://github.com/alif-type/xits in math-mode or in math and text-mode (if mathModeOnly ==false
).
If useAsFallbackSymbol
is set ==true
then the XITS fonts are also used as MTEFallbackSymbols
JKQtPlotter_BUILD_INCLUDE_XITS_FONTS
is set to ON (default: ON). Then the XITS fonts are added as Qt-Ressources to the library binary. If this is not the case, you have to provide the XITS fonts on the target system by other means, if you want to use them.This function does not only use default font-names for XITS, but searches the font database of the system with several different variants, using JKQTMathTextFontSpecifier::getXITSFamilies(). It also sets the special math-variant of XITS for math mode and the normal variant for text-mode
|
friend |
|
friend |
|
static |
minimum linewidth allowed in a JKQTMathText (given in pt)
|
protected |
factor, used to increase the font size for big math operators, such as \sum
, \prod
, ...
|
protected |
specifies how to draw blackboard font characters (i.e. \mathbb{N}
)
Blackboard fonts are not widely available on target systems (viable fonts are e.g. "Double Stroke", "CloisterOpenFace BT", "GoudyHandtooled BT", "Castellar", "MathJax_AMS", "Castellar Standard", "MathJax_AMS Standard", "Colonna MT"
). But the most important blackboard characters are usually available in the higher unicode codepoints of Fonts specialized for math (e.g. XIST, STIX, ASANA).
Therefore JKQTMathText supports using these characters, or simulating a blackboard font in addition to using one of the fonts above. You can set that by setting JKQTMathText::setFontBlackboradMode() with one of the options from JKQTMathTextBlackboradDrawingMode:
|
protected |
for \left
/ \right
braces: The brace is this factor higher than the child block it surrounds
|
protected |
fraction of the brace ascent that the brace is shifted downwards, when scaled
|
protected |
size of the decorations (dot, tilde, ...), as fraction of the ascent
|
protected |
separation between the text and the decorations (dot, tilde, ...), as fraction of the ascent
|
protected |
a decoration has a size, which is slightly smaller than the text- width. the width is reduced by decoration_width_reduction_Xfactor*width
("X") and the position is centered around the child-box. Also an italic correction is applied:
|
protected |
a list that will be filled with error messages while parsing, if any error occur
This list of errors is (mostly) filled during a call to parse(). During rendering (e.g. with draw() ) only very few errors will be detected, as most errors are caused by wrong markup.
A call to parse() also clears this list.
|
protected |
font color
|
protected |
stores information about the different fonts used by LaTeX markup
|
protected |
acompanies fontReplacements and collects the encodings of the replacement fonts, if no entry is present, the default encoding is used, as given to the setter!
|
protected |
additional options for the base fonts
|
protected |
table with font replacements to use (e.g. if it is known that a certain font is not good for rendering, you can add an alternative using addReplacementFont(). These are automatically applied, when setting a new font name!
|
protected |
base font size in the units defined in fontSizeUnits
|
protected |
unit of fontSize
|
protected |
scaling factor for font size of nominator and denominator of a fraction
|
protected |
scaling factor for font size of nominator and denominator of a nested fraction
|
protected |
shift of denominator/nummerator away from central line of a frac
|
staticprotected |
initial choice for "blackboard" font
|
staticprotected |
initial choice for "caligraphic" font
|
staticprotected |
initial choice for "fraktur" font
|
staticprotected |
initial choice for "sans-erif" font
|
staticprotected |
initial choice for "script" font
|
staticprotected |
initial choice for "serif" font
|
staticprotected |
initial choice for "fallback symbol" font
|
staticprotected |
initial choice for "typewriter" font
|
protected |
for integrals (\int
, \oint
, ...) the subscripts besides the symbol have to be shifted to the left a bit to the left to accomodate the shape of the operator symbol (i.e. some free space at the bottom-right)
This factor is multiplied by the width of an x: xshift=intsubbesides_xcorrection_xfactor*xWidth Then the subscript besides the symbol is shifted by xshift to the left
This correction is applied to \int, \iint, \iiint, \oint, ...
|
protected |
for integrals (\int
, \oint
, ...) the sub-/superscripts above/below the symbol have to be shifted a bit to the left/right to accomodate the shape of the operator symbol (i.e. some free space at the top-left and bottom-right)
This factor is multiplied by the symbol width: xshift=intsubsuper_xcorrection_factor*symbolWidth Then the subscript below is placed at centerx(symbol)-xshift and the superscript at centerx(symbol)+shiftx. This is also used to correct a subset next to the symbol by shifting it to rightx(symbol)-xshift.
This correction is applied to \int, \iint, \iiint, \oint, ...
|
protected |
factor, used to extend the size of an operator in math mode
The next image demonstrates the effect of this property, which adds extra space around certain math operators in math mode:
|
protected |
separation of double-lines in tables, this factor is multiplied with the font.linewidth()
|
protected |
width of heavy table lines, this factor is multiplied with the current font.linewidth()
|
protected |
width of thin table lines, this factor is multiplied with the current font.linewidth()
|
protected |
x-padding of two columns, this factor is multiplied with the font.width
("x")
|
protected |
x-separation of two columns, this factor is multiplied with the font.width
("x")
|
protected |
y-padding of two columns, this factor is multiplied with the font.width
("x")
|
protected |
y-separation of two columns, this factor is multiplied with the font.width
("x")
|
protected |
for operators (\sum
, \int
, ...) where the text is placed above/below the symbol, this is the distance between the operator symbol and the sub-/super-text if multiplied by xHeight
|
protected |
for operators (\sum
, \int
, ...) where the text is placed above/below the symbol, this is the additional width added to the width of maximum width of the operator, above and below
|
protected |
like subsuper_size_factor, but for operators (\sum
, \int
, ...) where the text is placed above/below the symbol
|
protected |
the syntax tree of JKQTMathTextNode's that was created by the last parse() call
|
staticprotected |
used to check for the first construction of a JKQTMathText ... if true
several static variables are initialized in the constructor
|
staticprotected |
mutex to protect the static members
|
protected |
relative shift of text in subscript to normal text in special superscript mode (after large previous nodes): 0=child's baseline at the descent of the previous node, 1: subscript-node starts at the descent of the previous node
|
protected |
relative shift of text in superscript to normal text in special superscript mode (after large previous nodes): 0= superscript descent coincides with the previous node's baselineHeight, 1: top of previous node and top of the superscript nodes coincide
|
protected |
height-increase of the sqrt-symbol, as factor of the child's height
|
protected |
scaling factor for the small font used to indicate the degree of the sqrt
|
protected |
width of the sqrt-symbol, as factor to width("X")
|
protected |
relative shift of text in subscript to normal text, factor is multiplied by font.xHeight()
|
protected |
this factor is used to determine how to typeset sub-/superscript.
If the ascent for superscript of descent for subscript of the previous character is >=subsuper_mode_selection_by_size_factor*ascent
(currentFont) or <=subsuper_mode_selection_by_size_factor*descent
(currentFont) respectively, the sub/superscript is typeset, aligned with the ascent or descent of the previous character. Otherwise it is aligned with the default method:
Default mode:
Special mode:
This method fixes problems with characters that are significantyl larger that normal text character of the fonst, such as generated by \sum
,\int,... .
|
protected |
resizing factor for font size in sub-/superscript
|
protected |
relative shift of text in superscript to normal text, factor is multiplied by font.xHeight()
|
protected |
height of the brace in underbrace/overbrace, multiplied with ascent
|
protected |
scaling factor for font of underbrace/overbrace text
|
protected |
additional space between the main text to the curly brace and the brace to underbrace/overbrace, multiplied with height("x")
|
protected |
scaling factor for font of underset/overset text