Class Fox::FXFont
In: FXFont.rb
Parent: FXId

Font class

Font style hints which influence the matcher

FONTPITCH_DEFAULT:Default pitch
FONTPITCH_FIXED:Fixed pitch, mono-spaced
FONTPITCH_VARIABLE:Variable pitch, proportional spacing
FONTHINT_DONTCARE:Don't care which font
FONTHINT_DECORATIVE:Fancy fonts
FONTHINT_MODERN:Monospace typewriter font
FONTHINT_ROMAN:Variable width times-like font, serif
FONTHINT_SCRIPT:Script or cursive
FONTHINT_SWISS:Helvetica/swiss type font, sans-serif
FONTHINT_SYSTEM:System font
FONTHINT_X11:X11 Font string
FONTHINT_SCALABLE:Scalable fonts
FONTHINT_POLYMORPHIC:Polymorphic fonts

Font slant

FONTSLANT_DONTCARE:Don't care about slant
FONTSLANT_REGULAR:Regular straight up
FONTSLANT_ITALIC:Italics
FONTSLANT_OBLIQUE:Oblique slant
FONTSLANT_REVERSE_ITALIC:Reversed italic
FONTSLANT_REVERSE_OBLIQUE:Reversed oblique

Font character set encoding

FONTENCODING_DEFAULT:Don't care character encoding
FONTENCODING_ISO_8859_1:ISO-8859-1 character encoding
FONTENCODING_ISO_8859_2:ISO-8859-2 character encoding
FONTENCODING_ISO_8859_3:ISO-8859-3 character encoding
FONTENCODING_ISO_8859_4:ISO-8859-4 character encoding
FONTENCODING_ISO_8859_5:ISO-8859-5 character encoding
FONTENCODING_ISO_8859_6:ISO-8859-6 character encoding
FONTENCODING_ISO_8859_7:ISO-8859-7 character encoding
FONTENCODING_ISO_8859_8:ISO-8859-8 character encoding
FONTENCODING_ISO_8859_9:ISO-8859-9 character encoding
FONTENCODING_ISO_8859_10:ISO-8859-10 character encoding
FONTENCODING_ISO_8859_11:ISO-8859-11 character encoding
FONTENCODING_ISO_8859_13:ISO-8859-13 character encoding
FONTENCODING_ISO_8859_14:ISO-8859-14 character encoding
FONTENCODING_ISO_8859_15:ISO-8859-15 character encoding
FONTENCODING_ISO_8859_16:ISO-8859-16 character encoding
FONTENCODING_KOI8:KOI-8 character encoding
FONTENCODING_KOI8_R:Russian
FONTENCODING_KOI8_U:Ukrainian
FONTENCODING_KOI8_UNIFIED:x
FONTENCODING_LATIN1:same as FONTENCODING_ISO_8859_1, Latin 1 (West European)
FONTENCODING_LATIN2:same as FONTENCODING_ISO_8859_2, Latin 2 (East European)
FONTENCODING_LATIN3:same as FONTENCODING_ISO_8859_3, Latin 3 (South European)
FONTENCODING_LATIN4:same as FONTENCODING_ISO_8859_4, Latin 4 (North European)
FONTENCODING_LATIN5:same as FONTENCODING_ISO_8859_9, Latin 5 (Turkish)
FONTENCODING_LATIN6:same as FONTENCODING_ISO_8859_10, Latin 6 (Nordic)
FONTENCODING_LATIN7:same as FONTENCODING_ISO_8859_13, Latin 7 (Baltic Rim)
FONTENCODING_LATIN8:same as FONTENCODING_ISO_8859_14, Latin 8 (Celtic)
FONTENCODING_LATIN9:same as FONTENCODING_ISO_8859_15, Latin 9 (a.k.a. Latin 0)
FONTENCODING_LATIN10:same as FONTENCODING_ISO_8859_16, Latin 10
FONTENCODING_USASCII:same as FONTENCODING_ISO_8859_1, Latin 1
FONTENCODING_WESTEUROPE:same as FONTENCODING_ISO_8859_1, Latin 1 (West European)
FONTENCODING_EASTEUROPE:same as FONTENCODING_ISO_8859_2, Latin 2 (East European)
FONTENCODING_SOUTHEUROPE:same as FONTENCODING_ISO_8859_3, Latin 3 (South European)
FONTENCODING_NORTHEUROPE:same as FONTENCODING_ISO_8859_4, Latin 4 (North European)
FONTENCODING_CYRILLIC:same as FONTENCODING_ISO_8859_5, Cyrillic
FONTENCODING_RUSSIAN:same as FONTENCODING_KOI8, Cyrillic
FONTENCODING_ARABIC:same as FONTENCODING_ISO_8859_6, Arabic
FONTENCODING_GREEK:same as FONTENCODING_ISO_8859_7, Greek
FONTENCODING_HEBREW:same as FONTENCODING_ISO_8859_8, Hebrew
FONTENCODING_TURKISH:same as FONTENCODING_ISO_8859_9, Latin 5 (Turkish)
FONTENCODING_NORDIC:same as FONTENCODING_ISO_8859_10, Latin 6 (Nordic)
FONTENCODING_THAI:same as FONTENCODING_ISO_8859_11, Thai
FONTENCODING_BALTIC:same as FONTENCODING_ISO_8859_13, Latin 7 (Baltic Rim)
FONTENCODING_CELTIC:same as +FONTENCODING_ISO_8859_14, Latin 8 (Celtic)

