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
|
subclass representing one symbol (e.g. \alpha
, \cdot
...) node in the syntax tree
More...
#include <jkqtmathtextsymbolnode.h>
Classes | |
struct | NodeSize |
return type for getSymbolSize(), extends JKQTMathTextNodeSize with information about x-correction for sub- and superscript More... | |
struct | SymbolFullProps |
properties of the symbol, extends SymbolProps with font... More... | |
struct | SymbolProps |
properties of the symbol More... | |
Public Member Functions | |
JKQTMathTextSymbolNode (JKQTMathText *parent, const QString &name) | |
virtual | ~JKQTMathTextSymbolNode () override |
virtual double | draw (QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const override |
draw the contents at the designated position | |
QString | getSymbolName () const |
this string will be sent to the drawText method with properly set fonts | |
NodeSize | getSymbolSize (QPainter &painter, JKQTMathTextEnvironment currentEv) const |
determine the size of the node, calls getSizeInternal() implementation of the actual type | |
virtual QString | getTypeName () const override |
return the name of this class as a string | |
virtual bool | toHtml (QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override |
convert node to HTML and returns true on success | |
Public Member Functions inherited from JKQTMathTextNode | |
JKQTMathTextNode (const JKQTMathTextNode &)=delete | |
JKQTMathTextNode (JKQTMathText *parentMathText) | |
virtual | ~JKQTMathTextNode () |
bool | getDrawBoxes () const |
returns the drawing of colored boxes (for DEBUGGING) around the actual output of the node is enabled | |
JKQTMathTextNode * | getParentNode () |
parent node of this node (i.e. one level up, ode nullptr ) | |
const JKQTMathTextNode * | getParentNode () const |
parent node of this node (i.e. one level up, ode nullptr ) | |
JKQTMathTextNodeSize | getSize (QPainter &painter, JKQTMathTextEnvironment currentEv) const |
determine the size of the node, calls getSizeInternal() implementation of the actual type | |
bool | isSubSuperscriptAboveBelowNode () const |
if true then following sub- and/or superscripts are placed below and above the node, not besides it. This is activated when \sum\limits_{sub}^{sup} is used in LaTeX instead of simply \sum_{sub}^{sup} | |
JKQTMathTextNode & | operator= (const JKQTMathTextNode &)=delete |
virtual void | setDrawBoxes (bool draw) |
enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node | |
void | setParentNode (JKQTMathTextNode *node) |
parent node of this node (i.e. one level up, ode nullptr ) | |
void | setSubSuperscriptAboveBelowNode (bool __value) |
if true then following sub- and/or superscripts are placed below and above the node, not besides it. This is activated when \sum\limits_{sub}^{sup} is used in LaTeX instead of simply \sum_{sub}^{sup} | |
Static Public Member Functions | |
static int | getSymbolLength (const QString &symbolName) |
returns the length of the symbol string for the given symbol | |
static QStringList | getSymbols () |
return a list of all defined symbols | |
static bool | hasSymbol (const QString &symbolName) |
checks whether the given symbol name can be prepresented by this type of node | |
static bool | isExtendedWidthSymbol (const QString &symbolName) |
checks whether the given symbol has global flags SymbolFullProps::ExtendWidthInMathmode or SymbolFullProps::SmallExtendWidthInMathmode defined | |
static bool | isSubSuperscriptBelowAboveSymbol (const QString &symbolName) |
checks whether the given symbol name codes for an instruction that has SymbolFullProps::SubSuperscriptBelowAboveSymbol , does not neccessarily return the same value as JKQTMathTextNode::isSubSuperscriptAboveBelowNode() | |
Static Public Member Functions inherited from JKQTMathTextNode | |
static double | getNonItalicXCorretion (QPainter &painter, double width_potentiallyitalic, const JKQTMathTextEnvironment &ev_potentiallyitalic, const JKQTMathTextNode *child) |
calculates the x-size-difference between the given (probably) italic (width externally calculated: width_potentiallyitalic, ev_potentiallyitalic) and the non-italic version of child | |
Protected Types | |
enum | GlobalSymbolFlags : uint64_t { NoGLobalSymbolFlags = 0 , ExtendWidthInMathmode = 1 << 0 , SmallExtendWidthInMathmode = 1 << 1 , MakeWhitespaceHalf = 1 << 2 , IntLikeSymbolCorrection = 1 << 3 , SubSuperscriptBelowAboveSymbol = 1 << 4 , SubscriptCorrection = 1 << 5 } |
flags specifying additional symbol features More... | |
enum | SymbolFlags : uint64_t { AsOutside = 0 , ItalicOn = 1 << 0 , ItalicOff = 1 << 1 , BoldOn = 1 << 2 , BoldOff = 1 << 3 , DrawLeftHBar = 1 << 4 , DrawRightHBar = 1 << 5 , FlipSymbolUpDown =1 << 6 , FlipSymbolLeftRight =1 << 7 , RotateSymbol90 =1 << 8 , DrawSlash =1 << 9 , DrawBackSlash =1 << 10 , DrawVertLine =1 << 11 , HeightIsAscent = 1 << 12 , Upright =ItalicOff , NormalWeight =BoldOff } |
flags specifying additional symbol features More... | |
Protected Member Functions | |
virtual JKQTMathTextNodeSize | getSizeInternal (QPainter &painter, JKQTMathTextEnvironment currentEv) const override |
determine the size of the node, overwrite this function in derived classes | |
SymbolFullProps | getSymbolProp (const QString &symName, const JKQTMathTextEnvironment ¤tEv) const |
retrieve the properties to render the given symbol symName in the current environment currentEv | |
Protected Member Functions inherited from JKQTMathTextNode | |
void | addToErrorList (const QString &error) |
adds a new error to the JKQTMathText referenced by parentMathText | |
void | doDrawBoxes (QPainter &painter, double x, double y, const JKQTMathTextNodeSize &size) const |
draws colored boxes (for DEBUGGING) around the actual output of the node | |
void | doDrawBoxes (QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const |
draws colored boxes (for DEBUGGING) around the actual output of the node | |
template<class T > | |
QList< T * > | getParents () |
returns the list of parent, parent-of-parent, ... that can be cast to type T | |
template<class T > | |
QList< const T * > | getParents () const |
returns the list of parent, parent-of-parent, ... that can be cast to type T | |
Static Protected Member Functions | |
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_Unicode_Html and "up"+letterWinSymbol into symbols | |
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-encoding letterUnicode and in WinSymbol-encoding letterWinWsymbol | |
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 | |
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 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 account | |
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 and in WinSymbol-encoding letterWinWsymbol | |
static SymbolFullProps | MathOperatorSymbol (const QString &op) |
constructs a SymbolProps for a math-operator like \sin ..., i.e. ItalicOff, BoldOff, ExtendWidthInMathmode | |
static SymbolFullProps | MathOperatorSymbol (const QString &op, const QString &ophtml) |
constructs a SymbolProps with explicit HTML for a math-operator like \sin ..., i.e. ItalicOff, BoldOff, ExtendWidthInMathmode | |
static SymbolFullProps | MathOperatorSymbolUnicode (const QString &unicode) |
constructs a SymbolProps for a math-operator symbol like \pm ... in unicode-full-encoding, i.e. ItalicOff, BoldOff, ExtendWidthInMathmode | |
static SymbolFullProps | MathOperatorText (const QString &op) |
constructs a SymbolProps for a math-operator like \sin ..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode | |
static SymbolFullProps | MathOperatorText (const QString &op, const QString &ophtml) |
constructs a SymbolProps with explicit HTML for a math-operator like \sin ..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode | |
static SymbolFullProps | NarrowMathOperatorSymbolStd (const QString &symbol) |
constructs a SymbolProps for a narrow math-operator symbol like \pm ... in unicode-full-encoding, i.e. ItalicOff, BoldOff, SmallExtendWidthInMathmode | |
static SymbolFullProps | NarrowMathOperatorSymbolStd (const QString &symbol, const QString &symbolHTML) |
constructs a SymbolProps for a narrow math-operator symbol like \pm ... in unicode-full-encoding, i.e. ItalicOff, BoldOff, SmallExtendWidthInMathmode | |
static SymbolFullProps | NarrowMathOperatorSymbolUnicode (const QString &unicode) |
constructs a SymbolProps for a narrow math-operator symbol like \pm ... in unicode-full-encoding, i.e. ItalicOff, BoldOff, SmallExtendWidthInMathmode | |
static SymbolFullProps | NarrowMathOperatorText (const QString &op) |
constructs a SymbolProps for a narrow math-operator like \sin ..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode | |
static SymbolFullProps | NarrowMathOperatorText (const QString &op, const QString &ophtml) |
constructs a SymbolProps with explicit HTML for a narrow math-operator like \sin ..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode | |
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 is given | |
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::html the same text as asymbol is used | |
static SymbolFullProps | SimpleUprightTextSymbol (const QString &symbol) |
creates a SymbolFullProps object for a symbol that can be typeset in any font, for SymbolFullProps::html the same text as asymbol is used | |
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 is given | |
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 const QHash< QString, SymbolFullProps > & | symbols () |
symbols that can be generated in any standard-font | |
static SymbolFullProps | UnicodeSymbol (const QString &symbol, const QString &html) |
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a | |
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 | |
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 letterUnicode and in WinSymbol-encoding letterWinWsymbol | |
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 | UprightSymbolUnicode (const QString &symbol) |
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a | |
static SymbolFullProps | UprightSymbolUnicode (const QString &symbol, const QString &html) |
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a | |
Protected Attributes | |
QString | symbolName |
this string will be sent to the drawText method with properly set fonts | |
Protected Attributes inherited from JKQTMathTextNode | |
bool | drawBoxes |
enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node | |
JKQTMathText * | parentMathText |
parent JKQTMathText object (required for several drawing operations | |
JKQTMathTextNode * | parentNode |
parent node of this node (i.e. one level up, ode nullptr ) | |
bool | subSuperscriptAboveBelowNode |
if true then following sub- and/or superscripts are placed below and above the node, not besides it. This is activated when \sum\limits_{sub}^{sup} is used in LaTeX instead of simply \sum_{sub}^{sup} | |
Friends | |
bool | has (GlobalSymbolFlags a, GlobalSymbolFlags b) |
bool | has (SymbolFlags a, SymbolFlags b) |
GlobalSymbolFlags | operator& (GlobalSymbolFlags a, GlobalSymbolFlags b) |
SymbolFlags | operator& (SymbolFlags a, SymbolFlags b) |
GlobalSymbolFlags & | operator&= (GlobalSymbolFlags &a, GlobalSymbolFlags b) |
SymbolFlags & | operator&= (SymbolFlags &a, SymbolFlags b) |
GlobalSymbolFlags | operator^ (GlobalSymbolFlags a, GlobalSymbolFlags b) |
SymbolFlags | operator^ (SymbolFlags a, SymbolFlags b) |
GlobalSymbolFlags & | operator^= (GlobalSymbolFlags &a, GlobalSymbolFlags b) |
SymbolFlags & | operator^= (SymbolFlags &a, SymbolFlags b) |
GlobalSymbolFlags | operator| (GlobalSymbolFlags a, GlobalSymbolFlags b) |
SymbolFlags | operator| (SymbolFlags a, SymbolFlags b) |
GlobalSymbolFlags & | operator|= (GlobalSymbolFlags &a, GlobalSymbolFlags b) |
SymbolFlags & | operator|= (SymbolFlags &a, SymbolFlags b) |
GlobalSymbolFlags | operator~ (GlobalSymbolFlags a) |
SymbolFlags | operator~ (SymbolFlags a) |
subclass representing one symbol (e.g. \alpha
, \cdot
...) node in the syntax tree
All supported symbols are stored in the static table symbols, which is filled by fillSymbolTable(). The latter function is also the customization point for new symbols:
\alpha
the key "alpha"
is stored.Font Lookup for symbols works as follows in JKQTMathTextSymbolNode:
|
protected |
flags specifying additional symbol features
Enumerator | |
---|---|
NoGLobalSymbolFlags | indicates that no properties are activated |
ExtendWidthInMathmode | this symbol has an extended width, when used within a moth-environment/in math-mode |
SmallExtendWidthInMathmode | like ExtendWidthInMathmode but adds a smaller whitespace |
MakeWhitespaceHalf | symbol uses whitespaces in its text (SymbolProps::symbol). These should be typeset as half-spaces |
IntLikeSymbolCorrection | symbols, like |
SubSuperscriptBelowAboveSymbol | symbols, like |
SubscriptCorrection | symbols, like |
|
protected |
flags specifying additional symbol features
|
explicit |
|
overridevirtual |
|
staticprotected |
insert GreekLetter_WinSymbol_Unicode_Html() as baseInstructionName and UprightGreekLetter_WinSymbol_Unicode_Html and "up"+letterWinSymbol into symbols
|
staticprotected |
constructs a SymbolProps for a greek letter with the format from outside with the symbol in unicode-encoding letterUnicode and in WinSymbol-encoding letterWinWsymbol
|
overridevirtual |
draw the contents at the designated position
painter | QPainter to use |
x | x-position, where the drawing starts [Pixel] |
y | Y-position of the baseline, where the drawing starts [Pixel] |
currentEv | JKQTMathTextEnvironment object describing the current drawing environment/settings |
Implements JKQTMathTextNode.
|
staticprotected |
draw text at (0,0) using QPainter p and taking the flags from globalFlags into account
|
staticprotected |
calculates the bounding rect of text using fm and taking the flags from globalFlags into account
|
overrideprotectedvirtual |
determine the size of the node, overwrite this function in derived classes
painter | painter to use for determining the size |
currentEv | current environment object |
Implements JKQTMathTextNode.
|
static |
returns the length of the symbol string for the given symbol
QString JKQTMathTextSymbolNode::getSymbolName | ( | ) | const |
this string will be sent to the drawText method with properly set fonts
|
protected |
retrieve the properties to render the given symbol symName in the current environment currentEv
|
static |
return a list of all defined symbols
NodeSize JKQTMathTextSymbolNode::getSymbolSize | ( | QPainter & | painter, |
JKQTMathTextEnvironment | currentEv | ||
) | const |
determine the size of the node, calls getSizeInternal() implementation of the actual type
painter | painter to use for determining the size |
currentEv | current environment object |
|
staticprotected |
calculates the tight bounding rect of text using fm and taking the flags from globalFlags into account
|
overridevirtual |
return the name of this class as a string
Reimplemented from JKQTMathTextNode.
|
static |
checks whether the given symbol name can be prepresented by this type of node
|
static |
checks whether the given symbol has global flags SymbolFullProps::ExtendWidthInMathmode or SymbolFullProps::SmallExtendWidthInMathmode defined
|
static |
checks whether the given symbol name codes for an instruction that has SymbolFullProps::SubSuperscriptBelowAboveSymbol , does not neccessarily return the same value as JKQTMathTextNode::isSubSuperscriptAboveBelowNode()
|
staticprotected |
constructs a SymbolProps for an italic greek letter with the symbol in unicode-encoding letterUnicode and in WinSymbol-encoding letterWinWsymbol
|
staticprotected |
constructs a SymbolProps for a math-operator like \sin
..., i.e. ItalicOff, BoldOff, ExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps with explicit HTML for a math-operator like \sin
..., i.e. ItalicOff, BoldOff, ExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps for a math-operator symbol like \pm
... in unicode-full-encoding, i.e. ItalicOff, BoldOff, ExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps for a math-operator like \sin
..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps with explicit HTML for a math-operator like \sin
..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps for a narrow math-operator symbol like \pm
... in unicode-full-encoding, i.e. ItalicOff, BoldOff, SmallExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps for a narrow math-operator symbol like \pm
... in unicode-full-encoding, i.e. ItalicOff, BoldOff, SmallExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps for a narrow math-operator symbol like \pm
... in unicode-full-encoding, i.e. ItalicOff, BoldOff, SmallExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps for a narrow math-operator like \sin
..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode
|
staticprotected |
constructs a SymbolProps with explicit HTML for a narrow math-operator like \sin
..., i.e. ItalicOff, BoldOff, HeightIsAscent, ExtendWidthInMathmode
|
staticprotected |
creates a SymbolFullProps object for a symbol that can be typeset in any font, a special html-string is given
|
staticprotected |
creates a SymbolFullProps object for a symbol that can be typeset in any font, for SymbolFullProps::html the same text as asymbol is used
|
staticprotected |
creates a SymbolFullProps object for a symbol that can be typeset in any font, for SymbolFullProps::html the same text as asymbol is used
|
staticprotected |
creates a SymbolFullProps object for a symbol that can be typeset in any font, a special html-string is given
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
|
staticprotected |
symbols that can be generated in any standard-font
|
overridevirtual |
convert node to HTML and returns true
on success
[out] | html | new HTML code is APPENDED to this string |
currentEv | JKQTMathTextEnvironment object describing the current drawing environment/settings | |
defaultEv | JKQTMathTextEnvironment object describing the default drawing environment/settings when starting to interpret a node tree |
true
on success Reimplemented from JKQTMathTextNode.
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
|
staticprotected |
constructs a SymbolProps for an upright greek letter with the symbol in unicode-encoding letterUnicode and in WinSymbol-encoding letterWinWsymbol
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in Standard-fonts a
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
|
staticprotected |
constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
this string will be sent to the drawText method with properly set fonts