Class: Fox::FXFont
Overview
Font class
Font pitch hints
FixedFixed pitch, mono-spaced
VariableVariable pitch, proportional spacing
Font style hints
DecorativeFancy fonts
ModernMonospace typewriter font
RomanVariable width times-like font, serif
ScriptScript or cursive
SwissHelvetica/swiss type font, sans-serif
SystemSystem font
X11Raw X11 font string
ScalableScalable fonts
PolymorphicPolymorphic fonts, e.g. parametric weight, slant, etc.
RotatableRotatable fonts
Font slant options
ReverseObliqueReversed oblique
ReverseItalicReversed italic
StraightStraight, not slanted
ItalicItalics
ObliqueOblique slant
Font weight options
ThinThin
ExtraLightExtra light
LightLight
NormalNormal or regular weight
MediumMedium bold face
DemiBoldDemi bold face
BoldBold face
ExtraBoldExtra
BlackBlack
Condensed or expanded options
UltraCondensedUltra condensed printing
ExtraCondensedExtra condensed
CondensedCondensed
SemiCondensedSemi-condensed
NonExpandedRegular printing
SemiExpandedSemi expanded
Expanded:; Expanded
ExtraExpandedExtra expanded
UltraExpandedUltra 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 FONTENCODING_ISO_8859_14, Latin 8 (Celtic)
Instance Attribute Summary collapse
-
#actualEncoding ⇒ Object
readonly
Actual encoding [Integer].
-
#actualName ⇒ Object
readonly
Actual font family name [String].
-
#actualSetWidth ⇒ Object
readonly
Actual set width [Integer].
-
#actualSize ⇒ Object
readonly
Actual size in deci-points [Integer].
-
#actualSlant ⇒ Object
readonly
Actual slant [Integer].
-
#actualWeight ⇒ Object
readonly
Actual font weight [Integer].
-
#angle ⇒ Object
Font angle [Integer].
-
#encoding ⇒ Object
readonly
Encoding [Integer].
-
#family ⇒ Object
readonly
Family part of name [String].
-
#fontAscent ⇒ Object
readonly
Ascent from baseline [Integer].
-
#fontDesc ⇒ Object
Font description FXFontDesc.
-
#fontDescent ⇒ Object
readonly
Descent from baseline [Integer].
-
#fontHeight ⇒ Object
readonly
Height of tallest character in font [Integer].
-
#fontLeading ⇒ Object
readonly
Font leading [Integer].
-
#fontSpacing ⇒ Object
readonly
Font line spacing [Integer].
-
#fontWidth ⇒ Object
readonly
Width of widest character in font [Integer].
-
#foundry ⇒ Object
readonly
Foundry part of name [String].
-
#hints ⇒ Object
readonly
Hints [Integer].
-
#maxChar ⇒ Object
readonly
Last character glyph in font [Integer].
-
#name ⇒ Object
readonly
Font family name [String].
-
#setWidth ⇒ Object
readonly
Set width [Integer].
-
#size ⇒ Object
readonly
Size in decipoints [Integer].
-
#slant ⇒ Object
readonly
Slant [Integer].
-
#weight ⇒ Object
readonly
Font weight [Integer].
Attributes inherited from FXId
Class Method Summary collapse
-
.listFonts(face, weight = 0, slant = 0, setWidth = 0, encoding = 0, hints = 0) ⇒ Object
List all fonts matching hints.
Instance Method Summary collapse
-
#fontMono? ⇒ Boolean
Return
trueif font is monospaced. -
#getCharWidth(ch) ⇒ Object
Calculate width of single wide character ch in this font.
-
#getFont ⇒ Object
Return the font description as a string suitable for parsing with #setFont, see above.
-
#getTextHeight(text) ⇒ Object
Returns the height of given text in this font.
-
#getTextWidth(text) ⇒ Object
Returns the width of given text in this font.
-
#hasChar?(ch) ⇒ Boolean
Return
trueif font has glyph for ch. -
#initialize(a, string) ⇒ FXFont
constructor
Construct a font with given font description of the form:.
-
#leftBearing(ch) ⇒ Object
Returns the left-side bearing (the distance from the origin to the leftmost pixel in the character) for ch.
-
#rightBearing(ch) ⇒ Object
Returns the right-side bearing (the distance from the origin to the rightmost pixel in the character) for ch.
-
#setFont(string) ⇒ Object
Change the font to the specified font description string.
Methods inherited from FXId
#create, #created?, #destroy, #detach, #runOnUiThread
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize(a, string) ⇒ FXFont
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.
258 259 |
# File 'rdoc-sources/FXFont.rb', line 258 def initialize(a, fontDesc) # :yields: theFont end |
Instance Attribute Details
#actualEncoding ⇒ Object (readonly)
Actual encoding [Integer]
206 207 208 |
# File 'rdoc-sources/FXFont.rb', line 206 def actualEncoding @actualEncoding end |
#actualName ⇒ Object (readonly)
Actual font family name [String]
182 183 184 |
# File 'rdoc-sources/FXFont.rb', line 182 def actualName @actualName end |
#actualSetWidth ⇒ Object (readonly)
Actual set width [Integer]
212 213 214 |
# File 'rdoc-sources/FXFont.rb', line 212 def actualSetWidth @actualSetWidth end |
#actualSize ⇒ Object (readonly)
Actual size in deci-points [Integer]
188 189 190 |
# File 'rdoc-sources/FXFont.rb', line 188 def actualSize @actualSize end |
#actualSlant ⇒ Object (readonly)
Actual slant [Integer]
200 201 202 |
# File 'rdoc-sources/FXFont.rb', line 200 def actualSlant @actualSlant end |
#actualWeight ⇒ Object (readonly)
Actual font weight [Integer]
194 195 196 |
# File 'rdoc-sources/FXFont.rb', line 194 def actualWeight @actualWeight end |
#angle ⇒ Object
Font angle [Integer]
221 222 223 |
# File 'rdoc-sources/FXFont.rb', line 221 def angle @angle end |
#encoding ⇒ Object (readonly)
Encoding [Integer]
203 204 205 |
# File 'rdoc-sources/FXFont.rb', line 203 def encoding @encoding end |
#family ⇒ Object (readonly)
Family part of name [String]
173 174 175 |
# File 'rdoc-sources/FXFont.rb', line 173 def family @family end |
#fontAscent ⇒ Object (readonly)
Ascent from baseline [Integer]
239 240 241 |
# File 'rdoc-sources/FXFont.rb', line 239 def fontAscent @fontAscent end |
#fontDesc ⇒ Object
Font description Fox::FXFontDesc
218 219 220 |
# File 'rdoc-sources/FXFont.rb', line 218 def fontDesc @fontDesc end |
#fontDescent ⇒ Object (readonly)
Descent from baseline [Integer]
242 243 244 |
# File 'rdoc-sources/FXFont.rb', line 242 def fontDescent @fontDescent end |
#fontHeight ⇒ Object (readonly)
Height of tallest character in font [Integer]
236 237 238 |
# File 'rdoc-sources/FXFont.rb', line 236 def fontHeight @fontHeight end |
#fontLeading ⇒ Object (readonly)
Font leading [Integer]
245 246 247 |
# File 'rdoc-sources/FXFont.rb', line 245 def fontLeading @fontLeading end |
#fontSpacing ⇒ Object (readonly)
Font line spacing [Integer]
248 249 250 |
# File 'rdoc-sources/FXFont.rb', line 248 def fontSpacing @fontSpacing end |
#fontWidth ⇒ Object (readonly)
Width of widest character in font [Integer]
233 234 235 |
# File 'rdoc-sources/FXFont.rb', line 233 def fontWidth @fontWidth end |
#foundry ⇒ Object (readonly)
Foundry part of name [String]
176 177 178 |
# File 'rdoc-sources/FXFont.rb', line 176 def foundry @foundry end |
#hints ⇒ Object (readonly)
Hints [Integer]
215 216 217 |
# File 'rdoc-sources/FXFont.rb', line 215 def hints @hints end |
#maxChar ⇒ Object (readonly)
Last character glyph in font [Integer]
230 231 232 |
# File 'rdoc-sources/FXFont.rb', line 230 def maxChar @maxChar end |
#name ⇒ Object (readonly)
Font family name [String]
179 180 181 |
# File 'rdoc-sources/FXFont.rb', line 179 def name @name end |
#setWidth ⇒ Object (readonly)
Set width [Integer]
209 210 211 |
# File 'rdoc-sources/FXFont.rb', line 209 def setWidth @setWidth end |
#size ⇒ Object (readonly)
Size in decipoints [Integer]
185 186 187 |
# File 'rdoc-sources/FXFont.rb', line 185 def size @size end |
#slant ⇒ Object (readonly)
Slant [Integer]
197 198 199 |
# File 'rdoc-sources/FXFont.rb', line 197 def slant @slant end |
#weight ⇒ Object (readonly)
Font weight [Integer]
191 192 193 |
# File 'rdoc-sources/FXFont.rb', line 191 def weight @weight end |
Class Method Details
.listFonts(face, weight = 0, slant = 0, setWidth = 0, encoding = 0, hints = 0) ⇒ Object
List all fonts matching hints. Returns an array of FXFontDesc objects.
357 358 |
# File 'rdoc-sources/FXFont.rb', line 357 def FXFont.listFonts(face, weight=0, slant=0, setWidth=0, encoding=0, hints=0) end |
Instance Method Details
#fontMono? ⇒ Boolean
Return true if font is monospaced.
315 |
# File 'rdoc-sources/FXFont.rb', line 315 def fontMono? ; end |
#getCharWidth(ch) ⇒ Object
Calculate width of single wide character ch in this font
342 |
# File 'rdoc-sources/FXFont.rb', line 342 def getCharWidth(ch); end |
#getFont ⇒ Object
Return the font description as a string suitable for parsing with #setFont, see above.
310 |
# File 'rdoc-sources/FXFont.rb', line 310 def getFont(); end |
#getTextHeight(text) ⇒ Object
Returns the height of given text in this font.
352 |
# File 'rdoc-sources/FXFont.rb', line 352 def getTextHeight(text) ; end |
#getTextWidth(text) ⇒ Object
Returns the width of given text in this font.
347 |
# File 'rdoc-sources/FXFont.rb', line 347 def getTextWidth(text) ; end |
#hasChar?(ch) ⇒ Boolean
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')
327 |
# File 'rdoc-sources/FXFont.rb', line 327 def hasChar?(ch) ; end |
#leftBearing(ch) ⇒ Object
Returns the left-side bearing (the distance from the origin to the leftmost pixel in the character) for ch.
332 |
# File 'rdoc-sources/FXFont.rb', line 332 def leftBearing(ch) ; end |
#rightBearing(ch) ⇒ Object
Returns the right-side bearing (the distance from the origin to the rightmost pixel in the character) for ch.
337 |
# File 'rdoc-sources/FXFont.rb', line 337 def rightBearing(ch) ; end |
#setFont(string) ⇒ Object
Change the font to the specified font description string.
Returns true on success.
304 |
# File 'rdoc-sources/FXFont.rb', line 304 def setFont(string); end |