mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-11 00:04:09 -04:00
This allows for either: - <sup>superscript</sup> / <sub>subscript</sub> components in text, where the text will be vertically super or subscript aligned and automatically sized to 2/3rd of the parent font size. Users can also set a fixed font size for the super/sub script by including css rules, e.g. <sup style="font-size:33pt">super</sup> - "vertical-align: super" or "vertical-align: sub" CSS formatting rules in any other HTML element Sponsored by OSGEO UK
131 lines
4.4 KiB
Plaintext
131 lines
4.4 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextdocumentmetrics.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsTextDocumentMetrics
|
|
{
|
|
%Docstring(signature="appended")
|
|
|
|
Contains pre-calculated metrics of a :py:class:`QgsTextDocument`.
|
|
|
|
.. warning::
|
|
|
|
This API is not considered stable and may change in future QGIS versions.
|
|
|
|
.. versionadded:: 3.28
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgstextdocumentmetrics.h"
|
|
%End
|
|
public:
|
|
|
|
static QgsTextDocumentMetrics calculateMetrics( const QgsTextDocument &document, const QgsTextFormat &format, const QgsRenderContext &context, double scaleFactor = 1.0 );
|
|
%Docstring
|
|
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
|
|
:py:class:`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.
|
|
%End
|
|
|
|
bool isNullFontSize() const;
|
|
%Docstring
|
|
Returns ``True`` if the metrics could not be calculated because the text format has a null font size.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
QSizeF documentSize( Qgis::TextLayoutMode mode, Qgis::TextOrientation orientation ) const;
|
|
%Docstring
|
|
Returns the overall size of the document.
|
|
%End
|
|
|
|
QRectF outerBounds( Qgis::TextLayoutMode mode, Qgis::TextOrientation orientation ) const;
|
|
%Docstring
|
|
Returns the outer bounds of the document, which is the :py:func:`~QgsTextDocumentMetrics.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.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
double blockWidth( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the width of the block at the specified index.
|
|
%End
|
|
|
|
double blockHeight( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the height of the block at the specified index.
|
|
%End
|
|
|
|
double baselineOffset( int blockIndex, Qgis::TextLayoutMode mode ) const;
|
|
%Docstring
|
|
Returns the offset from the top of the document to the text baseline for the given block index.
|
|
%End
|
|
|
|
double fragmentHorizontalAdvance( int blockIndex, int fragmentIndex, Qgis::TextLayoutMode mode ) const;
|
|
%Docstring
|
|
Returns the horizontal advance of the fragment at the specified block and fragment index.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
double fragmentVerticalOffset( int blockIndex, int fragmentIndex, Qgis::TextLayoutMode mode ) const;
|
|
%Docstring
|
|
Returns the vertical offset from a text block's baseline which should be applied
|
|
to the fragment at the specified index within that block.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
double verticalOrientationXOffset( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the vertical orientation x offset for the specified block.
|
|
%End
|
|
|
|
double blockMaximumCharacterWidth( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the maximum character width for the specified block.
|
|
%End
|
|
|
|
double blockMaximumDescent( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the maximum descent encountered in the specified block.
|
|
%End
|
|
|
|
QFont fragmentFont( int blockIndex, int fragmentIndex ) const;
|
|
%Docstring
|
|
Returns the calculated font for the fragment at the specified block and fragment indices.
|
|
%End
|
|
|
|
double ascentOffset() const;
|
|
%Docstring
|
|
Returns the ascent offset of the first block in the document.
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextdocumentmetrics.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|