24#ifndef JKQTMATHTEXTSYMBOLNODE_H
25#define JKQTMATHTEXTSYMBOLNODE_H
26#include "jkqtmathtext/jkqtmathtext_imexport.h"
27#include "jkqtmathtext/jkqtmathtexttools.h"
28#include "jkqtmathtext/nodes/jkqtmathtextnode.h"
202 SymbolFullProps(
const QString& font,
const QString& symbol,
const QString& _html=QString(),
SymbolFlags _htmlflags=
AsOutside,
double _htmlfontScalingFactor=1.0,
double _htmlyShiftFactor=0.0);
220 SymbolFullProps(
JKQTMathTextEnvironmentFont _fontType,
JKQTMathTextFontEncoding enc0,
const SymbolProps& props0,
JKQTMathTextFontEncoding enc1,
const SymbolProps& props1,
JKQTMathTextFontEncoding enc2,
const SymbolProps& props2,
const QString& _html=QString(),
SymbolFlags _htmlflags=
AsOutside,
double _htmlfontScalingFactor=1.0,
double _htmlyShiftFactor=0.0);
226 QHash<JKQTMathTextFontEncoding, SymbolProps>
props;
309 static const QHash<QString, SymbolFullProps>&
symbols();
this class parses a mathematical markup string and can then draw the contained text/equation onto a Q...
Definition jkqtmathtext.h:192
JKQTMathTextNode(JKQTMathText *parentMathText)
static SymbolFullProps MathOperatorSymbolUnicode(const QString &unicode)
constructs a SymbolProps for a math-operator symbol like \pm ... in unicode-full-encoding,...
static SymbolFullProps AsOutsiudeGreekLetter_WinSymbol_Unicode_Html(const QString &letterWinSymbol, const QString &letterUnicode, const QString &html)
constructs a SymbolProps for a greek letter with the format from outside with the symbol in unicode-e...
static void addGreekLetterVariants_WinSymbol_Unicode_Html(QHash< QString, JKQTMathTextSymbolNode::SymbolFullProps > &symbols, const QString &baseInstructionName, const QString &letterWinSymbol, const QString &letterUnicode, const QString &html)
insert GreekLetter_WinSymbol_Unicode_Html() as baseInstructionName and UprightGreekLetter_WinSymbol_U...
static SymbolFullProps SimpleTextSymbol(const QString &symbol, const QString &html)
creates a SymbolFullProps object for a symbol that can be typeset in any font, a special html-string ...
static SymbolFullProps StdSymbol(const QString &symbol, const QString &html)
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
static SymbolFullProps StdSymbol(const QString &symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
static SymbolFullProps SimpleTextSymbol(const QString &symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
creates a SymbolFullProps object for a symbol that can be typeset in any font, for SymbolFullProps::h...
NodeSize getSymbolSize(QPainter &painter, JKQTMathTextEnvironment currentEv) const
determine the size of the node, calls getSizeInternal() implementation of the actual type
virtual bool toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override
convert node to HTML and returns true on success
virtual QString getTypeName() const override
return the name of this class as a string
QString getSymbolName() const
this string will be sent to the drawText method with properly set fonts
QString symbolName
this string will be sent to the drawText method with properly set fonts
Definition jkqtmathtextsymbolnode.h:107
static SymbolFullProps SimpleUprightTextSymbol(const QString &symbol)
creates a SymbolFullProps object for a symbol that can be typeset in any font, for SymbolFullProps::h...
static bool hasSymbol(const QString &symbolName)
checks whether the given symbol name can be prepresented by this type of node
static SymbolFullProps MathOperatorSymbol(const QString &op)
constructs a SymbolProps for a math-operator like \sin ..., i.e. ItalicOff, BoldOff,...
static SymbolFullProps UprightGreekLetter_WinSymbol_Unicode_Html(const QString &letterWinSymbol, const QString &letterUnicode, const QString &html)
constructs a SymbolProps for an upright greek letter with the symbol in unicode-encoding letterUnicod...
GlobalSymbolFlags
flags specifying additional symbol features
Definition jkqtmathtextsymbolnode.h:139
@ SmallExtendWidthInMathmode
like ExtendWidthInMathmode but adds a smaller whitespace
Definition jkqtmathtextsymbolnode.h:142
@ IntLikeSymbolCorrection
symbols, like \int,\iint,... require a correction in x-direction for subsequent sub-/superscripts ....
Definition jkqtmathtextsymbolnode.h:144
@ SubscriptCorrection
symbols, like \nabla,... require a subscript correction in x-direction for subsequent subscripts ....
Definition jkqtmathtextsymbolnode.h:146
@ NoGLobalSymbolFlags
indicates that no properties are activated
Definition jkqtmathtextsymbolnode.h:140
@ MakeWhitespaceHalf
symbol uses whitespaces in its text (SymbolProps::symbol). These should be typeset as half-spaces
Definition jkqtmathtextsymbolnode.h:143
@ SubSuperscriptBelowAboveSymbol
symbols, like \int,\iint,... if appearing in math-mode cause typesetting following sub-/superscripts ...
Definition jkqtmathtextsymbolnode.h:145
@ ExtendWidthInMathmode
this symbol has an extended width, when used within a moth-environment/in math-mode
Definition jkqtmathtextsymbolnode.h:141
static SymbolFullProps MathOperatorSymbol(const QString &op, const QString &ophtml)
constructs a SymbolProps with explicit HTML for a math-operator like \sin ..., i.e....
static SymbolFullProps SimpleUprightTextSymbol(const QString &symbol, const QString &html)
creates a SymbolFullProps object for a symbol that can be typeset in any font, a special html-string ...
virtual JKQTMathTextNodeSize getSizeInternal(QPainter &painter, JKQTMathTextEnvironment currentEv) const override
determine the size of the node, overwrite this function in derived classes
static QStringList getSymbols()
return a list of all defined symbols
static SymbolFullProps MathOperatorText(const QString &op, const QString &ophtml)
constructs a SymbolProps with explicit HTML for a math-operator like \sin ..., i.e....
SymbolFullProps getSymbolProp(const QString &symName, const JKQTMathTextEnvironment ¤tEv) const
retrieve the properties to render the given symbol symName in the current environment currentEv
static SymbolFullProps MathOperatorText(const QString &op)
constructs a SymbolProps for a math-operator like \sin ..., i.e. ItalicOff, BoldOff,...
SymbolFlags
flags specifying additional symbol features
Definition jkqtmathtextsymbolnode.h:110
@ DrawRightHBar
indicates whether to draw a bar on the right half of the character, above the xHeight,...
Definition jkqtmathtextsymbolnode.h:117
@ DrawLeftHBar
indicates whether to draw a bar on the left half of the character, above the xHeight (like for \hbar ...
Definition jkqtmathtextsymbolnode.h:116
@ AsOutside
indicates that no properties are activated
Definition jkqtmathtextsymbolnode.h:111
@ BoldOn
make font bold in any case
Definition jkqtmathtextsymbolnode.h:114
@ DrawBackSlash
indicates to overdraw a backslash
Definition jkqtmathtextsymbolnode.h:122
@ RotateSymbol90
indicates to rotate the symbol 90 degree
Definition jkqtmathtextsymbolnode.h:120
@ FlipSymbolLeftRight
indicates to flip the given symbol left-right
Definition jkqtmathtextsymbolnode.h:119
@ FlipSymbolUpDown
indicates to flip the given symbol upside-down
Definition jkqtmathtextsymbolnode.h:118
@ NormalWeight
Definition jkqtmathtextsymbolnode.h:126
@ Upright
Definition jkqtmathtextsymbolnode.h:125
@ DrawVertLine
indicates to overdraw a centered vertical line (slightly tilted if italic)
Definition jkqtmathtextsymbolnode.h:123
@ BoldOff
make font non-bold (i,,e, normal weight) in any case
Definition jkqtmathtextsymbolnode.h:115
@ ItalicOff
make font non-italic (i.e. upright) in any case
Definition jkqtmathtextsymbolnode.h:113
@ HeightIsAscent
if true, the height of the symbol equals the ascent of the font
Definition jkqtmathtextsymbolnode.h:124
@ ItalicOn
make font italic in any case
Definition jkqtmathtextsymbolnode.h:112
@ DrawSlash
indicates to overdraw a slash (e.g. to combine 0 and / to form \varnothing )
Definition jkqtmathtextsymbolnode.h:121
static bool isExtendedWidthSymbol(const QString &symbolName)
checks whether the given symbol has global flags SymbolFullProps::ExtendWidthInMathmode or SymbolFull...
friend bool has(SymbolFlags a, SymbolFlags b)
Definition jkqtmathtextsymbolnode.h:136
static void drawText(QPainter &p, const QString &text, GlobalSymbolFlags globalFlags, SymbolFlags symflags)
draw text at (0,0) using QPainter p and taking the flags from globalFlags into account
friend bool has(GlobalSymbolFlags a, GlobalSymbolFlags b)
Definition jkqtmathtextsymbolnode.h:156
static const QHash< QString, SymbolFullProps > & symbols()
symbols that can be generated in any standard-font
static SymbolFullProps NarrowMathOperatorSymbolStd(const QString &symbol)
constructs a SymbolProps for a narrow math-operator symbol like \pm ... in unicode-full-encoding,...
static SymbolFullProps NarrowMathOperatorText(const QString &op)
constructs a SymbolProps for a narrow math-operator like \sin ..., i.e. ItalicOff,...
static SymbolFullProps MathGreekLetter_WinSymbol_Unicode_Html(const QString &letterWinSymbol, const QString &letterUnicode, const QString &html)
constructs a SymbolProps for an italic greek letter with the symbol in unicode-encoding letterUnicode...
static SymbolFullProps UnicodeSymbol(const QString &symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
JKQTMathTextSymbolNode(JKQTMathText *parent, const QString &name)
static bool isSubSuperscriptBelowAboveSymbol(const QString &symbolName)
checks whether the given symbol name codes for an instruction that has SymbolFullProps::SubSuperscrip...
static QRectF getTightBoundingRect(const QFont &fm, const QString &text, GlobalSymbolFlags globalFlags, QPaintDevice *pd)
calculates the tight bounding rect of text using fm and taking the flags from globalFlags into accoun...
static SymbolFullProps NarrowMathOperatorSymbolStd(const QString &symbol, const QString &symbolHTML)
constructs a SymbolProps for a narrow math-operator symbol like \pm ... in unicode-full-encoding,...
static SymbolFullProps NarrowMathOperatorText(const QString &op, const QString &ophtml)
constructs a SymbolProps with explicit HTML for a narrow math-operator like \sin ....
static SymbolFullProps UprightSymbolUnicode(const QString &symbol, const QString &html)
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
static int getSymbolLength(const QString &symbolName)
returns the length of the symbol string for the given symbol
static SymbolFullProps NarrowMathOperatorSymbolUnicode(const QString &unicode)
constructs a SymbolProps for a narrow math-operator symbol like \pm ... in unicode-full-encoding,...
virtual double draw(QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const override
draw the contents at the designated position
static QRectF getBoundingRect(const QFont &fm, const QString &text, GlobalSymbolFlags globalFlags, QPaintDevice *pd)
calculates the bounding rect of text using fm and taking the flags from globalFlags into account
static SymbolFullProps UprightSymbolStd(const QString &symbol)
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
static SymbolFullProps UprightSymbolStd(const QString &symbol, const QString &html)
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
static SymbolFullProps UnicodeSymbol(const QString &symbol, const QString &html)
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
static SymbolFullProps UprightSymbolUnicode(const QString &symbol)
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
virtual ~JKQTMathTextSymbolNode() override
#define JKQTMATHTEXT_LIB_EXPORT
Definition jkqtmathtext_imexport.h:108
JKQTMathTextEnvironmentFont
the available logical fonts (default is MTEroman)
Definition jkqtmathtexttools.h:284
JKQTMathTextFontEncoding
used to specify the font encoding used for drawing
Definition jkqtmathtexttools.h:175
describes the current drawing environment (base fontname ...)
Definition jkqtmathtexttools.h:304
beschreibt die Größe(n) eines Knotens
Definition jkqtmathtexttools.h:393
JKQTMathTextNodeSize(double width=0, double baselineHeight=0, double overallHeight=0, double strikeoutPos=0, double baselineXCorrection=0, double topXCorrection=0)
return type for getSymbolSize(), extends JKQTMathTextNodeSize with information about x-correction for...
Definition jkqtmathtextsymbolnode.h:72
NodeSize(const JKQTMathTextNodeSize &other)
NodeSize(const NodeSize &other)
NodeSize & operator=(const NodeSize &other)
double subSuperAboveBelowXCorrection
x-correction as described for JKQTMathParser::intsubsuper_xcorrection_factor for placing sub-/supersc...
Definition jkqtmathtextsymbolnode.h:75
NodeSize & operator=(const JKQTMathTextNodeSize &other)
properties of the symbol, extends SymbolProps with font...
Definition jkqtmathtextsymbolnode.h:192
SymbolProps getProps(JKQTMathTextFontEncoding key, const SymbolProps &defaultValue=SymbolProps(), JKQTMathTextFontEncoding *foundEncodingOut=nullptr) const
accesses entries in props for a given key. This also looks for fallback options (e....
SymbolFullProps & operator=(SymbolFullProps &&other)=default
SymbolFullProps & operator=(const SymbolFullProps &other)=default
SymbolFullProps(JKQTMathTextEnvironmentFont _fontType, const SymbolProps &props, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
props is stored with encoding MTFEStandard, uses the specified _fontType for drawing,...
SymbolFullProps(const QString &font, const SymbolProps &props, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
typesets the symbol (described in props ) from the specified font, props is stored with encoding MTFE...
JKQTMathTextEnvironmentFont fontType
font type to use for typesetting the symbol (default is MTcurrentFont, which just takes the font set ...
Definition jkqtmathtextsymbolnode.h:222
QPair< QFont, SymbolProps > getDrawingData(JKQTMathTextEnvironment currentEv, JKQTMathText *parent, QPainter &painter) const
returns the QFont to use for drawing and the QString to draw with it
SymbolFullProps & addMathOperatorHtml(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps(JKQTMathTextEnvironmentFont _fontType, const QString &symbol, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
takes a symbol from the specified _fontType assuming MTFEStandard encoding, an optional HTML-string _...
SymbolFullProps & addMathOperatorUnicode(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
QHash< JKQTMathTextFontEncoding, SymbolProps > props
here the actual symbol properties for each JKQTMathTextFontEncoding are stored
Definition jkqtmathtextsymbolnode.h:226
SymbolFullProps & addStd(const QString &_symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps(JKQTMathTextEnvironmentFont _fontType, JKQTMathTextFontEncoding enc0, const SymbolProps &props0, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
single-alternative symbol for encoding enc0 and using symbol description props0 for it,...
SymbolFullProps(JKQTMathTextFontEncoding enc0, const SymbolProps &props0, JKQTMathTextFontEncoding enc1, const SymbolProps &props1, JKQTMathTextFontEncoding enc2, const SymbolProps &props2, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
triple-alternative symbol for encoding enc0 + enc1 + enc2 and using symbol descriptions props0 + prop...
SymbolFullProps(JKQTMathTextFontEncoding enc0, const SymbolProps &props0, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
single-alternative symbol for encoding enc0 and using symbol description props0 for it....
SymbolFullProps(const SymbolFullProps &other)=default
SymbolFullProps & add(JKQTMathTextFontEncoding enc, const SymbolProps &props)
SymbolFullProps & addUnicode(const QString &_symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolProps html
HTML entity/text to represent the symbol (empty html.symbol not available)
Definition jkqtmathtextsymbolnode.h:228
SymbolFullProps & addWinSymbol(const QString &_symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps & addUprightHtml(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps & setGlobalFlags(GlobalSymbolFlags addglobalFlags)
SymbolFullProps(const SymbolProps &props, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
props is stored with encoding MTFEStandard, an optional HTML-string _html can be given
SymbolFullProps & addUprightStd(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps & addMathOperatorWinSymbol(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps & addUprightWinSymbol(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps(JKQTMathTextEnvironmentFont _fontType, JKQTMathTextFontEncoding enc0, const SymbolProps &props0, JKQTMathTextFontEncoding enc1, const SymbolProps &props1, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
double-alternative symbol for encoding enc0 + enc1 and using symbol descriptions props0 + props1 for ...
SymbolFullProps & addUprightUnicode(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps(SymbolFullProps &&other)=default
SymbolFullProps(JKQTMathTextEnvironmentFont _fontType, JKQTMathTextFontEncoding enc0, const SymbolProps &props0, JKQTMathTextFontEncoding enc1, const SymbolProps &props1, JKQTMathTextFontEncoding enc2, const SymbolProps &props2, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
triple-alternative symbol for encoding enc0 + enc1 + enc2 and using symbol descriptions props0 + prop...
SymbolFullProps()
default constructor
SymbolFullProps(JKQTMathTextFontEncoding enc0, const SymbolProps &props0, JKQTMathTextFontEncoding enc1, const SymbolProps &props1, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
double-alternative symbol for encoding enc0 + enc1 and using symbol descriptions props0 + props1 for ...
SymbolFullProps & addGlobalFlags(GlobalSymbolFlags addglobalFlags)
QString customFontFamily
font to use for output when fontType==MTcustomFont
Definition jkqtmathtextsymbolnode.h:224
SymbolFullProps(const QString &font, const QString &symbol, const QString &_html=QString(), SymbolFlags _htmlflags=AsOutside, double _htmlfontScalingFactor=1.0, double _htmlyShiftFactor=0.0)
typesets the symbol from the specified font, props is stored with encoding MTFEStandard,...
GlobalSymbolFlags globalFlags
specifies global symbol flags
Definition jkqtmathtextsymbolnode.h:230
SymbolFullProps & addHtml(const QString &_symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
SymbolFullProps & addMathOperatorStd(const QString &_symbol, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
properties of the symbol
Definition jkqtmathtextsymbolnode.h:166
double yShiftFactor
this corrects the y position of a symbol: draws at y <- y+ height*yfactor)
Definition jkqtmathtextsymbolnode.h:188
SymbolProps(const QString &_symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0)
this constructor sets the given properties and sets html=symbol! replaces whitespaces in _ymbol with ...
SymbolProps & operator=(SymbolProps &&other)=default
SymbolFlags flags
flags switching special features
Definition jkqtmathtextsymbolnode.h:184
SymbolProps(const SymbolProps &other)=default
QString symbol
the symbol or text used to render the symbol (i.e. not the name, e.g. if the instruction/symbol name ...
Definition jkqtmathtextsymbolnode.h:177
SymbolProps & operator=(const SymbolProps &other)=default
QChar getSymbolSingleChar() const
if symbol is a single character, this returns it, otherwise (empty or multi-character) it returns QCh...
Definition jkqtmathtextsymbolnode.h:179
double fontScalingFactor
magnification factor for the font size
Definition jkqtmathtextsymbolnode.h:186
SymbolProps(SymbolProps &&other)=default