require(["esri/symbols/Font"], function(Font) { /* code goes here */ });
Class: esri/symbols/Font
Inheritance: Font Accessor
Since: ArcGIS API for JavaScript 4.0

The font used to display text symbols added to the graphics layer.

Known Limitations

This class is not fully supported in 3D SceneViews.

See also:
Example:
var textSymbol = new TextSymbol({
  color: "white",
  haloColor: "black",
  haloSize: "1px",
  text: "You are here",
  xoffset: 3,
  yoffset: 3,
  font: {  // autocast as esri/symbols/Font
    size: 12,
    family: "sans-serif",
    weight: "bolder"
  }
});

Constructors

new Font(properties)

Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummary
String

The name of the class.

more details
more details
String

The text decoration.

more details
more details
String

The font family of the text.

more details
more details
Number

The font size in points.

more details
more details
String

The text style.

more details
more details
String

The text variant.

more details
more details
String

The text weight.

more details
more details

Property Details

declaredClassStringreadonly

The name of the class. The declared class name is formatted as esri.folder.className.

decorationString

The text decoration.

Possible Values: underline | line-through | none

Known Limitations

This property is not supported in 3D SceneViews.

Default Value: none

familyString

The font family of the text.

Default Value: serif
See also:

The font size in points. This value may be autocast with a string expressing size in points or pixels (e.g. 12px).

Default Value: 9
See also:
Examples:
// size in points
symbol.size = 14;
// size in pixels
symbol.size = "20px";
// size in points
symbol.size = "14pt";

styleString

The text style.

Possible Values: normal | italic | oblique

Default Value: normal
See also:

variantString

The text variant.

Possible Values: normal | small-caps

Known Limitations

This property is not supported in 3D SceneViews.

Default Value: normal
See also:

weightString

The text weight.

Possible Values: normal | bold | bolder | lighter

Default Value: normal
See also:

Method Overview

NameReturn TypeSummary
Font

Creates a deep clone of the font object.

more details
more details
*

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform.

more details
more details
Object

Converts an instance of this class to its ArcGIS Portal JSON representation.

more details
more details

Method Details

clone(){Font}

Creates a deep clone of the font object.

Returns:
TypeDescription
FontA deep clone of the object that invoked this method.

fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
TypeDescription
*Returns a new instance of this class.

toJSON(){Object}

Converts an instance of this class to its ArcGIS Portal JSON representation. See the Using fromJSON() topic in the Guide for more information.

Returns:
TypeDescription
ObjectThe ArcGIS Portal JSON representation of an instance of this class.

API Reference search results

NameTypeModule

There were no match results from your search criteria.