Class Fox::FXFont
In: rdoc-sources/FXFont.rb
Parent: FXId

Font class

Font pitch hints

Fixed:Fixed pitch, mono-spaced
Variable:Variable pitch, proportional spacing

Font style hints

Decorative:Fancy fonts
Modern:Monospace typewriter font
Roman:Variable width times-like font, serif
Script:Script or cursive
Swiss:Helvetica/swiss type font, sans-serif
System:System font
+X11+:Raw X11 font string
Scalable:Scalable fonts
Polymorphic:Polymorphic fonts, e.g. parametric weight, slant, etc.
Rotatable:Rotatable fonts

Font slant options

ReverseOblique:Reversed oblique
ReverseItalic:Reversed italic
Straight:Straight, not slanted
Italic:Italics
Oblique:Oblique slant

Font weight options

Thin:Thin
ExtraLight:Extra light
Light:Light
Normal:Normal or regular weight
Medium:Medium bold face
DemiBold:Demi bold face
Bold:Bold face
ExtraBold:Extra
Black:Black

Condensed or expanded options

UltraCondensed:Ultra condensed printing
ExtraCondensed:Extra condensed
Condensed:Condensed
SemiCondensed:Semi-condensed
NonExpanded:Regular printing
SemiExpanded:Semi expanded

Expanded:; Expanded

ExtraExpanded:Extra expanded
UltraExpanded:Ultra expanded

Font character set encoding

FONTENCODING_DEFAULT:Don‘t care character encoding
FONTENCODING_ISO_8859_1:West European (Latin1)
FONTENCODING_ISO_8859_2:Central and East European (Latin2)
FONTENCODING_ISO_8859_3:Esperanto (Latin3)
FONTENCODING_ISO_8859_4:ISO-8859-4 character encoding
FONTENCODING_ISO_8859_5:Cyrillic (almost obsolete)
FONTENCODING_ISO_8859_6:Arabic
FONTENCODING_ISO_8859_7:Greek
FONTENCODING_ISO_8859_8:Hebrew
FONTENCODING_ISO_8859_9:Turkish (Latin5)
FONTENCODING_ISO_8859_10:ISO-8859-10 character encoding
FONTENCODING_ISO_8859_11:Thai
FONTENCODING_ISO_8859_13:Baltic
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_CP437:IBM-PC code page
FONTENCODING_CP850:IBM-PC Multilingual
FONTENCODING_CP851:IBM-PC Greek
FONTENCODING_CP852:IBM-PC Latin2
FONTENCODING_CP855:IBM-PC Cyrillic
FONTENCODING_CP856:IBM-PC Hebrew
FONTENCODING_CP857:IBM-PC Turkish
FONTENCODING_CP860:IBM-PC Portugese
FONTENCODING_CP861:IBM-PC Iceland
FONTENCODING_CP862:IBM-PC Israel
FONTENCODING_CP863:IBM-PC Canadian/French
FONTENCODING_CP864:IBM-PC Arabic
FONTENCODING_CP865:IBM-PC Nordic
FONTENCODING_CP866:IBM-PC Cyrillic 2
FONTENCODING_CP869:IBM-PC Greek 2
FONTENCODING_CP870:Latin-2 Multilingual
FONTENCODING_CP1250:Windows Central European
FONTENCODING_CP1251:Windows Russian
FONTENCODING_CP1252:Windows Latin1
FONTENCODING_CP1253:Windows Greek
FONTENCODING_CP1254:Windows Turkish
FONTENCODING_CP1255:Windows Hebrew
FONTENCODING_CP1256:Windows Arabic
FONTENCODING_CP1257:Windows Baltic
FONTENCODING_CP1258:Windows Vietnam
FONTENCODING_CP874:Windows Thai
FONTENCODING_UNICODE:Unicode
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 <tt>FONTENCODING_ISO_8859_14, Latin 8 (Celtic)

Methods

Attributes

actualEncoding  [R]  Actual encoding [Integer]
actualName  [R]  Actual font family name [String]
actualSetWidth  [R]  Actual set width [Integer]
actualSize  [R]  Actual size in deci-points [Integer]
actualSlant  [R]  Actual slant [Integer]
actualWeight  [R]  Actual font weight [Integer]
angle  [RW]  Font angle [Integer]
encoding  [R]  Encoding [Integer]
family  [R]  Family part of name [String]
font  [RW]  Font description as a string [String]
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]
foundry  [R]  Foundry part of name [String]
hints  [R]  Hints [Integer]
maxChar  [R]  Last character glyph in font [Integer]
minChar  [R]  First character glyph in font [Integer]
name  [R]  Font family 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

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

Return an FXFont instance, initialized from a font description.

Parameters:

a:an application instance [FXApp]
fontDesc:a font description [FXFontDesc]

Return an FXFont instance initialized with the given face name, size in points (pixels), weight, slant, character set encoding, set width, and hints. The font name may be comprised of a family name and optional foundry name enclosed in square brackets, for example, "helvetica [bitstream]".

Parameters:

a:an application instance [FXApp]
face:font face name [String]
size:requested font size, in points [Integer]
weight:requested font weight [Integer]
encoding:requested font encoding [Integer]
setWidth:requested font set width [Integer]
hints:font construction hints for font matching algorithm [Integer]
 Construct a font with given font description of the form:

     fontname [ "[" foundry "]" ] ["," size ["," weight ["," slant ["," setwidth ["," encoding ["," hints]]]]]]

 For example:

     "helvetica [bitstream],120,bold,italic,normal,iso8859-1,0"

 Typically, at least the font name, and size must be given for
 normal font matching.  As a special case, raw X11 fonts can also be
 passed, for example:

     "9x15bold"

Note: use of the raw X11 fonts is stronly discouraged.

Public Instance methods

Return true if font is monospaced.

Calculate width of single wide character ch in this font

Return the font description as a string suitable for parsing with setFont, see above.

Returns the height of given text in this font.

Returns the width of given text in this font.

Return true if font has glyph for ch. Here, ch can either be an ordinal value, e.g.

    aFont.hasChar?(?a)

or a string of length one (i.e. a single character), e.g.

    aFont.hasChar?('a')

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

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

Change the font to the specified font description string. Returns true on success.

[Validate]