Class: QgsFontMarkerSymbolLayer

class qgis.core.QgsFontMarkerSymbolLayer(fontFamily: str = '', chr: str = '', pointSize: float = DEFAULT_FONTMARKER_SIZE, color: Union[QColor, Qt.GlobalColor] = DEFAULT_FONTMARKER_COLOR, angle: float = DEFAULT_FONTMARKER_ANGLE)

Bases: QgsMarkerSymbolLayer

Constructs a font marker symbol layer.

Methods

bounds

param point

character

Returns the character(s) used when rendering points.

clone

rtype

QgsFontMarkerSymbolLayer

copyDataDefinedProperties

Copies all data defined properties of this layer to another symbol layer.

copyPaintEffect

Copies paint effect of this layer to another symbol layer

create

Creates a new QgsFontMarkerSymbolLayer from a property map (see properties())

createFromSld

Creates a new QgsFontMarkerSymbolLayer from an SLD XML element.

fontFamily

Returns the font family name for the associated font which will be used to render the point.

fontStyle

Returns the font style for the associated font which will be used to render the point.

layerType

rtype

str

markerOffset

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker's anchor point.

markerOffset2

markerOffsetWithWidthAndHeight

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker's anchor point.

penJoinStyle

Returns the stroke join style.

properties

rtype

Dict[str, Any]

renderPoint

param point

resolveFonts

Resolves fonts from a properties map, raising warnings in the specified context if the required fonts are not available on the system.

restoreOldDataDefinedProperties

Restores older data defined properties from string map.

setCharacter

Sets the character(s) used when rendering points.

setFontFamily

Sets the font family for the font which will be used to render the point.

setFontStyle

Sets the font style for the font which will be used to render the point.

setPenJoinStyle

Sets the stroke join style.

setStrokeColor

param color

setStrokeWidth

Set's the marker's stroke width.

setStrokeWidthMapUnitScale

Sets the stroke width map unit scale.

setStrokeWidthUnit

Sets the stroke width unit.

startRender

param context

stopRender

param context

strokeColor

rtype

QColor

strokeWidth

Returns the marker's stroke width.

strokeWidthMapUnitScale

Returns the stroke width map unit scale.

strokeWidthUnit

Returns the stroke width unit.

usesMapUnits

rtype

bool

writeSldMarker

param doc

bounds(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext) QRectF
Parameters
Return type

QRectF

character(self) str

Returns the character(s) used when rendering points.

See also

setCharacter()

Return type

str

clone(self) QgsFontMarkerSymbolLayer
Return type

QgsFontMarkerSymbolLayer

copyDataDefinedProperties(self, destLayer: QgsSymbolLayer)

Copies all data defined properties of this layer to another symbol layer.

Parameters

destLayer – destination layer

copyPaintEffect(self, destLayer: QgsSymbolLayer)

Copies paint effect of this layer to another symbol layer

Parameters

destLayer – destination layer

New in version 2.9.

create(properties: Dict[str, Any] = {}) QgsSymbolLayer

Creates a new QgsFontMarkerSymbolLayer from a property map (see properties())

Parameters

