<< Click to Display Table of Contents >>

 

new sg.symbols.Font(size_or_json, style, variant, weight, family)

 

 

Description

create a new Font object.

 

Position

Symbol.js

 

 

Parameters

 

Parameter

Type

Description

size_or_json

Number

font size

style

String

font style

variant

String

font variant

weight

String

font weight

family

String

font family

 

 

Constants

 

Constants

Description

STYLE_ITALIC

Italic style.

STYLE_NORMAL

normal style.

SYTLE_OBLIQUE

oblique style.

VARIANT_NORMAL

normal font

VARIANT_SMALLCAPS

smallcaps font

WEIGHT_BOLD

bold font

WEIGHT_BOLDER

bolder font

WEIGHT_LIGHTER

lighter font

WEIGHT_NORMAL

normal font

 

 

Properties

 

Properties

Type

Description

decoration

String

font decoration. There are three decoration types: "underline", "line-through", and "none".

family

String

font family

size

Number

font size

style

String

font style

variant

String

font variant

weight

Number

font weight

 

 

Methods

 

Methods

Type

Description

setDecoration(decoration)

String

define font decoration.

Name

Type

Description

decoration

String

Text decoration

setFamily(family)

String

define font family

Name

Type

Description

family

String

Font family

setSize(size)

Number

define font size.

Name

Type

Description

size

Number

Font size

setStyle(style)

String

define font style. See Constants table for values.

Name

Type

Description

style

String

Font style

setVariant(variant)

String

define font variant.

Name

Type

Description

variant

String

Font variant

setWeight(weight)

Number

define font weight.

Name

Type

Description

weight

String

Font weight

 

Example

 

<script type="text/javascript" src="scripts/Symbol.js"></script>

// example 1

var font =new sg.symbols.Font(24,sg.symbols.Font.STYLE_NORMAL,sg.symbols.Font.VARIANT_NORMAL,sg.symbols.Font.WEIGHT_NORMAL,"arial");

 

// example 2

var font =new sg.symbols.Font();

font.setSize(24);

font.setStyle(sg.symbols.Font.STYLE_NORMAL);

font.setVariant(sg.symbols.Font.VARIANT_NORMAL);

font.setWeight (sg.symbols.Font.WEIGHT_NORMAL);

font.setFamily("arial");

 

 

 


©2015 Supergeo Technologies Inc.