QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
Utility functions for text rendering. More...
#include <qgstextrendererutils.h>
Classes | |
class | CurvedGraphemePlacement |
Contains placement information for a single grapheme in a curved text layout. More... | |
class | CurvePlacementProperties |
Contains placement information for a curved text layout. More... | |
Public Types | |
enum class | CurvedTextFlag : int { TruncateStringWhenLineIsTooShort = 1 << 0 , UseBaselinePlacement = 1 << 1 , UprightCharactersOnly = 1 << 2 } |
Flags controlling behavior of curved text generation. More... | |
typedef QFlags< CurvedTextFlag > | CurvedTextFlags |
Flags controlling behavior of curved text generation. | |
enum | LabelLineDirection { RespectPainterOrientation , FollowLineDirection } |
Controls behavior of curved text with respect to line directions. More... | |
Static Public Member Functions | |
static Qgis::RenderUnit | convertFromOldLabelUnit (int val) |
Converts a unit from an old (pre 3.0) label unit. | |
static QgsTextBackgroundSettings::RotationType | decodeBackgroundRotationType (const QString &string) |
Decodes a string representation of a background rotation type to a type. | |
static QgsTextBackgroundSettings::SizeType | decodeBackgroundSizeType (const QString &string) |
Decodes a string representation of a background size type to a type. | |
static QgsTextShadowSettings::ShadowPlacement | decodeShadowPlacementType (const QString &string) |
Decodes a string representation of a shadow placement type to a type. | |
static QgsTextBackgroundSettings::ShapeType | decodeShapeType (const QString &string) |
Decodes a string representation of a background shape type to a type. | |
static Qgis::TextOrientation | decodeTextOrientation (const QString &name, bool *ok=nullptr) |
Attempts to decode a string representation of a text orientation. | |
static QString | encodeTextOrientation (Qgis::TextOrientation orientation) |
Encodes a text orientation. | |
static std::unique_ptr< CurvePlacementProperties > | generateCurvedTextPlacement (const QgsPrecalculatedTextMetrics &metrics, const double *x, const double *y, int numPoints, const std::vector< double > &pathDistances, double offsetAlongLine, LabelLineDirection direction=RespectPainterOrientation, double maxConcaveAngle=-1, double maxConvexAngle=-1, CurvedTextFlags flags=CurvedTextFlags()) |
Calculates curved text placement properties. | |
static std::unique_ptr< CurvePlacementProperties > | generateCurvedTextPlacement (const QgsPrecalculatedTextMetrics &metrics, const QPolygonF &line, double offsetAlongLine, LabelLineDirection direction=RespectPainterOrientation, double maxConcaveAngle=-1, double maxConvexAngle=-1, CurvedTextFlags flags=CurvedTextFlags()) |
Calculates curved text placement properties. | |
static QColor | readColor (QgsVectorLayer *layer, const QString &property, const QColor &defaultColor=Qt::black, bool withAlpha=true) |
Converts an encoded color value from a layer property. | |
Utility functions for text rendering.
Definition at line 31 of file qgstextrendererutils.h.
typedef QFlags< CurvedTextFlag > QgsTextRendererUtils::CurvedTextFlags |
Flags controlling behavior of curved text generation.
Definition at line 161 of file qgstextrendererutils.h.
|
strong |
Flags controlling behavior of curved text generation.
Definition at line 149 of file qgstextrendererutils.h.
Controls behavior of curved text with respect to line directions.
Definition at line 138 of file qgstextrendererutils.h.
|
static |
Converts a unit from an old (pre 3.0) label unit.
Definition at line 132 of file qgstextrendererutils.cpp.
|
static |
Decodes a string representation of a background rotation type to a type.
Definition at line 61 of file qgstextrendererutils.cpp.
|
static |
Decodes a string representation of a background size type to a type.
Definition at line 48 of file qgstextrendererutils.cpp.
|
static |
Decodes a string representation of a shadow placement type to a type.
Definition at line 78 of file qgstextrendererutils.cpp.
|
static |
Decodes a string representation of a background shape type to a type.
Definition at line 20 of file qgstextrendererutils.cpp.
|
static |
Attempts to decode a string representation of a text orientation.
name | encoded text orientation name |
ok | if specified, will be set to true if the name was successfully decoded |
Definition at line 113 of file qgstextrendererutils.cpp.
|
static |
Encodes a text orientation.
Definition at line 99 of file qgstextrendererutils.cpp.
|
static |
Calculates curved text placement properties.
metrics | precalculated text metrics for text to render |
x | array of linestring x coordinates |
y | array of linestring y coordinates |
numPoints | number of points in x, y arrays |
pathDistances | vector of precalculated distances between vertices in x, y arrays |
offsetAlongLine | offset along line at which to start the curved text placement |
direction | controls placement of text with respect to painter orientation or line direction |
maxConcaveAngle | maximum angle between characters for concave text, or -1 if not set |
maxConvexAngle | maximum angle between characters for convex text, or -1 if not set |
flags | flags controlling behavior of curved text generation |
nullptr
if placement could not be calculated. Caller takes ownership of the returned placement. Definition at line 189 of file qgstextrendererutils.cpp.
|
static |
Calculates curved text placement properties.
metrics | precalculated text metrics for text to render |
line | line to render text along |
offsetAlongLine | offset along line at which to start the curved text placement |
direction | controls placement of text with respect to painter orientation or line direction |
maxConcaveAngle | maximum angle between characters for concave text, or -1 if not set |
maxConvexAngle | maximum angle between characters for convex text, or -1 if not set |
flags | flags controlling behavior of curved text generation |
nullptr
if placement could not be calculated. Caller takes ownership of the returned placement. Definition at line 155 of file qgstextrendererutils.cpp.
|
static |
Converts an encoded color value from a layer property.
Definition at line 146 of file qgstextrendererutils.cpp.