Class: FontSymbol

ol.style. FontSymbol

A marker style to use with font symbols.


new FontSymbol(options)

Parameters:
Name Type Description
options

Options.

Properties
Name Type Argument Default Description
color string <optional>

default #000

glyph string

the glyph name or a char to display as symbol. The name must be added using the ol.style.FontSymbol.addDefs function.

text string <optional>

a text to display as a glyph

font string <optional>

font to use with the text option

form string

none|circle|poi|bubble|marker|coma|shield|blazon|bookmark|hexagon|diamond|triangle|sign|ban|lozenge|square a form that will enclose the glyph, default none

radius number
rotation number
rotateWithView boolean
declutterMode string <optional>

Declutter mode "declutter" | "obstacle" | "none" | undefined

opacity number <optional>
1
fontSize number <optional>
1

size of the font compare to the radius, fontSize greater than 1 will exceed the symbol extent

fontStyle string <optional>

the font style (bold, italic, bold italic, etc), default none

gradient boolean

true to display a gradient on the symbol

displacement Array.<number> <optional>

to use with ol > 6

offsetX number <optional>
0

Horizontal offset in pixels, deprecated use displacement with ol>6

offsetY number <optional>
0

Vertical offset in pixels, deprecated use displacement with ol>6

fill _ol_style_Fill_
stroke _ol_style_Stroke_
Implements:
  • ol.structs.IHasChecksum

Extends

  • ol.style.RegularShape

Members


<static> defs

Font defs

Methods


<static> addDefs(font, glyphs)

Static function : add new font defs

Parameters:
Name Type Description
font String | Object

the font name or a description ({ font: font_name, name: font_name, copyright: '', prefix })

glyphs Object

a key / value list of glyph definitions. Each key is the name of the glyph, the value is an object that code the font, the caracter code, the name and a search string for the glyph. { char: the char, code: the char code (if no char), theme: a theme for search puposes, name: the symbol name, search: a search string (separated with ',') }


clone()

Clones the style.

Returns:
Type
ol.style.FontSymbol

getChecksum()


getFill()

Get the fill style for the symbol.

Returns:

Fill style.

Type
ol.style.Fill

getFontInfo()

Get the stroke style for the symbol.

Returns:

Stroke style.

Type
_ol_style_Stroke_

getGlyph(name)

Get the glyph definition for the symbol.

Parameters:
Name Type Description
name string | undefined

a glyph name to get the definition, default return the glyph definition for the style.

Returns:
Type
*

getGlyphName()

Get the glyph name.

Returns:

the name

Type
string

getImage(pixelRatio)

Get the image icon.

Parameters:
Name Type Description
pixelRatio number

Pixel ratio.

Returns:

Image or Canvas element.

Type
HTMLCanvasElement

getStroke()

Get the stroke style for the symbol.

Returns:

Stroke style.

Type
_ol_style_Stroke_

getTextGlyph(text [, font])

Get glyph definition given a text and a font

Parameters:
Name Type Argument Description
text string | undefined
font string <optional>

the font for the text

Returns:
Type
*