Skip to content

Commit

Permalink
Expose mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 2, 2024
1 parent 87ea588 commit 18b36cb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ Draws text at a point origin using the specified settings.
const QgsTextDocumentMetrics &metrics,
QgsRenderContext &context,
Qgis::TextHorizontalAlignment alignment,
double rotation );
double rotation,
Qgis::TextLayoutMode mode = Qgis::TextLayoutMode::Point );
%Docstring
Draws a text document at a point origin using the specified settings.

Expand All @@ -157,6 +158,7 @@ been calculated.
:param context: destination render context
:param alignment: horizontal alignment
:param rotation: text rotation
:param mode: optional layout mode (since QGIS 3.42)

.. versionadded:: 3.40
%End
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ Draws text at a point origin using the specified settings.
const QgsTextDocumentMetrics &metrics,
QgsRenderContext &context,
Qgis::TextHorizontalAlignment alignment,
double rotation );
double rotation,
Qgis::TextLayoutMode mode = Qgis::TextLayoutMode::Point );
%Docstring
Draws a text document at a point origin using the specified settings.

Expand All @@ -157,6 +158,7 @@ been calculated.
:param context: destination render context
:param alignment: horizontal alignment
:param rotation: text rotation
:param mode: optional layout mode (since QGIS 3.42)

.. versionadded:: 3.40
%End
Expand Down
4 changes: 2 additions & 2 deletions src/core/textrenderer/qgstextrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void QgsTextRenderer::drawText( QPointF point, double rotation, Qgis::TextHorizo
drawDocument( point, lFormat, metrics.document(), metrics, context, alignment, rotation );
}

void QgsTextRenderer::drawDocument( QPointF point, const QgsTextFormat &format, const QgsTextDocument &document, const QgsTextDocumentMetrics &metrics, QgsRenderContext &context, Qgis::TextHorizontalAlignment alignment, double rotation )
void QgsTextRenderer::drawDocument(QPointF point, const QgsTextFormat &format, const QgsTextDocument &document, const QgsTextDocumentMetrics &metrics, QgsRenderContext &context, Qgis::TextHorizontalAlignment alignment, double rotation , Qgis::TextLayoutMode mode)
{
Qgis::TextComponents components = Qgis::TextComponent::Text;
if ( format.background().enabled() )
Expand All @@ -148,7 +148,7 @@ void QgsTextRenderer::drawDocument( QPointF point, const QgsTextFormat &format,
components |= Qgis::TextComponent::Buffer;
}

drawParts( point, rotation, alignment, document, metrics, context, format, components, Qgis::TextLayoutMode::Point );
drawParts( point, rotation, alignment, document, metrics, context, format, components, mode );
}

void QgsTextRenderer::drawTextOnLine( const QPolygonF &line, const QString &text, QgsRenderContext &context, const QgsTextFormat &_format, double offsetAlongLine, double offsetFromLine )
Expand Down
4 changes: 3 additions & 1 deletion src/core/textrenderer/qgstextrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class CORE_EXPORT QgsTextRenderer
* \param context destination render context
* \param alignment horizontal alignment
* \param rotation text rotation
* \param mode optional layout mode (since QGIS 3.42)
*
* \since QGIS 3.40
*/
Expand All @@ -169,7 +170,8 @@ class CORE_EXPORT QgsTextRenderer
const QgsTextDocumentMetrics &metrics,
QgsRenderContext &context,
Qgis::TextHorizontalAlignment alignment,
double rotation );
double rotation,
Qgis::TextLayoutMode mode = Qgis::TextLayoutMode::Point );

/**
* Draws text along a line using the specified settings.
Expand Down

0 comments on commit 18b36cb

Please sign in to comment.