mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
Fix rendering of annotation text items in HTML mode when html content
is split into multiple lines
This commit is contained in:
parent
e8724fa45e
commit
c0ff7dc49a
@ -88,7 +88,7 @@ void QgsAnnotationPointTextItem::render( QgsRenderContext &context, QgsFeedback
|
||||
|
||||
QgsTextRenderer::drawText( pt, - angle * M_PI / 180.0,
|
||||
QgsTextRenderer::convertQtHAlignment( mAlignment ),
|
||||
displayText.split( '\n' ), context, mTextFormat );
|
||||
mTextFormat.allowHtmlFormatting() ? QStringList{displayText }: displayText.split( '\n' ), context, mTextFormat );
|
||||
}
|
||||
|
||||
bool QgsAnnotationPointTextItem::writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const
|
||||
@ -165,8 +165,8 @@ QgsRectangle QgsAnnotationPointTextItem::boundingBox( QgsRenderContext &context
|
||||
{
|
||||
const QString displayText = QgsExpression::replaceExpressionText( mText, &context.expressionContext(), &context.distanceArea() );
|
||||
|
||||
const double widthInPixels = QgsTextRenderer::textWidth( context, mTextFormat, displayText.split( '\n' ) );
|
||||
const double heightInPixels = QgsTextRenderer::textHeight( context, mTextFormat, displayText.split( '\n' ) );
|
||||
const double widthInPixels = QgsTextRenderer::textWidth( context, mTextFormat, mTextFormat.allowHtmlFormatting() ? QStringList{displayText }: displayText.split( '\n' ) );
|
||||
const double heightInPixels = QgsTextRenderer::textHeight( context, mTextFormat, mTextFormat.allowHtmlFormatting() ? QStringList{displayText }: displayText.split( '\n' ) );
|
||||
|
||||
// text size has already been calculated using any symbology reference scale factor above -- we need
|
||||
// to temporarily remove the reference scale here or we'll be undoing the scaling
|
||||
|
@ -96,7 +96,7 @@ void QgsAnnotationRectangleTextItem::render( QgsRenderContext &context, QgsFeedb
|
||||
context.setFlag( Qgis::RenderContextFlag::ApplyScalingWorkaroundForTextRendering, true );
|
||||
QgsTextRenderer::drawText( innerRect, 0,
|
||||
QgsTextRenderer::convertQtHAlignment( mAlignment ),
|
||||
displayText.split( '\n' ), context, mTextFormat, true,
|
||||
mTextFormat.allowHtmlFormatting() ? QStringList{displayText }: displayText.split( '\n' ), context, mTextFormat, true,
|
||||
QgsTextRenderer::convertQtVAlignment( mAlignment ),
|
||||
Qgis::TextRendererFlag::WrapLines );
|
||||
context.setFlag( Qgis::RenderContextFlag::ApplyScalingWorkaroundForTextRendering, prevWorkaroundFlag );
|
||||
|
Loading…
x
Reference in New Issue
Block a user