Class: FontE-mail This Topic Printable Version Give Us Feedback

Description

Font used for text symbols added to the graphics layer.

Class hierarchy

esri.symbol.Font

Constructor

Constructor Description
esri.symbol.Font() Creates a new Font object. This constructor takes no parameters.
esri.symbol.Font(size, style, variant, weight, family) Creates a new Font object.
esri.symbol.Font(json) Creates a new Font object using a JSON object.

Properties

Property Type Description
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

Constant Description
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

Method Return Value Description
setFamily(family) Font Sets the font family. The font family property does not work in Internet Explorer 7; Arial is always used.
setSize(size) Font Sets the font size.
setStyle(style) Font Sets the font style.
setVariant(variant) Font Sets the font variant.
setWeight(weight) Font Sets the font weight.
Constructor Detail

esri.symbol.Font()

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");

esri.symbol.Font(json)

Creates a new Font object using a JSON object.
Parameters:
<Object> json Required JSON object representing the font.
Properties Detail

<String> family

Font family.
Default value: Serif
See also:
setFamily  

<String> size

Font size. Values can be in "pt", "px", "em", and "%". For example: "12pt", "12px", ".8em", "80%"
Default value: 10pt
See also:
setSize  

<String> style

Text style. See the Constants table for valid values.
Default value: STYLE_NORMAL
See also:
setStyle  

<String> variant

Text variant. See the Constants table for valid values.
Default value: VARIANT_NORMAL
See also:
setVariant  

<String> weight

Text weight. See the Constants table for valid values.
Default value: WEIGHT_NORMAL
See also:
setWeight  
Methods Detail

setFamily(family)

Sets the font family. The font family property does not work in Internet Explorer 7; Arial is always used.
Return value: Font
Input Parameters:
<String> family Required Font family.
See also:
family  

setSize(size)

Sets the font size.
Return value: Font
Input Parameters:
<String> size Required Font size in points.
Code snippets:
font.setSize("12pt");

See also:
size  

setStyle(style)

Sets the font style.
Return value: Font
Input Parameters:
<String> style Required Font style. See the Constants table for valid values.
See also:
style  

setVariant(variant)

Sets the font variant.
Return value: Font
Input Parameters:
<String> variant Required Font variant. See the Constants table for valid values.
See also:
variant  

setWeight(weight)

Sets the font weight.
Return value: Font
Input Parameters:
<String> weight Required Font weight. See the Constants table for valid values.
Code snippets:

font.setWeight(esri.symbol.Font.WEIGHT_BOLD);


See also:
weight