Class: QgsTextRendererUtils

Utility functions for text rendering.

Added in version 3.10.

Enums

CurvedTextFlag

Flags controlling behavior of curved text generation.

Static Methods

decodeBackgroundRotationType

Decodes a string representation of a background rotation type to a type.

decodeBackgroundSizeType

Decodes a string representation of a background size type to a type.

decodeShadowPlacementType

Decodes a string representation of a shadow placement type to a type.

decodeShapeType

Decodes a string representation of a background shape type to a type.

decodeTextOrientation

Attempts to decode a string representation of a text orientation.

encodeTextOrientation

Encodes a text orientation.

class qgis.core.QgsTextRendererUtils[source]

Bases: object

class CurvedTextFlag(*values)

Bases: IntEnum

Flags controlling behavior of curved text generation.

Added in version 4.0..

  • TruncateStringWhenLineIsTooShort: When a string is too long for the line, truncate characters instead of aborting the placement

  • UseBaselinePlacement: Generate placement based on the character baselines instead of centers

  • UprightCharactersOnly: Permit upright characters only. If not present then upside down text placement is permitted.

  • ExtendLineToFitText: When a string is too long for the line, extend the line’s final segment to fit the entire string.

    Added in version 4.0.

class CurvedTextFlags
class CurvedTextFlags(f: Qgis.CurvedTextFlags | Qgis.CurvedTextFlag)
class CurvedTextFlags(a0: Qgis.CurvedTextFlags)

Bases: object

static decodeBackgroundRotationType(string: str | None) QgsTextBackgroundSettings.RotationType[source]

Decodes a string representation of a background rotation type to a type.

Parameters:

string (Optional[str])

Return type:

QgsTextBackgroundSettings.RotationType

static decodeBackgroundSizeType(string: str | None) QgsTextBackgroundSettings.SizeType[source]

Decodes a string representation of a background size type to a type.

Parameters:

string (Optional[str])

Return type:

QgsTextBackgroundSettings.SizeType

static decodeShadowPlacementType(string: str | None) QgsTextShadowSettings.ShadowPlacement[source]

Decodes a string representation of a shadow placement type to a type.

Parameters:

string (Optional[str])

Return type:

QgsTextShadowSettings.ShadowPlacement

static decodeShapeType(string: str | None) QgsTextBackgroundSettings.ShapeType[source]

Decodes a string representation of a background shape type to a type.

Parameters:

string (Optional[str])

Return type:

QgsTextBackgroundSettings.ShapeType

static decodeTextOrientation(name: str | None)[source]

Attempts to decode a string representation of a text orientation.

Parameters:
  • name (Optional[str]) -> (Qgis.TextOrientation) – encoded text orientation name

  • ok – if specified, will be set to True if the name was successfully decoded

Returns:

decoded text orientation

static encodeTextOrientation(orientation: Qgis.TextOrientation) str[source]

Encodes a text orientation.

Return type:

str

Returns:

encoded string

Parameters:

orientation (Qgis.TextOrientation)