Font_New

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > UI (User Interface) > Resources > Fonts >

Font_New

 

Description

 

Create a font handle passing font specs.

 

Syntax

 

hFont = Font_New(Fontname [, Points [, Style [, Charset [, Pitch [, Escapement]]]]])

 

Returns

 

Number. A unique internal handle is assigned to this variable.

This handle is used with other statements and functions to specify the created font. If the font creation fails, the value zero (0) is returned.

 

Parameters

 

Name

Type

Optional

Meaning

FontName

String

No

Name of the font

Points

Number

Yes

Size of the font, in points.

Style

Number

Yes

Font style attribute.

Any of the following values can be combined or used alone:

 

0 Normal

1 Bold

2 Italic

4 Underline

8 Strikeout

16 Leading

 

Some fonts specify "external leading" in their definition. In some cases, it only applies to certain point sizes of a font. External Leading specifies that one or more blank pixels are added to the bottom of each character when displayed. This has an impact on character position and should be considered when creating a font. Normally, the font is created without regard to external leading. That is, it's created so that the visible character face fills the requested point size. However, if the Leading Option is used, the font will be created so that the visible character face plus the external leading (if any) fills the point size. In these cases, the character may appear slightly smaller.

CharSet

Number

Yes

CharSet identifier:

 

0 ANSI CharSet

1 Default CharSet

2 Symbol CharSet

77 Mac CharSet

128 Shiftjis CharSet

129 Hangeul CharSet

130 Johab CharSet

136 Chinese CharSet

161 Greek CharSet

162 Turkish CharSet

177 Hebrew CharSet

178 Arabic CharSet

186 Baltic CharSet

204 Russian CharSet

222 Thai CharSet

238 East Europe CharSet

255 OEM CharSet

Pitch

Number

Yes

Pitch and Font Family attribute. One of each group of values can be combined or used alone:

 

0 Default

1 Fixed width font

2 Variable width font

16 Roman font (Times Roman...)

32 Swiss font (Helvetica, Swiss...)

48 Modern font (Pica, Courier...)

64 Script font (Cursive...)

80 Decorative (OldEnglish...)

Escapement

Number

Yes

Specifies the angle, in tenths of degrees, between the character base line and the x axis. Allows printing of text on an angle.

 

Remarks

 

This is the preferred method of creating and specifying fonts. Using Font_New, programmer can create a group of fonts, in advance, and switch between them easily using CONTROL SET FONT.

 

If the requested font is not available on the computer, Windows will search for a substitute font, which is similar to the attributes specified (CharSet, Font Family, etc.).

 

Use the value zero (0) for any of the numeric parameters to designate to use the default for that item. If parameters are missing, the default value will be used for all remaining parameters.

 

Restrictions

 

See also

 

Examples