properties (Dict[str) –

Return type

QgsSymbolLayer

createFromSld(element: QDomElement) QgsSymbolLayer

Creates a new QgsFontMarkerSymbolLayer from an SLD XML element.

Parameters

element (QDomElement) –

Return type

QgsSymbolLayer

fontFamily(self) str

Returns the font family name for the associated font which will be used to render the point.

See also

setFontFamily()

Return type

str

fontStyle(self) str

Returns the font style for the associated font which will be used to render the point.

See also

setFontStyle()

New in version 3.14.

Return type

str

layerType(self) str
Return type

str

markerOffset(self, context: QgsSymbolRenderContext) Tuple[float, float]

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.

Parameters
  • context – symbol render context

  • offsetX – will be set to required horizontal offset (in painter units)

  • offsetY – will be set to required vertical offset (in painter units)

markerOffset2(self, context: QgsSymbolRenderContext, width: float, height: float, widthUnit: QgsUnitTypes.RenderUnit, heightUnit: QgsUnitTypes.RenderUnit, widthMapUnitScale: QgsMapUnitScale, heightMapUnitScale: QgsMapUnitScale) Tuple[float, float]

Note

available in Python bindings as markerOffset2

markerOffsetWithWidthAndHeight(self, context: QgsSymbolRenderContext, width: float, height: float) Tuple[float, float]

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.

Parameters
  • context – symbol render context

  • width – marker width

  • height – marker height

  • offsetX – will be set to required horizontal offset (in painter units)

  • offsetY – will be set to required vertical offset (in painter units)

Note

available in Python as markerOffsetWithWidthAndHeight

penJoinStyle(self) Qt.PenJoinStyle

Returns the stroke join style.

New in version 2.16.

Return type

Qt.PenJoinStyle

properties(self) Dict[str, Any]
Return type

Dict[str, Any]

renderPoint(self, point: Union[QPointF, QPoint], context: QgsSymbolRenderContext)
Parameters
resolveFonts(properties: Dict[str, Any], context: QgsReadWriteContext)

Resolves fonts from a properties map, raising warnings in the specified context if the required fonts are not available on the system.

New in version 3.20.

Parameters
restoreOldDataDefinedProperties(self, stringMap: Dict[str, Any])

Restores older data defined properties from string map.

New in version 3.0.

setCharacter(self, chr: str)

Sets the character(s) used when rendering points.

See also

character()

Parameters

chr (str) –

setFontFamily(self, family: str)

Sets the font family for the font which will be used to render the point.

See also

fontFamily()

Parameters

family (str) –

setFontStyle(self, style: str)

Sets the font style for the font which will be used to render the point.

See also

fontStyle()

New in version 3.14.

Parameters

style (str) –

setPenJoinStyle(self, style: Qt.PenJoinStyle)

Sets the stroke join style.

See also

penJoinStyle()

New in version 2.16.

Parameters

style (Qt.PenJoinStyle) –

setStrokeColor(self, color: Union[QColor, Qt.GlobalColor])
Parameters

color (Union[QColor) –

setStrokeWidth(self, width: float)

Set’s the marker’s stroke width. Units are set by setStrokeWidthUnit().

See also

strokeWidth()

New in version 2.16.

Parameters

width (float) –

setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)

Sets the stroke width map unit scale.

See also

setStrokeWidth()

New in version 2.16.

Parameters

scale (QgsMapUnitScale) –

setStrokeWidthUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the stroke width unit.

See also

setStrokeWidth()

New in version 2.16.

Parameters

unit (QgsUnitTypes.RenderUnit) –

startRender(self, context: QgsSymbolRenderContext)
Parameters

context (QgsSymbolRenderContext) –

stopRender(self, context: QgsSymbolRenderContext)
Parameters

context (QgsSymbolRenderContext) –

strokeColor(self) QColor
Return type

QColor

strokeWidth(self) float

Returns the marker’s stroke width. Units are retrieved by strokeWidthUnit()

See also

setStrokeWidth()

New in version 2.16.

Return type

float

strokeWidthMapUnitScale(self) QgsMapUnitScale

Returns the stroke width map unit scale.

See also

strokeWidth()

New in version 2.16.

Return type

QgsMapUnitScale

strokeWidthUnit(self) QgsUnitTypes.RenderUnit

Returns the stroke width unit.

See also

strokeWidth()

New in version 2.16.

Return type

QgsUnitTypes.RenderUnit

usesMapUnits(self) bool
Return type

bool

writeSldMarker(self, doc: QDomDocument, element: QDomElement, props: Dict[str, Any])
Parameters
  • doc (QDomDocument) –

  • element (QDomElement) –

  • props (Dict[str) –