QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
Contains pre-calculated metrics of a QgsTextDocument. More...
#include <qgstextdocumentmetrics.h>
Public Member Functions | |
double | ascentOffset () const |
Returns the ascent offset of the first block in the document. More... | |
double | baselineOffset (int blockIndex, Qgis::TextLayoutMode mode) const |
Returns the offset from the top of the document to the text baseline for the given block index. More... | |
double | blockHeight (int blockIndex) const |
Returns the height of the block at the specified index. More... | |
double | blockMaximumCharacterWidth (int blockIndex) const |
Returns the maximum character width for the specified block. More... | |
double | blockMaximumDescent (int blockIndex) const |
Returns the maximum descent encountered in the specified block. More... | |
double | blockWidth (int blockIndex) const |
Returns the width of the block at the specified index. More... | |
QSizeF | documentSize (Qgis::TextLayoutMode mode, Qgis::TextOrientation orientation) const |
Returns the overall size of the document. More... | |
QFont | fragmentFont (int blockIndex, int fragmentIndex) const |
Returns the calculated font for the fragment at the specified block and fragment indices. More... | |
double | verticalOrientationXOffset (int blockIndex) const |
Returns the vertical orientation x offset for the specified block. More... | |
Static Public Member Functions | |
static QgsTextDocumentMetrics | calculateMetrics (const QgsTextDocument &document, const QgsTextFormat &format, const QgsRenderContext &context, double scaleFactor=1.0) |
Returns precalculated text metrics for a text document, when rendered using the given base format and render context. More... | |
Contains pre-calculated metrics of a QgsTextDocument.
Definition at line 40 of file qgstextdocumentmetrics.h.
|
inline |
Returns the ascent offset of the first block in the document.
Definition at line 98 of file qgstextdocumentmetrics.h.
double QgsTextDocumentMetrics::baselineOffset | ( | int | blockIndex, |
Qgis::TextLayoutMode | mode | ||
) | const |
Returns the offset from the top of the document to the text baseline for the given block index.
Definition at line 239 of file qgstextdocumentmetrics.cpp.
double QgsTextDocumentMetrics::blockHeight | ( | int | blockIndex | ) | const |
Returns the height of the block at the specified index.
Definition at line 234 of file qgstextdocumentmetrics.cpp.
double QgsTextDocumentMetrics::blockMaximumCharacterWidth | ( | int | blockIndex | ) | const |
Returns the maximum character width for the specified block.
Definition at line 258 of file qgstextdocumentmetrics.cpp.
double QgsTextDocumentMetrics::blockMaximumDescent | ( | int | blockIndex | ) | const |
Returns the maximum descent encountered in the specified block.
Definition at line 263 of file qgstextdocumentmetrics.cpp.
double QgsTextDocumentMetrics::blockWidth | ( | int | blockIndex | ) | const |
Returns the width of the block at the specified index.
Definition at line 229 of file qgstextdocumentmetrics.cpp.
|
static |
Returns precalculated text metrics for a text document, when rendered using the given base format and render context.
The optional scaleFactor parameter can specify a font size scaling factor. It is recommended to set this to QgsTextRenderer::FONT_WORKAROUND_SCALE and then manually calculations based on the resultant font metrics. Failure to do so will result in poor quality text rendering at small font sizes.
Definition at line 26 of file qgstextdocumentmetrics.cpp.
QSizeF QgsTextDocumentMetrics::documentSize | ( | Qgis::TextLayoutMode | mode, |
Qgis::TextOrientation | orientation | ||
) | const |
Returns the overall size of the document.
Definition at line 204 of file qgstextdocumentmetrics.cpp.
QFont QgsTextDocumentMetrics::fragmentFont | ( | int | blockIndex, |
int | fragmentIndex | ||
) | const |
Returns the calculated font for the fragment at the specified block and fragment indices.
Definition at line 268 of file qgstextdocumentmetrics.cpp.
double QgsTextDocumentMetrics::verticalOrientationXOffset | ( | int | blockIndex | ) | const |
Returns the vertical orientation x offset for the specified block.
Definition at line 253 of file qgstextdocumentmetrics.cpp.