Description
Font used for text symbols added to the graphics layer.
Class hierarchy
esri.symbol.Font
Constructor
Properties
| family |
String
|
Font family. |
| size |
String
|
Font size. Values can be in "pt", "px", "em", and "%". For example: "12pt", "12px", ".8em", "80%" |
| style |
String
|
Text style. See the Constants table for valid values. |
| variant |
String
|
Text variant. See the Constants table for valid values. |
| weight |
String
|
Text weight. See the Constants table for valid values. |
Constants
| STYLE_ITALIC |
Text is in italics. |
| STYLE_NORMAL |
Text style is normal. |
| STYLE_OBLIQUE |
Text is slanted. |
| VARIANT_NORMAL |
Text variant is normal. |
| VARIANT_SMALLCAPS |
Text is in all small caps. |
| WEIGHT_BOLD |
Text weight is bold. |
| WEIGHT_BOLDER |
Text weight is extra bold. |
| WEIGHT_LIGHTER |
Text weight is lighter than normal. |
| WEIGHT_NORMAL |
Text weight is normal. |
Methods
Constructor Detail
Creates a new Font object. This constructor takes no parameters.
Code snippets:
var font = new esri.symbol.Font();
esri.symbol.Font(size, style, variant, weight, family)
Creates a new Font object.
Parameters:
|
<Number>
size |
Required |
Font size.
|
|
<String>
style |
Required |
Font style. See Constants table for values.
|
|
<String>
variant |
Required |
Font variant. See Constants table for values.
|
|
<String>
weight |
Required |
Font weight. See Constants table for values.
|
|
<String>
family |
Required |
Font family.
|
Code snippets:
new esri.symbol.Font("20pt",esri.symbol.Font.STYLE_ITALIC,esri.symbol.Font.VARIANT_NORMAL,
esri.symbol.Font.WEIGHT_BOLD,"Courier");
Creates a new Font object using a JSON object.
Parameters:
|
<Object>
json |
Required |
JSON object representing the font.
|
Properties Detail
Font family.
Default value: Serif
Font size. Values can be in "pt", "px", "em", and "%". For example: "12pt", "12px", ".8em", "80%"
Default value: 10pt
Text style. See the Constants table for valid values.
Default value: STYLE_NORMAL
Text variant. See the Constants table for valid values.
Default value: VARIANT_NORMAL
Text weight. See the Constants table for valid values.
Default value: WEIGHT_NORMAL
Methods Detail
Sets the font family. The font family property does not work in Internet Explorer 7; Arial is always used.
Input Parameters:
|
<String> family |
Required |
Font family. |
Sets the font size.
Input Parameters:
|
<String> size |
Required |
Font size in points. |
Code snippets:
font.setSize("12pt");
Sets the font style.
Input Parameters:
|
<String> style |
Required |
Font style. See the Constants table for valid values. |
Sets the font variant.
Input Parameters:
|
<String> variant |
Required |
Font variant. See the Constants table for valid values. |
Sets the font weight.
Input Parameters:
|
<String> weight |
Required |
Font weight. See the Constants table for valid values. |
Code snippets:
font.setWeight(esri.symbol.Font.WEIGHT_BOLD);