Skip to content

Commit

Permalink
Default to a much nicer font
Browse files Browse the repository at this point in the history
Ship the style database with a "Default" text format, so that users
get a nicer appearance when they first set labels on layers.

Fixes #16911, fixes #18804, fixes #32798
  • Loading branch information
nyalldawson committed May 14, 2021
1 parent 7951eb8 commit 0270a15
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions resources/symbology-style.xml
Expand Up @@ -5854,6 +5854,21 @@
<prop k="stops" v="0.25;254,204,92,255:0.5;253,141,60,255:0.75;240,59,32,255"/>
</colorramp>
</colorramps>
<textformats>
<textformat favorite="1" name="Default" addedVersion="32000">
<text-style fontSize="10" fontWeight="50" capitalization="0" textOpacity="1" fontWordSpacing="0" allowHtml="0" blendMode="0" namedStyle="Regular" fontKerning="1" multilineHeight="1" fontStrikeout="0" fontUnderline="0" fontSizeUnit="Point" textColor="50,50,50,255" fontSizeMapUnitScale="3x:0,0,0,0,0,0" previewBkgrdColor="255,255,255,255" fontItalic="0" fontLetterSpacing="0" fontFamily="Open Sans" textOrientation="horizontal">
<families>
<family name="Open Sans"/>
<family name="Liberation Sans"/>
<family name="Helvetica"/>
<family name="Arial"/>
<family name="Sans Serif"/>
</families>
</text-style>
<text-buffer bufferDraw="1" bufferSizeUnits="MM" bufferNoFill="1" bufferColor="255,255,249,255" bufferOpacity="1" bufferJoinStyle="128" bufferBlendMode="0" bufferSizeMapUnitScale="3x:0,0,0,0,0,0" bufferSize="1"/>
<shadow shadowRadiusUnit="MM" shadowOffsetGlobal="1" shadowDraw="0" shadowOffsetUnit="MM" shadowScale="100" shadowUnder="0" shadowOffsetMapUnitScale="3x:0,0,0,0,0,0" shadowOpacity="0.69999999999999996" shadowRadiusMapUnitScale="3x:0,0,0,0,0,0" shadowOffsetAngle="135" shadowOffsetDist="1" shadowBlendMode="6" shadowRadius="1.5" shadowColor="0,0,0,255" shadowRadiusAlphaOnly="0"/>
</textformat>
</textformats>
<labelsettings>
<labelsetting favorite="1" name="watercourses" addedVersion="32000">
<settings calloutType="simple">
Expand Down
6 changes: 4 additions & 2 deletions tests/src/python/test_qgspallabeling_base.py
Expand Up @@ -47,7 +47,8 @@
QgsVectorTileLayer,
QgsVectorTileBasicLabelingStyle,
QgsWkbTypes,
QgsVectorTileBasicLabeling
QgsVectorTileBasicLabeling,
QgsTextFormat
)

from qgis.testing import start_app, unittest
Expand Down Expand Up @@ -243,8 +244,9 @@ def defaultLayerSettings(self):
lyr.fieldName = 'text' # default in test data sources
font = self.getTestFont()
font.setPointSize(32)
format = lyr.format()
format = QgsTextFormat()
format.setFont(font)
format.setColor(QColor(0,0,0))
format.setNamedStyle('Roman')
format.setSize(32)
format.setSizeUnit(QgsUnitTypes.RenderPoints)
Expand Down

0 comments on commit 0270a15

Please sign in to comment.