Skip to main content
Commonmark migration
Source Link

Works for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True // change to map units
valLabel.textFont.setPointSize(100000) // set font size
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

 

Points
MM
MapUnits
Percent

Works for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True // change to map units
valLabel.textFont.setPointSize(100000) // set font size
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

 

Points
MM
MapUnits
Percent

Works for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True // change to map units
valLabel.textFont.setPointSize(100000) // set font size
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

Points
MM
MapUnits
Percent

added 84 characters in body
Source Link
underdark
  • 84.5k
  • 22
  • 233
  • 415

Works for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True // change to map units
valLabel.textFont.setPointSize(100000) // set font size
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

Points
MM
MapUnits
Percent

Works for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

Points
MM
MapUnits
Percent

Works for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True // change to map units
valLabel.textFont.setPointSize(100000) // set font size
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

Points
MM
MapUnits
Percent

added 265 characters in body
Source Link
underdark
  • 84.5k
  • 22
  • 233
  • 415

CheckWorks for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

Points
MM
MapUnits
Percent

Check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

Points
MM
MapUnits
Percent

Works for me:

valLabel=QgsPalLayerSettings()
valLabel.readFromLayer(iface.activeLayer())
valLabel.fontSizeInMapUnits=True
valLabel.writeToLayer(iface.activeLayer())
iface.mapCanvas().refresh()

For the data-defined way check QgsPalLayerSettings::DataDefinedProperties FontSizeUnit

and enum QgsPalLayerSettings::SizeUnit

Units used for option sizes, before being converted to rendered sizes.

Enumerator

Points
MM
MapUnits
Percent

Source Link
underdark
  • 84.5k
  • 22
  • 233
  • 415
Loading