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
Loading...
Searching...
No Matches

subclass representing one text node in the syntax tree More...

#include <jkqtmathtexttextnode.h>

Inheritance diagram for JKQTMathTextTextNode:
[legend]
Collaboration diagram for JKQTMathTextTextNode:
[legend]

Classes

struct  LayoutInfo
 describes the layout of the whole node More...
 

Public Member Functions

 JKQTMathTextTextNode (JKQTMathText *parent, const QString &text, bool addWhitespace, bool stripInnerWhitepace=false)
 
virtual ~JKQTMathTextTextNode () override
 
virtual double draw (QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const override
 draw the contents at the designated position
 
virtual QString getTypeName () const override
 return the name of this class as a string
 
void removeLeadingWhitespace ()
 remove leading whitespace, is used by simplifyJKQTMathTextNode()

 
void removeTrailingWhitespace ()
 remove trailing whitespace, is used by simplifyJKQTMathTextNode()
 
- Public Member Functions inherited from JKQTMathTextTextBaseNode
 JKQTMathTextTextBaseNode (JKQTMathText *parent, const QString &text)
 
virtual ~JKQTMathTextTextBaseNode () override
 
QString getText () const
 text-contents of the node
 
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
 
JKQTMathTextNodegetParentNode ()
 parent node of this node (i.e. one level up, ode nullptr )
 
const JKQTMathTextNodegetParentNode () 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}
 
JKQTMathTextNodeoperator= (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}
 

Protected Types

enum  FontMode {
  FMasDefined ,
  FMasDefinedForceUpright ,
  FMasDefinedOutline ,
  FMroman ,
  FMfallbackSymbol
}
 defines how a character shold be drawn, used by splitTextForLayout More...
 

Protected Member Functions

LayoutInfo calcLayout (QPainter &painter, JKQTMathTextEnvironment currentEv) const
 calculates the size of the node, much like JKQTMathTextNode::getSizeInternal(), but returns additional properties that can be reused for drawing
 
virtual JKQTMathTextNodeSize getSizeInternal (QPainter &painter, JKQTMathTextEnvironment currentEv) const override
 determine the size of the node, overwrite this function in derived classes
 
void splitTextForLayout (QPainter &painter, JKQTMathTextEnvironment currentEv, const QString &txt, QStringList &textpart, QList< FontMode > &fontMode) const
 split text for Math-Modelayout into sections, where each section has a defined way of output
 
virtual QString textTransform (const QString &text, const JKQTMathTextEnvironment &currentEv) const override
 transforms the text before sizing/drawing (may e.g. exchange special letters for other unicode symbols etc.)
 
- 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 const QHash< QChar, uint32_t > & blackboardUnicodeTable ()
 translation table for blackboard-font characters from "normal" Latin-1 encoding to unicode-encoding of blackboards
 

Additional Inherited Members

- 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 Attributes inherited from JKQTMathTextTextBaseNode
QString text
 text-contents of the node
 
- Protected Attributes inherited from JKQTMathTextNode
bool drawBoxes
 enables the drawing of colored boxes (for DEBUGGING) around the actual output of the node
 
JKQTMathTextparentMathText
 parent JKQTMathText object (required for several drawing operations
 
JKQTMathTextNodeparentNode
 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}
 

Detailed Description

subclass representing one text node in the syntax tree

Member Enumeration Documentation

◆ FontMode

defines how a character shold be drawn, used by splitTextForLayout

Enumerator
FMasDefined 

use current font

FMasDefinedForceUpright 

use current font, but force it upright (e.g. for digits in math mode)

FMasDefinedOutline 

use current font and draw as outline, e.g. used for simulating blackboard fonts

FMroman 

use JKQTMathText::getFontRoman()

FMfallbackSymbol 

use JKQTMathText::getFallbackFontSymbols()

Constructor & Destructor Documentation

◆ JKQTMathTextTextNode()

JKQTMathTextTextNode::JKQTMathTextTextNode ( JKQTMathText parent,
const QString &  text,
bool  addWhitespace,
bool  stripInnerWhitepace = false 
)
explicit

◆ ~JKQTMathTextTextNode()

virtual JKQTMathTextTextNode::~JKQTMathTextTextNode ( )
overridevirtual

Member Function Documentation

◆ blackboardUnicodeTable()

static const QHash< QChar, uint32_t > & JKQTMathTextTextNode::blackboardUnicodeTable ( )
staticprotected

translation table for blackboard-font characters from "normal" Latin-1 encoding to unicode-encoding of blackboards

◆ calcLayout()

LayoutInfo JKQTMathTextTextNode::calcLayout ( QPainter &  painter,
JKQTMathTextEnvironment  currentEv 
) const
protected

calculates the size of the node, much like JKQTMathTextNode::getSizeInternal(), but returns additional properties that can be reused for drawing

◆ draw()

virtual double JKQTMathTextTextNode::draw ( QPainter &  painter,
double  x,
double  y,
JKQTMathTextEnvironment  currentEv 
) const
overridevirtual

draw the contents at the designated position

Parameters
painterQPainter to use
xx-position, where the drawing starts [Pixel]
yY-position of the baseline, where the drawing starts [Pixel]
currentEvJKQTMathTextEnvironment object describing the current drawing environment/settings
Returns
the x position which to use for the next part of the text

Implements JKQTMathTextNode.

◆ getSizeInternal()

virtual JKQTMathTextNodeSize JKQTMathTextTextNode::getSizeInternal ( QPainter &  painter,
JKQTMathTextEnvironment  currentEv 
) const
overrideprotectedvirtual

determine the size of the node, overwrite this function in derived classes

Parameters
painterpainter to use for determining the size
currentEvcurrent environment object
Returns
all important box size parameters packed as JKQTMathTextNodeSize

Implements JKQTMathTextNode.

◆ getTypeName()

virtual QString JKQTMathTextTextNode::getTypeName ( ) const
overridevirtual

return the name of this class as a string

Reimplemented from JKQTMathTextNode.

◆ removeLeadingWhitespace()

void JKQTMathTextTextNode::removeLeadingWhitespace ( )

remove leading whitespace, is used by simplifyJKQTMathTextNode()

◆ removeTrailingWhitespace()

void JKQTMathTextTextNode::removeTrailingWhitespace ( )

remove trailing whitespace, is used by simplifyJKQTMathTextNode()

◆ splitTextForLayout()

void JKQTMathTextTextNode::splitTextForLayout ( QPainter &  painter,
JKQTMathTextEnvironment  currentEv,
const QString &  txt,
QStringList &  textpart,
QList< FontMode > &  fontMode 
) const
protected

split text for Math-Modelayout into sections, where each section has a defined way of output

Parameters
painterthe QPainter to use for sizing/drawing
currentEvthe environment that defines the formatting of the text
txtthe text to split up
[out]textpartthe input txt split up into sections
[out]fontModeformating of each section in textpart

◆ textTransform()

virtual QString JKQTMathTextTextNode::textTransform ( const QString &  text,
const JKQTMathTextEnvironment currentEv 
) const
overrideprotectedvirtual

transforms the text before sizing/drawing (may e.g. exchange special letters for other unicode symbols etc.)

Reimplemented from JKQTMathTextTextBaseNode.


The documentation for this class was generated from the following file: