<< Click to Display Table of Contents >>

SuperGIS Server JavaScript API

 

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

 

 

Description

建立一個Font 物件。

 

Position

Symbol.js

 

 

Parameters

 

Parameter

Type

Description

size_or_json

Number

字體大小

style

String

字體樣式

variant

String

字體變化

weight

String

字體粗細

family

String

字體名稱

 

 

Constants

 

Constants

Description

STYLE_ITALIC

斜體。

STYLE_NORMAL

正常字體。

SYTLE_OBLIQUE

偽斜體。

VARIANT_NORMAL

正常字體。

VARIANT_SMALLCAPS

小型大寫字體。

WEIGHT_BOLD

粗體。

WEIGHT_BOLDER

更粗體。

WEIGHT_LIGHTER

細字體。

WEIGHT_NORMAL

正常字體。

 

 

Properties

 

Properties

Type

Description

decoration

String

字型裝飾,"underline" | "line-through" | "none"

family

String

字型名稱

size

Number

字型大小

style

String

字型樣式

(可使用Constants列舉的定義)

variant

String

字型變化

(可使用Constants列舉的定義)

weight

Number

字型粗細

(可使用Constants列舉的定義)

 

 

Methods

 

 

Methods

Type

Description

setDecoration(decoration)

String

定義字體裝飾。

Name

Type

Description

decoration

String

字型裝飾

setFamily(family)

String

定義字體字型。

Name

Type

Description

family

String

字型名稱

setSize(size)

Number

定義字體大小。ex:

Name

Type

Description

size

Number

字型大小

setStyle(style)

String

定義字體樣式。

(參考Constants列舉定義)

Name

Type

Description

style

String

字體樣式

setVariant(variant)

String

定義字體變化。

(參考Constants列舉定義)

Name

Type

Description

variant

String

字體變化

setWeight(weight)

String

定義字體粗細。

(參考Constants列舉定義)

Name

Type

Description

weight

String

字體粗細

 

 

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

 

 

See live example

 


©2015 Supergeo Technologies Inc.