eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FontDescription':

Home

everywhere
www.exept.de
for:
[back]

Class: FontDescription


Inheritance:

   Object
   |
   +--FontDescription
      |
      +--BitmapFont
      |
      +--CompoundFont
      |
      +--Font

Package:
stx:libview
Category:
Graphics-Support
Version:
rev: 1.75 date: 2010/02/24 15:06:15
user: ca
file: FontDescription.st directory: libview
module: stx stc-classLibrary: libview
Author:
Claus Gittinger

Description:


FontDescription is just a place-holder for scanned font names.

[Instance variables:]
    family          <String>        the fonts family ('courier', 'helvetica' etc)
    face            <String>        the fonts face ('bold', 'medium' etc)
    style           <String>        the fonts style ('roman', 'italic', 'oblique')
    size            <String>        the fonts size (not in pixels) 
    encoding        <Symbol>        the fonts encoding (usually #iso8859-1)

    manufacturer    <nil|String|Array>
                                    the fonts origin - if known
    name            <nil|String|Array>
                                    the platform specific name

    flags           <SmallInteger>  holds serif/italic etc. as flag bits
    masks           <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing
    pixelSize       <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing

[class variables:]
    BoldnessMask                    currently dummy; to allow ST-80 compatible subclassing
    FixedFlag                       currently dummy; to allow ST-80 compatible subclassing
    ItalicFlag                      currently dummy; to allow ST-80 compatible subclassing
    OutlineFlag                     currently dummy; to allow ST-80 compatible subclassing
    SerifFlag                       currently dummy; to allow ST-80 compatible subclassing
    ShadowFlag                      currently dummy; to allow ST-80 compatible subclassing
    StrikeoutFlag                   currently dummy; to allow ST-80 compatible subclassing
    UnderlineFlag                   currently dummy; to allow ST-80 compatible subclassing


Related information:

    Font
    FontPanel
    GraphicsContext
    [introduction to view programming]

Class protocol:

accessing
o  genericFonts

defaults
o  defaultEncoding

o  defaultFace

o  defaultSize

o  defaultStyle

initialization
o  initialize
initialize class variables

o  initializeCharacterEncodingToCharacterSetMapping
character encoding

o  initializeCharacterSetToFontMapping
character sets

o  initializeGenericFonts
generic fonts, that do not exist as a device fonts and are
replaced by a real font

instance creation
o  family: familyString
returns a font for given family and default (12pt) size
with default encoding.
The new fonts face defaults `medium', its style to `roman'.
The returned font is not associated to a specific device

o  family: familyString face: faceString size: sizeNum
returns a font for given family and size with default encoding.
The new fonts style defaults to `roman'.
The returned font is not associated to a specific device

o  family: familyString face: faceString style: styleString size: sizeNum
returns a font for given family, face, style and size with default encoding.
The returned font is not associated to a specific device

o  family: familyString face: faceString style: styleString size: sizeNum encoding: encoding
returns a font for given family, face, style, size and the specified encoding.
The returned font is not associated to a specific device

o  family: familyString face: faceString style: styleString size: size sizeUnit: sizeUnit encoding: encoding
returns a font for given family, face, style, size and the specified encoding.
The returned font is not associated to a specific device

o  family: familyString pixelSize: sizeNum
returns a font for given family and pixelSize with default encoding.
The new fonts face defaults to `medium', its style to `roman'.
Notice: the returned font will typically only be usable on a screen,
and will not scale as to the devices resolution.
Use #family:size: for resolution-independent sizing.

o  family: familyString size: sizeNum
returns a font for given family and size with default encoding.
The new fonts face defaults to `medium', its style to `roman'.
The returned font is not associated to a specific device

o  family: familyString size: sizeNum encoding: encoding
returns a font for given family and size with default encoding.
The new fonts face defaults to `medium', its style to `roman'.
The returned font is not associated to a specific device

o  family: familyString style: aStyle size: sizeNum
returns a font for given family and size with default encoding.
The new fonts face defaults to `medium', its style to `roman'.
The returned font is not associated to a specific device

o  name: aFontName
returns a font with the given explicit name.
WARNING:
You shuld not use explicit naming, since font names vary
with operatingSystems, devices and architecture.

This interface is provided for special purposes only.
On X, the name given should be according the X fontname conventions;
i.e. something like: '-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'.

On other devices, font naming may be completely different.

queries
o  characterSetForCharacterEncoding: encodingName
return the font-encoding for a character encoding

o  fontNamePatternForCharset: aCharSetName
return the font-encoding for an iso-charset

o  preferredFontEncodingFor: fileEncoding
given a file encoding, return a corresponding match pattern for a preferred fontEncoding


Instance protocol:

Compatibility-ST80
o  boldness: aNumber
added for ST-80 compatibility; actually ignored currently

o  color: aColor
added for ST-80 compatibility; actually ignored currently

o  encodings: aCollectionOfEncodings
added for ST-80 compatibility; actually ignored currently

o  fixedWidth: aBoolean
added for ST-80 compatibility; actually ignored currently

o  italic: aBoolean
added for ST-80 compatibility; actually ignored currently

o  outline: aBoolean
added for ST-80 compatibility; actually ignored currently

o  pixelSize

o  pixelSize: aNumber
if specified, the size is ignored, and a pixel-sized font is chosen.

o  serif: aBoolean
added for ST-80 compatibility; actually ignored currently

o  setPixelSize: aNumber

o  shadow: aBoolean
added for ST-80 compatibility; actually ignored currently

o  strikeout: aBoolean
added for ST-80 compatibility; actually ignored currently

o  underline: aBoolean
added for ST-80 compatibility; actually ignored currently

accessing
o  device
return the device I am on

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  encoding
return the fonts encoding, as a symbol
such as #'iso8859', #'jis0208.1983' or #ascii.
If the fonts encoding is not known, return nil;
You should assume ascii-encoding then.

o  face
return the face, a string

o  face: aString
set the face, a string such as 'bold'

o  family
return the family, a string

o  family: aString
set the family, a string

o  family: familyString face: faceString style: styleString size: sizeNum encoding: encodingString

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  family: familyString face: faceString style: styleString size: sizeArg sizeUnit: sizeUnitArg encoding: encodingString
set the instance values

o  flags

o  flags: something

o  fontId
return the device-dependent font-id

o  graphicsDevice
return the device I am on

o  isGenericFont: aBoolean
set wether this is a pseudo font

o  manufacturer
return the value of the instance variable 'manufacturer' (automatically generated)

o  manufacturer: something
set the value of the instance variable 'manufacturer' (automatically generated)

o  masks

o  masks: something

o  sizeUnit
currently returns one of #pt or #px (internal use only)

o  style
return the style, a string

comparing
o  = aFont
two fonts are considered equal, if the font-name components are;
independent of the device, the font is on

o  hash
return a number for hashing - req'd since = is redefined.

o  sameDeviceFontAs: aFont

converting
o  asBold
return the bold font corresponding to the receiver

o  asFace: anotherFace
return the bold font corresponding to the receiver

o  asFamily: anotherFamily
return another font corresponding to the receiver face, style and size but
with another family

o  asFontDescription

o  asFontWithPixelSize: anotherSize
return another font corresponding to the receivers family, face and style but
with another pixel size

o  asItalic
return the italic font corresponding to the receiver

o  asSize: anotherSize
return another font corresponding to the receivers family, face and style but
with another size

o  asStyle: anotherStyle

o  fromLiteralArrayEncoding: literalEncoding
read my contents from a aLiteralEncodedArray.
Must match to what is generated in #literalArrayEncoding

o  literalArrayEncoding
return myself encoded as a literal array.
Must match to what is expected in #fromLiteralArrayEncoding:

o  on: aDevice
given the receiver, return a device Font

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  onDevice: aDevice
given the receiver, return a device Font

o  size: anotherSize

** This is an obsolete interface - do not use it (it may vanish in future versions) **

displaying
o  displayOpaqueString: aString from: index1 to: index2 x: x y: y in: aGC
display a partial string at some position in aGC.
- display part of a string, drawing both fore- and background pixels

o  displayOpaqueString: aString x: x y: y in: aGC
display a string at some position in aGC.

o  displayString: aString from: index1 to: index2 x: x y: y in: aGC
display a partial string at some position in aGC.

o  displayString: aString from: index1 to: index2 x: x y: y in: aGC opaque: opaque
display a partial string at some position in aGC.

** This method raises an error - it must be redefined in concrete classes **

o  displayString: aString x: x y: y in: aGC
display a string at some position in aGC.

errors
o  errorNoDevice
a query was made for device-specific info

getting a device font
o  onDevice: aDevice ifAbsent: exceptionBlock
create a new Font representing the same font as
myself on aDevice. This does NOT try to look for existing
or replacement fonts (i.e. can be used to get physical fonts).

printing & storing
o  printOn: aStream
append a user-friendly representation of the receiver to aStream

o  userFriendlyName
return a user-friendly printed representation of the receiver

queries
o  bold
return true, if the receiver is a bold font -
Added for st-80 compatibility.

o  boldness
return the boldness of the characters in this font 0 .. 1 -
Added for st-80 compatibility

o  color
return the default color in which this font is to be rendered.
Added for st-80 compatibility.
For now always black.

o  existsOn: aDevice
return true, if the recevier is available on aDevice;
false otherwise. This is a kludge method; its better to
ask a device for its available fonts and use this info ...
Notice, that if you simply use a font by name, the system
will automatically take a replacement font.

o  fullName

o  isGenericFont
answer true, if this is a pseudo font

o  isScaledFont

o  italic
return true if this is an italic font -
Added for st-80 compatibility

o  serif
return true, if this font has serifs.
Added for st-80 compatibility

o  size
return the size, a number

o  species

o  underline
return true if this is an underlined font -
Added for st-80 compatibility
(always false here)

queries-dimensions
o  ascent
return the ascent - the number of pixels above the baseLine.

** This method raises an error - it must be redefined in concrete classes **

o  ascentOn: aDevice
return the ascent - the number of pixels above the baseLine.

o  descent
return the descent - the number of pixels below the baseLine.

** This method raises an error - it must be redefined in concrete classes **

o  descentOn: aDevice
return the ascent - the number of pixels above the baseLine.

o  height
return the height - the number of pixels above plus below the baseLine.

** This method raises an error - it must be redefined in concrete classes **

o  heightOf: aString
return the height of the given string.
Here, assume the characters are of constant height

o  heightOf: aString on: aDevice
return the height of the given string on the given device.

o  heightOn: aDevice
return the height - the number of pixels above PLUS below the baseLine.

o  isFixedWidth
return true, if this is a fixed pitch font (i.e. all characters
are of the same width)

** This method raises an error - it must be redefined in concrete classes **

o  maxAscent
return the fonts maximum-ascent (i.e. the maximum of all characters);
That is the number of units (usually pixels) above the baseline.

** This method raises an error - it must be redefined in concrete classes **

o  maxDescent
return the fonts maximum-descent (i.e. the maximum of all characters);
That is the number of units (usually pixels) below the baseline.

** This method raises an error - it must be redefined in concrete classes **

o  maxHeight
return the fonts characters maximum height;
That is the number of units (usually pixels).

o  maxWidth
return the fonts maximum-width character (i.e. the maximum of all characters);
That is a number of units (usually pixels).

** This method raises an error - it must be redefined in concrete classes **

o  width
return the fonts characters width;
That is a number of units (usually pixels).
For variable pitch fonts, the width of the space character is returned.
For fixed fonts, this is the same as minWidth or maxWidth (or any character).
The receiver must be associated to a device, for this query to be legal.

o  widthOf: aString
return the width of a string

o  widthOf: aString from: start to: stop
return the width of a sub string

** This method raises an error - it must be redefined in concrete classes **

o  widthOf: aString from: start to: stop on: aDevice
return the width of a sub string.
Here, assume that this fonts width is device independent.

o  widthOf: aString on: aDevice
return the width of a string

o  widthOn: aDevice
return the width on some device; that is the width of the space character
(which is the width of any character iff the font is a fixed pitch font)

queries-encoding
o  isASCII
return true, if the receivers encoding is
compatible with ascii (i.e. its ascii or iso8859)

o  isISO8859
return true, if the receivers encoding is
compatible with iso8859 (i.e. iso8859)

o  isJIS
return true, if the receivers encoding is
compatible with jis (i.e. jisXXX)



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 09:14:43 GMT