Contains pre-calculated metrics of a QgsTextDocument.
More...
#include <qgstextdocumentmetrics.h>
Contains pre-calculated metrics of a QgsTextDocument.
- Warning
- This API is not considered stable and may change in future QGIS versions.
- Since
- QGIS 3.28
Definition at line 41 of file qgstextdocumentmetrics.h.
◆ ascentOffset()
double QgsTextDocumentMetrics::ascentOffset |
( |
| ) |
const |
|
inline |
◆ baselineOffset()
Returns the offset from the top of the document to the text baseline for the given block index.
Definition at line 419 of file qgstextdocumentmetrics.cpp.
◆ blockHeight()
double QgsTextDocumentMetrics::blockHeight |
( |
int |
blockIndex | ) |
const |
◆ blockMaximumCharacterWidth()
double QgsTextDocumentMetrics::blockMaximumCharacterWidth |
( |
int |
blockIndex | ) |
const |
◆ blockMaximumDescent()
double QgsTextDocumentMetrics::blockMaximumDescent |
( |
int |
blockIndex | ) |
const |
◆ blockWidth()
double QgsTextDocumentMetrics::blockWidth |
( |
int |
blockIndex | ) |
const |
◆ calculateMetrics()
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 33 of file qgstextdocumentmetrics.cpp.
◆ documentSize()
◆ firstLineCapHeight()
double QgsTextDocumentMetrics::firstLineCapHeight |
( |
| ) |
const |
◆ fragmentFont()
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 473 of file qgstextdocumentmetrics.cpp.
◆ fragmentHorizontalAdvance()
double QgsTextDocumentMetrics::fragmentHorizontalAdvance |
( |
int |
blockIndex, |
|
|
int |
fragmentIndex, |
|
|
Qgis::TextLayoutMode |
mode |
|
) |
| const |
Returns the horizontal advance of the fragment at the specified block and fragment index.
- Since
- QGIS 3.30
Definition at line 437 of file qgstextdocumentmetrics.cpp.
◆ fragmentVerticalOffset()
double QgsTextDocumentMetrics::fragmentVerticalOffset |
( |
int |
blockIndex, |
|
|
int |
fragmentIndex, |
|
|
Qgis::TextLayoutMode |
mode |
|
) |
| const |
Returns the vertical offset from a text block's baseline which should be applied to the fragment at the specified index within that block.
- Since
- QGIS 3.30
Definition at line 442 of file qgstextdocumentmetrics.cpp.
◆ isNullFontSize()
bool QgsTextDocumentMetrics::isNullFontSize |
( |
| ) |
const |
|
inline |
Returns true
if the metrics could not be calculated because the text format has a null font size.
- Since
- QGIS 3.30
Definition at line 61 of file qgstextdocumentmetrics.h.
◆ outerBounds()
Returns the outer bounds of the document, which is the documentSize() adjusted to account for any text elements which fall outside of the usual document margins (such as super or sub script elements)
- Warning
- Currently this is only supported for the Qgis::TextLayoutMode::Labeling mode.
- Since
- QGIS 3.30
Definition at line 378 of file qgstextdocumentmetrics.cpp.
◆ verticalOrientationXOffset()
double QgsTextDocumentMetrics::verticalOrientationXOffset |
( |
int |
blockIndex | ) |
const |
The documentation for this class was generated from the following files: