Skip to content
Permalink
Browse files

[BUGFIX] Read SLD TextSymbolizer set units to pixels

  • Loading branch information
rldhont authored and Gustry committed Jan 10, 2020
1 parent 95135f9 commit 770a4906c731f35b5d4e2d2a4064ec40f7e44c39
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/core/qgsvectorlayer.cpp
@@ -4332,6 +4332,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet

QString fontFamily = QStringLiteral( "Sans-Serif" );
int fontPointSize = 10;
QgsUnitTypes::RenderUnit fontUnitSize = QgsUnitTypes::RenderPoints;
int fontWeight = -1;
bool fontItalic = false;
bool fontUnderline = false;
@@ -4358,7 +4359,10 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
bool ok;
int fontSize = it.value().toInt( &ok );
if ( ok )
{
fontPointSize = fontSize;
fontUnitSize = QgsUnitTypes::RenderPixels;
}
}
else if ( it.key() == QLatin1String( "font-weight" ) )
{
@@ -4377,6 +4381,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
font.setUnderline( fontUnderline );
format.setFont( font );
format.setSize( fontPointSize );
format.setSizeUnit( fontUnitSize );

// Fill
QDomElement fillElem = textSymbolizerElem.firstChildElement( QStringLiteral( "Fill" ) );
@@ -4406,6 +4411,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
if ( ok )
{
bufferSettings.setSize( bufferSize );
bufferSettings.setSizeUnit( QgsUnitTypes::RenderPixels );
}
}

@@ -4441,6 +4447,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
if ( ok )
{
settings.xOffset = xOffset;
settings.offsetUnits = QgsUnitTypes::RenderPixels;
}
}
QDomElement displacementYElem = displacementElem.firstChildElement( QStringLiteral( "DisplacementY" ) );
@@ -4451,6 +4458,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
if ( ok )
{
settings.yOffset = yOffset;
settings.offsetUnits = QgsUnitTypes::RenderPixels;
}
}
}
@@ -4465,6 +4473,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
if ( ok )
{
settings.xOffset = xOffset;
settings.distUnits = QgsUnitTypes::RenderPixels;
}
}
QDomElement anchorPointYElem = anchorPointElem.firstChildElement( QStringLiteral( "AnchorPointY" ) );
@@ -4475,6 +4484,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
if ( ok )
{
settings.yOffset = yOffset;
settings.distUnits = QgsUnitTypes::RenderPixels;
}
}
}

0 comments on commit 770a490

Please sign in to comment.
You can’t perform that action at this time.