Skip to content

Commit

Permalink
Merge pull request #733 from nsidc/buffer-copyright-text
Browse files Browse the repository at this point in the history
Buffer copyright text
  • Loading branch information
trey-stafford committed Aug 17, 2023
2 parents 69769b6 + ab2c8cd commit 7d4f204
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions qgreenland/util/qgis/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,29 @@ def _add_decorations(project: qgc.QgsProject) -> None:
project.writeEntry("CopyrightLabel", "/MarginH", 0)
project.writeEntry("CopyrightLabel", "/MarginV", 0)

# Add buffer around copyright text
# TODO: can we figure out a way to export `text_format` to xml so that it
# can be written to the project file without hard-coding everything? The
# `text_format` (`QgsTextFormat`) object has a `writeXml` method but it is
# unclear how to apply it to the project file:
# ```
# text_format = qgc.QgsTextFormat()
# buffer_settings = text_format.buffer()
# buffer_settings.setEnabled(True)
# text_format.setBuffer(buffer_settings)
# text_format.write_xml(...)
# ```
project.writeEntry(
"CopyrightLabel",
"/Font",
(
'<text-style><text-buffer bufferColor="250,250,250,255"'
' bufferJoinStyle="128" bufferSize="1" bufferDraw="1"'
' bufferSizeUnits="MM" bufferOpacity="1" bufferBlendMode="0"'
' bufferSizeMapUnitScale="3x:0,0,0,0,0,0" bufferNoFill="1"/></text-style>'
),
)

# Add Image (QGreenland logo):
project.writeEntry("Image", "/Enabled", True)
project.writeEntry("Image", "/Placement", 0)
Expand Down

0 comments on commit 7d4f204

Please sign in to comment.