TextSymbol Class

  • TextSymbol
  • class Esri::ArcGISRuntime::TextSymbol

    Used to display text at points on a layer. More...

    Header: #include <TextSymbol.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::MarkerSymbol

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

    TextSymbol(const QString &text, const QColor &color, float size, Esri::ArcGISRuntime::HorizontalAlignment hAlign, Esri::ArcGISRuntime::VerticalAlignment vAlign, QObject *parent = nullptr)
    TextSymbol(QObject *parent = nullptr)
    virtual ~TextSymbol() override
    QColor backgroundColor() const
    QColor color() const
    Esri::ArcGISRuntime::FontDecoration fontDecoration() const
    QString fontFamily() const
    Esri::ArcGISRuntime::FontStyle fontStyle() const
    Esri::ArcGISRuntime::FontWeight fontWeight() const
    QColor haloColor() const
    float haloWidth() const
    Esri::ArcGISRuntime::HorizontalAlignment horizontalAlignment() const
    bool isKerningEnabled() const
    QColor outlineColor() const
    float outlineWidth() const
    void setBackgroundColor(const QColor &backgroundColor)
    void setColor(const QColor &color)
    void setFontDecoration(Esri::ArcGISRuntime::FontDecoration fontDecoration)
    void setFontFamily(const QString &fontFamily)
    void setFontStyle(Esri::ArcGISRuntime::FontStyle fontStyle)
    void setFontWeight(Esri::ArcGISRuntime::FontWeight fontWeight)
    void setHaloColor(const QColor &haloColor)
    void setHaloWidth(float haloWidth)
    void setHorizontalAlignment(Esri::ArcGISRuntime::HorizontalAlignment hAlign)
    void setKerningEnabled(bool kerningEnabled)
    void setOutlineColor(const QColor &outlineColor)
    void setOutlineWidth(float outlineWidth)
    void setSize(float size)
    void setText(const QString &text)
    void setVerticalAlignment(Esri::ArcGISRuntime::VerticalAlignment vAlign)
    float size() const
    QString text() const
    Esri::ArcGISRuntime::VerticalAlignment verticalAlignment() const

    Detailed Description

    Text symbols are used to display text for graphics. The graphics can be based on any type of geometry - point, multipoint, polyline, or polygon.

    Example:

    Create a TextSymbol and apply it to a Graphic:

    TextSymbol* textSymbol = new TextSymbol("Redlands", QColor(Qt::black), 12.0, HorizontalAlignment::Right, VerticalAlignment::Middle, this);
    Point point(-117,34);
    Graphic* graphic = new Graphic(point, textSymbol, this);

    Member Function Documentation

    TextSymbol::TextSymbol(const QString &text, const QColor &color, float size, Esri::ArcGISRuntime::HorizontalAlignment hAlign, Esri::ArcGISRuntime::VerticalAlignment vAlign, QObject *parent = nullptr)

    Constructs a text symbol providing its text, color, size, hAlign, vAlign, and optional parent.

    TextSymbol::TextSymbol(QObject *parent = nullptr)

    Default constructor with an optional parent.

    [override virtual] TextSymbol::~TextSymbol()

    Destructor.

    QColor TextSymbol::backgroundColor() const

    Returns the color for the text symbol background.

    See also setBackgroundColor().

    QColor TextSymbol::color() const

    Returns the color of the text.

    See also setColor().

    Esri::ArcGISRuntime::FontDecoration TextSymbol::fontDecoration() const

    Returns the font decoration of the text.

    See also setFontDecoration().

    QString TextSymbol::fontFamily() const

    Returns the font family for the text.

    See also setFontFamily().

    Esri::ArcGISRuntime::FontStyle TextSymbol::fontStyle() const

    Returns the font style for the text.

    Returns FontStyle::Normal if an error occurs.

    See also setFontStyle().

    Esri::ArcGISRuntime::FontWeight TextSymbol::fontWeight() const

    Returns the font weight for the text.

    Returns FontWeight::Normal if an error occurs.

    See also setFontWeight().

    QColor TextSymbol::haloColor() const

    Gets the color of the halo.

    See also setHaloColor().

    float TextSymbol::haloWidth() const

    Gets the width of the halo in device independent pixels (DIPs).

    See also setHaloWidth().

    Esri::ArcGISRuntime::HorizontalAlignment TextSymbol::horizontalAlignment() const

    Returns the horizontal alignment for the text.

    Returns HorizontalAlignment::Center if an error occurs.

    See also setHorizontalAlignment().

    bool TextSymbol::isKerningEnabled() const

    Returns whether kerning (visual adjustments to the spacing between characters in the text) is enabled.

    The default value is false.

    QColor TextSymbol::outlineColor() const

    Gets the color of the outline.

    See also setOutlineColor().

    float TextSymbol::outlineWidth() const

    Gets the width of the outline in device independent pixels (DIPs).

    See also setOutlineWidth().

    void TextSymbol::setBackgroundColor(const QColor &backgroundColor)

    Sets the color for the text symbol background to backgroundColor.

    See also backgroundColor().

    void TextSymbol::setColor(const QColor &color)

    Sets the color of the text.

    See also color().

    void TextSymbol::setFontDecoration(Esri::ArcGISRuntime::FontDecoration fontDecoration)

    Sets the fontDecoration of the text.

    See also fontDecoration().

    void TextSymbol::setFontFamily(const QString &fontFamily)

    Sets the fontFamily for the text.

    See also fontFamily().

    void TextSymbol::setFontStyle(Esri::ArcGISRuntime::FontStyle fontStyle)

    Sets the fontStyle for the text.

    See also fontStyle().

    void TextSymbol::setFontWeight(Esri::ArcGISRuntime::FontWeight fontWeight)

    Sets the fontWeight for the text.

    See also fontWeight().

    void TextSymbol::setHaloColor(const QColor &haloColor)

    Sets the color of the halo to haloColor.

    See also haloColor().

    void TextSymbol::setHaloWidth(float haloWidth)

    Sets the width of the outline in device independent pixels (DIPs) to haloWidth.

    See also haloWidth().

    void TextSymbol::setHorizontalAlignment(Esri::ArcGISRuntime::HorizontalAlignment hAlign)

    Sets the hAlign for the text.

    See also horizontalAlignment().

    void TextSymbol::setKerningEnabled(bool kerningEnabled)

    Sets whether kerning (visual adjustments to the spacing between characters in the text) is enabled to kerningEnabled.

    The default value is false.

    See also isKerningEnabled().

    void TextSymbol::setOutlineColor(const QColor &outlineColor)

    Sets the color of the outline to outlineColor.

    See also outlineColor().

    void TextSymbol::setOutlineWidth(float outlineWidth)

    Sets the width of the outline in device independent pixels (DIPs) to outlineWidth.

    See also outlineWidth().

    void TextSymbol::setSize(float size)

    Sets the size of the text in device independent pixels (DIPs).

    See also size().

    void TextSymbol::setText(const QString &text)

    Sets the text to display for the symbol.

    See also text().

    void TextSymbol::setVerticalAlignment(Esri::ArcGISRuntime::VerticalAlignment vAlign)

    Sets the vAlign for the text.

    See also verticalAlignment().

    float TextSymbol::size() const

    Returns the size of the text in device independent pixels (DIPs).

    See also setSize().

    QString TextSymbol::text() const

    Returns the text to display for the symbol.

    See also setText().

    Esri::ArcGISRuntime::VerticalAlignment TextSymbol::verticalAlignment() const

    Returns the vertical alignment for the text.

    Returns VerticalAlignment::Middle if an error occurs.

    See also setVerticalAlignment().

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

    You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

    Your ArcGIS portal

    Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

    Your ArcGIS Location Platform dashboard

    Manage billing, monitor service usage, and access additional resources.

    Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

    Close