LibrePCB Developers Documentation
OverlineMarkupParser Class Referencefinal

Extract overlines of text with markup. More...

#include <overlinemarkupparser.h>

+ Collaboration diagram for OverlineMarkupParser:

Public Member Functions

 OverlineMarkupParser ()=delete
 
 OverlineMarkupParser (const OverlineMarkupParser &other)=delete
 
OverlineMarkupParseroperator= (const OverlineMarkupParser &rhs)=delete
 

Static Public Member Functions

static QVector< std::pair< int, int > > extract (const QString &input, QString &output) noexcept
 
static QVector< QLineF > calculate (const QString &text, const QFontMetricsF &fm, int flags, const QVector< std::pair< int, int > > &spans, QRectF &boundingRect) noexcept
 
static void process (const QString &input, const QFontMetricsF &fm, int flags, QString &output, QVector< QLineF > &overlines, QRectF &boundingRect) noexcept
 
static qreal getLineWidth (qreal heightPx) noexcept
 

Detailed Description

Extract overlines of text with markup.

Parses text like RST/!SHDN, removes the functional ! and returns the coordinates where to draw overlines instead.

Markup rules:

  1. A single ! toggles the overline on/off, depending on its previous state (initial state is off).
  2. The character / implicitly switches off the overline before rendering. This can be prevented by prefixing it with !.
  3. A double !! has no effect on overlines, they are rendered as a single !. In case of an odd number of ! (e.g. !!!), the last one toggles overline on/off.
  4. Any trailing ! have no effect, they are rendered as-is (bypassing rules 1 and 3).

Constructor & Destructor Documentation

◆ OverlineMarkupParser() [1/2]

◆ OverlineMarkupParser() [2/2]

OverlineMarkupParser ( const OverlineMarkupParser other)
delete

Member Function Documentation

◆ extract()

QVector< std::pair< int, int > > extract ( const QString &  input,
QString &  output 
)
staticnoexcept
+ Here is the call graph for this function:

◆ calculate()

QVector< QLineF > calculate ( const QString &  text,
const QFontMetricsF &  fm,
int  flags,
const QVector< std::pair< int, int > > &  spans,
QRectF &  boundingRect 
)
staticnoexcept

◆ process()

void process ( const QString &  input,
const QFontMetricsF &  fm,
int  flags,
QString &  output,
QVector< QLineF > &  overlines,
QRectF &  boundingRect 
)
staticnoexcept
+ Here is the caller graph for this function:

◆ getLineWidth()

qreal getLineWidth ( qreal  heightPx)
staticnoexcept
+ Here is the caller graph for this function:

◆ operator=()

OverlineMarkupParser & operator= ( const OverlineMarkupParser rhs)
delete

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