A TextStyle describes how text should be formatted on the map.

TextStyle is not an actual type in the LuciadRIA API. This is only documentation of the the expected structure of an object in order to be considered a TextStyle.

All properties are optional.

Since

2012.1

Hierarchy

  • TextStyle

Properties

alignmentBaseline?: string

The baseline alignment of the text for the vertical anchoring of the text.. Allowed values are top, hanging, middle, alphabetic, ideographic and bottom. For more information about these values, please visit the W3 documentation for the html5 canvas "textBaseline" property.

angle?: number

The rotation of the text, clockwise in degrees. The text is rotated in view-space. This means the angle is not an orientation of the text with regards to the Earth's coordinate system, but a rotation in the plane of the screen. An angle with value 0 means the text is oriented straight up.

drapeTarget?: DrapeTarget

Whether the text should be draped on top of the terrain or a 3D tiles mesh (or both).

By default, a shape is draped if it has undefined or zero Z. Otherwise it will not be draped.

You can override the default behaviour by setting this flag. If you explicitly drape a 3D shape, its 2D "shadow" is painted on the terrain.

This setting is only relevant for 3D maps and is ignored for 2D maps.

Since

2022.1

draped?: boolean

Whether this text should be draped on top of the terrain.

This property only exists for backwards compatibility. You should use drapeTarget instead.

By default, a shape is draped if it has undefined or zero Z. Otherwise it will not be draped.

You can override the default behaviour by setting this flag true or false. If you explicitly drape a 3D shape, its 2D "shadow" is painted on the terrain.

This setting is only relevant for 3D maps and is ignored for 2D maps.

Since

2021.0

Deprecated

Use drapeTarget instead.

fill?: string

The fill color as a CSS color string. This is the color of the text itself.

font?: string

The font to use, as a CSS font string.

halo?: string

The halo color as a CSS color string. This is an outline around the text.

haloWidth?: number

The halo width.

occlusionMode?: OcclusionMode

When this text should be painted in 3D in relation to other 3D data.

Notes:

  • Mode OcclusionMode.VISIBLE_ONLY shows only the part of the text that is not obscured by other 3D data. This is the default.
  • Mode OcclusionMode.ALWAYS_VISIBLE shows the entire text even if behind by other 3D data. The text will appear in front of other objects.
  • Mode OcclusionMode.OCCLUDED_ONLY shows only the part of the text that is behind other 3D data. You typically use this to display obscured shapes in combination with another style that uses "VISIBLE" mode.
  • This parameter is only relevant in 3D.
  • This parameter is only applied on non-draped shapes.
  • When using extruded shapes or other non-flat shapes, a combination of "OCCLUDED_ONLY" and "VISIBLE_ONLY" only works with transparent colors.

Default

VISIBLE

Since

2021.0

offsetX?: number

The X offset in pixels that should be applied with respect to the location specified by the shape parameter.

offsetY?: number

the Y offset in pixels that should be applied wrt the location specified by the shape parameter. specified by the shape parameter.

stroke?: string

The stroke of the text. This is the outline of the text. It can partially overlap with the fill and halo.

strokeWidth?: number

the stroke width

textAnchor?: string

The horizontal anchoring of the text for the given location. Allowed values are "start", "end", "left", "right" and "center". The "left" or "start" means that the text will be anchored at the first character of the text-string. The "right" or "end" means the text will be anchored at the last character of the string. The "center" means the text will be centered on the anchor. The default value is start.

The value for textAnchor controls also how every element of a multi-line text is horizontally aligned.

Multi-line text with different textAnchor values

zOrder?: number

The Z-order of this shape. Shapes will be painted from lowest to highest Z-order.