TextSymbol

Defines how text is displayed using characteristics such as font, size, color, and position. To display text in a MapView or SceneView, create a TextSymbol. Specify whether a string or attribute value is displayed by the TextSymbol.text. Define the appearance and position of the text using TextSymbol.color, TextSymbol.size, TextSymbol.fontStyle, or TextSymbol.verticalAlignment, for example. Position the text by applying it to a Graphic based on any type of geometry - point, multipoint, polyline, or polygon. Add the graphic to the GraphicsOverlay.graphics collection and add the GraphicsOverlay to the MapView or SceneView collection of graphics overlays.

TextSymbol is also used to define the appearance of layer and grid based labels:

  • Layers such as FeatureLayer, ArcGISSceneLayer, or DynamicEntityLayer contain label definitions that specify how labels are displayed. You can use LabelDefinition.textSymbol to define a label appearance within a scale range. To display these labels, add a collection of these label definitions to a layer.

  • MapView can display a coordinate system grid with specific label styles at different resolutions. You can define the appearance of these labels using Grid.setTextSymbol(Int, Symbol).

Since

200.1.0

See also

Constructors

Link copied to clipboard
constructor()

Creates a text symbol with default values. The default values are:

constructor(text: String, color: Color, size: Float, horizontalAlignment: HorizontalAlignment, verticalAlignment: VerticalAlignment)

Creates a text symbol with the given size, text, and color along with the horizontal and vertical alignment relative to the mid-point of this symbol.

Properties

Link copied to clipboard

The color for the text symbol background. The default value is transparent.

Link copied to clipboard

The color for the text symbol. The default value is black.

Link copied to clipboard

The type of font decoration for the text symbol. The default value is FontDecoration.None. FontDecoration.None if an error occurs.

Link copied to clipboard

The font family of the text symbol. This can be as specific as 'arial' or as generic as 'sans-serif', for example.

Link copied to clipboard

The font style of the text symbol. The default value is FontStyle.Normal. Returns FontStyle.Normal if an error occurs.

Link copied to clipboard

The font weight of the text symbol. Font weight describes how thick or thin characters in text are displayed. The default value is FontWeight.Normal. Returns FontWeight.Normal if an error occurs.

Link copied to clipboard

The color for the halo around the text symbol. The default value is transparent.

Link copied to clipboard

The size of the halo around the text symbol in device-independent pixels (DIPs). The default value is 0.0.

Link copied to clipboard

The horizontal alignment of the text symbol relative to the symbol's mid-point location. The default value is HorizontalAlignment.Center. Returns HorizontalAlignment.Center if an error occurs.

Link copied to clipboard

If kerning needs to be enabled. It is disabled by default. Determines whether to adjust the spacing between characters in the text string.

Link copied to clipboard

The color for the text symbol outline.

Link copied to clipboard

The width of the text symbol outline in device-independent pixels (DIPs). The default value is 0.0.

Link copied to clipboard
var size: Float

The font size of the text symbol. The default value is 8.0.

Link copied to clipboard

The text of the text symbol. The default value is an empty string.

Link copied to clipboard

The vertical alignment of the text symbol relative to the symbol's mid-point location. The default value is VerticalAlignment.Middle. Returns VerticalAlignment.Middle if an error occurs.

Inherited properties

Link copied to clipboard

The angle (in degrees) that the marker symbol is rotated by. The marker symbol can be rotated relative to the map or the screen, depending on the MarkerSymbol.angleAlignment.

Link copied to clipboard

Indicates whether the marker symbol is rotated relative to the screen or map. If the value is SymbolAngleAlignment.Map, the marker symbol is rotated relative to the map and will be affected by the map's rotation. If the value is SymbolAngleAlignment.Screen, the marker symbol is rotated relative to the user's screen and is unaffected by the map's rotation.

Link copied to clipboard

The callout leader's X offset relative to the marker symbol.

Link copied to clipboard

The callout leader's Y offset relative to the marker symbol.

Link copied to clipboard

The offset X of the marker symbol relative to the graphic or feature's point geometry.

Link copied to clipboard

The offset Y of the marker symbol relative to the graphic or feature's point geometry.

Functions

Link copied to clipboard
open override fun clone(): TextSymbol

Clones the TextSymbol.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Inherited functions

Link copied to clipboard
suspend fun createSwatch(screenScale: Float, width: Float? = null, height: Float? = null, backgroundColor: Color = Color.transparent): Result<BitmapDrawable>

Creates a swatch of the symbol. This method will scale the symbol up or down in order to fit it in to the desired width and height of the swatch.

suspend fun createSwatch(screenScale: Float, width: Float, height: Float, geometry: Geometry, backgroundColor: Color = Color.transparent): Result<BitmapDrawable>

Creates a swatch of the symbol.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toJson(): String

Convert an object to JSON string.