16 #ifndef QGSTEXTMETRICS_H
17 #define QGSTEXTMETRICS_H
20 #include "qgis_core.h"
23 #include <QStringList>
45 : mGraphemes( graphemes )
46 , mCharacterHeight( characterHeight )
47 , mCharacterWidths( characterWidths )
59 int count()
const {
return static_cast< int >( mCharacterWidths.size() ); }
64 double characterWidth(
int position )
const {
return mCharacterWidths[position]; }
69 QStringList
graphemes()
const {
return mGraphemes; }
74 QString
grapheme(
int index )
const {
return mGraphemes.at( index ); }
79 void setGraphemeFormats(
const QVector< QgsTextCharacterFormat > &formats ) { mGraphemeFormats = formats; }
93 QStringList mGraphemes;
94 QVector< QgsTextCharacterFormat > mGraphemeFormats;
95 double mCharacterHeight = 0;
96 QVector< double > mCharacterWidths;
Contains precalculated properties regarding text metrics for text to be renderered at a later stage.
double characterHeight() const
Character height (actually font metrics height, not individual character height).
int graphemeFormatCount() const
Returns the number of grapheme formats available.
QgsTextCharacterFormat graphemeFormat(int index) const
Returns the character format for the grapheme at the specified index.
QgsPrecalculatedTextMetrics(const QStringList &graphemes, double characterHeight, const QVector< double > &characterWidths)
Constructor for QgsPrecalculatedTextMetrics.
QStringList graphemes() const
Returns the list of graphemes contained in the text.
int count() const
Returns the total number of characters.
double characterWidth(int position) const
Returns the width of the character at the specified position.
QString grapheme(int index) const
Returns the grapheme at the specified index.
void setGraphemeFormats(const QVector< QgsTextCharacterFormat > &formats)
Sets the character formats associated with the text graphemes().
Stores information relating to individual character formatting.