Font weight

FONTWEIGHT_DONTCARE:Don't care about weight
FONTWEIGHT_THIN:Thin
FONTWEIGHT_EXTRALIGHT:Extra light
FONTWEIGHT_LIGHT:Light
FONTWEIGHT_NORMAL:Normal or regular weight
FONTWEIGHT_REGULAR:Normal or regular weight
FONTWEIGHT_MEDIUM:Medium bold face
FONTWEIGHT_DEMIBOLD:Demi bold face
FONTWEIGHT_BOLD:Bold face
FONTWEIGHT_EXTRABOLD:Extra
FONTWEIGHT_HEAVY:Heavy
FONTWEIGHT_BLACK:Black

Font relative setwidth

FONTSETWIDTH_DONTCARE:Don't care about set width
FONTSETWIDTH_ULTRACONDENSED:Ultra condensed printing
FONTSETWIDTH_EXTRACONDENSED:Extra condensed
FONTSETWIDTH_CONDENSED:Condensed
FONTSETWIDTH_NARROW:Narrow
FONTSETWIDTH_COMPRESSED:Compressed
FONTSETWIDTH_SEMICONDENSED:Semi-condensed
FONTSETWIDTH_MEDIUM:Medium printing
FONTSETWIDTH_NORMAL:Normal printing
FONTSETWIDTH_REGULAR:Regulat printing
FONTSETWIDTH_SEMIEXPANDED:Semi expanded
FONTSETWIDTH_EXPANDED:Expanded
FONTSETWIDTH_WIDE:Wide
FONTSETWIDTH_EXTRAEXPANDED:Extra expanded
FONTSETWIDTH_ULTRAEXPANDED:Ultra expanded
Methods
fontMono?    getTextHeight    getTextWidth    hasChar?    leftBearing    listFonts    new    new    new    rightBearing   
Attributes
encoding  [R] 

Encoding [Integer]

fontAscent  [R] 

Ascent from baseline [Integer]

fontDesc  [RW] 

Font description [FXFontDesc]

fontDescent  [R] 

Descent from baseline [Integer]

fontHeight  [R] 

Height of tallest character in font [Integer]

fontLeading  [R] 

Font leading [Integer]

fontSpacing  [R] 

Font line spacing [Integer]

fontWidth  [R] 

Width of widest character in font [Integer]

hints  [R] 

Hints [Integer]

maxChar  [R] 

Last character glyph in font [Integer]

minChar  [R] 

First character glyph in font [Integer]

name  [R] 

Face name [String]

setWidth  [R] 

Set width [Integer]

size  [R] 

Size in decipoints [Integer]

slant  [R] 

Slant [Integer]

weight  [R] 

Font weight [Integer]

Public Class methods
new(app, fontDesc) {|theFont| ...}

Construct font from font description

new(app, face, size, weight=FONTWEIGHT_NORMAL, slant=FONTSLANT_REGULAR, encoding=FONTENCODING_DEFAULT, setWidth=FONTSETWIDTH_DONTCARE, hints=0) {|theFont| ...}

Construct a font with given face name, size in points (pixels), weight, slant, character set encoding, setwidth, and hints.

new(app, fontString) {|theFont| ...}

Construct a font with given X11 font string.

listFonts(face, weight=FONTWEIGHT_DONTCARE, slant=FONTSLANT_DONTCARE, setWidth=FONTSETWIDTH_DONTCARE, encoding=FONTENCODING_DEFAULT, hints=0)

List all fonts matching hints. Returns an array of FXFontDesc objects.

Public Instance methods
fontMono?()

Return true if font is monospaced.

hasChar?(ch)

Return true if font has glyph for ch.

leftBearing(ch)

Returns the left-side bearing (the distance from the origin to the leftmost pixel in the character) for ch.

rightBearing(ch)

Returns the right-side bearing (the distance from the origin to the rightmost pixel in the character) for ch.

getTextWidth(text)

Returns the width of given text in this font.

getTextHeight(text)

Returns the height of given text in this font.