28 : mText( fragment.text() != QStringLiteral(
"\ufffc" ) ? fragment.text() : QString() )
29 , mIsImage( fragment.text() == QStringLiteral(
"\ufffc" ) )
30 , mCharFormat( fragment.charFormat() )
56 if ( fontHasBeenUpdatedForFragment )
58 const QFontMetricsF fm( font );
59 return fm.horizontalAdvance( mText );
63 QFont updatedFont = font;
65 const QFontMetricsF fm( updatedFont );
66 return fm.horizontalAdvance( mText );
Contains information about the context of a rendering operation.
void updateFontForFormat(QFont &font, const QgsRenderContext &context, double scaleFactor=1.0) const
Updates the specified font in place, applying character formatting options which are applicable on a ...
void setText(const QString &text)
Sets the text content of the fragment.
QString text() const
Returns the text content of the fragment.
void setCharacterFormat(const QgsTextCharacterFormat &format)
Sets the character format for the fragment.
bool isImage() const
Returns true if the fragment represents an image.
double horizontalAdvance(const QFont &font, const QgsRenderContext &context, bool fontHasBeenUpdatedForFragment=false, double scaleFactor=1.0) const
Returns the horizontal advance associated with this fragment, when rendered using the specified base ...
QgsTextFragment(const QString &text=QString(), const QgsTextCharacterFormat &format=QgsTextCharacterFormat())
Constructor for QgsTextFragment, with the specified text and optional character format.
void applyCapitalization(Qgis::Capitalization capitalization)
Applies a capitalization style to the fragment's text.