mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
274 lines
8.1 KiB
Plaintext
274 lines
8.1 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextdocumentmetrics.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsTextDocumentRenderContext
|
|
{
|
|
%Docstring(signature="appended")
|
|
Encapsulates the context in which a text document is to be rendered.
|
|
|
|
.. warning::
|
|
|
|
This API is not considered stable and may change in future QGIS versions.
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgstextdocumentmetrics.h"
|
|
%End
|
|
public:
|
|
|
|
Qgis::TextRendererFlags flags() const;
|
|
%Docstring
|
|
Returns associated text renderer flags.
|
|
|
|
.. seealso:: :py:func:`setFlags`
|
|
%End
|
|
|
|
void setFlags( Qgis::TextRendererFlags flags );
|
|
%Docstring
|
|
Sets associated text renderer flags.
|
|
|
|
.. seealso:: :py:func:`flags`
|
|
%End
|
|
|
|
double maximumWidth() const;
|
|
%Docstring
|
|
Returns the maximum width (in painter units) for rendered text.
|
|
|
|
This is used to control text wrapping, when the :py:class:`Qgis`.TextRendererFlag.WrapLines flag is set.
|
|
|
|
.. seealso:: :py:func:`setMaximumWidth`
|
|
%End
|
|
|
|
void setMaximumWidth( double width );
|
|
%Docstring
|
|
Sets the maximum width (in painter units) for rendered text.
|
|
|
|
This is used to control text wrapping, when the :py:class:`Qgis`.TextRendererFlag.WrapLines flag is set.
|
|
|
|
.. seealso:: :py:func:`maximumWidth`
|
|
%End
|
|
|
|
};
|
|
|
|
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,
|
|
const QgsTextDocumentRenderContext &documentContext = QgsTextDocumentRenderContext() );
|
|
%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:func:`QgsTextRenderer.calculateScaleFactorForFormat()` 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.
|
|
|
|
Since QGIS 3.40 the optional ``documentContext`` argument can be used to pass text renderer context to change the
|
|
logistics of the calculated metrics.
|
|
%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
|
|
|
|
const QgsTextDocument &document() const;
|
|
%Docstring
|
|
Returns the document associated with the calculated metrics.
|
|
|
|
Note that this may not exactly match the original document which was used in the call to :py:func:`~QgsTextDocumentMetrics.calculateMetrics`,
|
|
as certain settings (such as text wrapping) require restructuring the document.
|
|
|
|
.. versionadded:: 3.40
|
|
%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 :py:class:`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 firstLineCapHeight() const;
|
|
%Docstring
|
|
Returns the cap height for the first line of text.
|
|
|
|
.. versionadded:: 3.30
|
|
%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 fragmentFixedHeight( int blockIndex, int fragmentIndex, Qgis::TextLayoutMode mode ) const;
|
|
%Docstring
|
|
Returns the fixed height of the fragment at the specified block and fragment index, or -1 if the fragment does not have a fixed height.
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
double fragmentAscent( int blockIndex, int fragmentIndex, Qgis::TextLayoutMode mode ) const;
|
|
%Docstring
|
|
Returns the ascent of the fragment at the specified block and fragment index.
|
|
|
|
.. seealso:: :py:func:`fragmentDescent`
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
double fragmentDescent( int blockIndex, int fragmentIndex, Qgis::TextLayoutMode mode ) const;
|
|
%Docstring
|
|
Returns the descent of the fragment at the specified block and fragment index.
|
|
|
|
.. seealso:: :py:func:`fragmentAscent`
|
|
|
|
.. versionadded:: 3.42
|
|
%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.
|
|
|
|
.. seealso:: :py:func:`blockMaximumAscent`
|
|
%End
|
|
|
|
double blockMaximumAscent( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the maximum ascent encountered in the specified block.
|
|
|
|
.. seealso:: :py:func:`blockMaximumDescent`
|
|
|
|
.. versionadded:: 3.42
|
|
%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
|
|
|
|
double blockVerticalMargin( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the vertical margin for the specified block index.
|
|
|
|
If ``blockIndex`` >= 0 then the returned value will be the margin to place after the block.
|
|
If ``blockIndex`` < 0 then the returned value will be the margin to place before the first block.
|
|
|
|
.. seealso:: :py:func:`blockLeftMargin`
|
|
|
|
.. seealso:: :py:func:`blockRightMargin`
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
double blockLeftMargin( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the margin for the left side of the specified block index.
|
|
|
|
.. seealso:: :py:func:`blockVerticalMargin`
|
|
|
|
.. seealso:: :py:func:`blockRightMargin`
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
double blockRightMargin( int blockIndex ) const;
|
|
%Docstring
|
|
Returns the margin for the right side of the specified block index.
|
|
|
|
.. seealso:: :py:func:`blockVerticalMargin`
|
|
|
|
.. seealso:: :py:func:`blockLeftMargin`
|
|
|
|
.. versionadded:: 3.42
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/textrenderer/qgstextdocumentmetrics.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|