|
Class: FontDescription
Object
|
+--FontDescription
|
+--BitmapFont
|
+--CompoundFont
|
+--Font
|
+--TTFontDescription
|
+--XftFontDescription
- Package:
- stx:libview
- Category:
- Graphics-Support
- Version:
- rev:
1.139
date: 2024/03/07 12:22:32
- user: stefan
- file: FontDescription.st directory: libview
- module: stx stc-classLibrary: libview
FontDescription is just a place-holder for scanned font names.
[Instance variables:]
family <String> the font's family ('courier', 'helvetica' etc)
face <String> the font's face ('bold', 'medium' etc)
style <String> the font's style ('roman', 'italic', 'oblique')
size <String> the font's size (by default, in points, not in pixels; but see sizeUnit)
encoding <Symbol> the font's encoding (usually #iso8859-1)
manufacturer <nil|String|Array>
the font's 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
sizeUnit <Symbol> #px or #pt; defines what size is measuring
weight <SmallInteger> for real fonts, which support it
slant <SmallInteger> for real fonts, which support it
[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
copyrightCOPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
defaultEncoding: encodingSymbol
-
-
genericFonts
-
defaults
-
defaultEncoding
-
^ #'iso8859-1'
-
defaultFace
-
-
defaultSize
-
-
defaultStyle
-
initialization
-
initialize
-
initialize class variables
-
initializeCharacterEncodingToCharacterSetMapping
-
character encoding
-
initializeCharacterSetToFontMapping
-
character sets
-
initializeGenericFonts
-
generic fonts, that do not exist as a device font and are
replaced by a real font
instance creation
-
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
Usage example(s):
Font family:'helvetica'
Font family:'courier'
|
-
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
Usage example(s):
Font family:'helvetica' face:'medium' size:10
Font family:'helvetica' face:'bold' size:10
Font family:'courier' face:'bold' size:10
|
-
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
Usage example(s):
Font family:'helvetica' face:'medium' style:'roman' size:10
Font family:'helvetica' face:'medium' style:'italic' size:10
Font family:'helvetica' face:'bold' style:'roman' size:10
Font family:'courier' face:'bold' style:'italic' size:10
|
-
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
-
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
-
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.
Usage example(s):
(Font family:'helvetica' size:10) onDevice:Screen current
(Font family:'helvetica' pixelSize:10) onDevice:Screen current
|
-
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
Usage example(s):
Font family:'helvetica' size:10
Font family:'courier' size:10
|
-
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
Usage example(s):
Font family:'helvetica' size:10 encoding:#'iso8859-1'
Font family:'courier' size:10 encoding:#'iso8859-1'
|
-
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
Usage example(s):
Font family:'helvetica' style:#roman size:48
Font family:'courier' style:#roman size:10
|
-
name: aFontName
-
returns a font with the given explicit name.
WARNING:
You should 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.
Usage example(s):
Font name:'-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'
Font name:'6x10'
Font name:'k14'
((Font name:'k14') on:Display) encoding
|
queries
-
characterSetForCharacterEncoding: encodingName
-
return the font-encoding for a character encoding
Usage example(s):
FontDescription characterSetForCharacterEncoding:'utf8'
FontDescription characterSetForCharacterEncoding:'koi8-r'
FontDescription characterSetForCharacterEncoding:'unicode'
|
-
fontNamePatternForCharset: aCharSetName
-
return the font-encoding for an iso-charset
Usage example(s):
FontDescription fontNamePatternForCharset:'iso2022-jp'
FontDescription fontNamePatternForCharset:'euc-jp'
|
-
preferredFontEncodingFor: fileEncoding
-
given a file encoding, return a corresponding match pattern for a preferred fontEncoding
Compatibility-ST80
-
boldness: aNumber
-
added for ST-80 compatibility; actually ignored currently
-
color: aColor
-
added for ST-80 compatibility; actually ignored currently
-
encodings: aCollectionOfEncodings
-
added for ST-80 compatibility; actually ignored currently
-
fixedWidth: aBoolean
-
added for ST-80 compatibility; actually ignored currently
-
italic: aBoolean
-
added for ST-80 compatibility; actually ignored currently
-
outline: aBoolean
-
added for ST-80 compatibility; actually ignored currently
-
pixelSize
-
-
pixelSize: aNumber
-
if specified, the size is ignored, and a pixel-sized font is chosen.
-
serif: aBoolean
-
added for ST-80 compatibility; actually ignored currently
-
setPixelSize: aNumber
-
-
setSize: aNumber
-
-
setSizeUnit: aSymbol
-
-
shadow: aBoolean
-
added for ST-80 compatibility; actually ignored currently
-
strikeout: aBoolean
-
added for ST-80 compatibility; actually ignored currently
-
underline: aBoolean
-
added for ST-80 compatibility; actually ignored currently
accessing
-
device
-
return the device I am on
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
encoding
-
return the font's encoding, as a symbol
such as #'iso8859', #'jis0208.1983' or #ascii.
If the encoding is not known, return nil;
You should assume ascii/iso8859-encoding then.
-
face
-
return the face, a string
-
face: aString
-
set the face, a string such as 'bold'
-
family
-
return the family, a string
-
family: aString
-
set the family, a string
-
family: familyString face: faceString style: styleString size: sizeNum encoding: encodingString
-
set the instance values
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
family: familyString face: faceString style: styleString size: sizeArg sizeUnit: sizeUnitArg encoding: encodingString
-
set the instance values
-
file: aNumber
-
set the file
-
flags
-
-
flags: anInteger
-
-
fontFormat: aString
-
set the fontFormat
-
fontId
-
return the device-dependent font-id
-
fontVersion: aNumber
-
set the fontVersion
-
foundry
-
return the manufacturer/foundry
-
foundry: aString
-
set the value of the manufacturer/foundry
-
graphicsDevice
-
return the device I am on
-
hasOverlappingCharacters: aBoolean
-
set whether this has overlapping chars (for windows cleartype drawing only)
-
isAntialiasedFont: aBoolean
-
set whether this is an antialiased font (currently for XftFonts only)
-
isDecorativeFont: aBoolean
-
set whether this is a decorative font (currently for XftFonts only)
-
isForceNonXFTFont: aBoolean
-
set this to prevent that the font is resolved as an Xft font.
Special workaround hack: some operations (drawing into a form)
may not work correctly with Xft fonts
-
isGenericFont: aBoolean
-
set whether this is a pseudo font
-
isOutlineFont: aBoolean
-
set whether this is an outline font (currently for XftFonts only)
-
isScalableFont: aBoolean
-
set whether this is a scalable font (currently for XftFonts only)
-
languages: aLanguagesString
-
a string containing the supported languages separated by vertical bars;
eg. |de|en|..|
-
manufacturer
-
return the manufacturer/foundry
-
manufacturer: aString
-
set the value of the manufacturer/foundry
-
masks
-
-
masks: something
-
-
name
-
the name (typically filename) if known
-
name: aString
-
-
sizeUnit
-
currently returns one of #pt or #px (internal use only)
-
slant
-
get the slant
Usage example(s):
-
slant: aNumber
-
set the slant
-
spacing
-
get the spacing
Usage example(s):
-
spacing: aNumber
-
set the spacing
-
style
-
return the style, a string
-
style: aString
-
set the style
-
weight: aNumber
-
set the weight
-
width: aNumber
-
set the width
comparing
-
= aFont
-
two fonts are considered equal, if the font-name components are;
independent of the device, the font is on
-
hash
-
return a number for hashing - req'd since = is redefined.
-
sameDeviceFontAs: aFont
-
converting
-
asBold
-
return the bold font corresponding to the receiver
-
asEncoding: anotherEncoding
-
CompoundFonts do not have a family
-
asFace: anotherFace
-
return the bold font corresponding to the receiver
-
asFamily: anotherFamily
-
return another font corresponding to the receiver face, style and size but
with another family
-
asFontDescription
-
-
asFontWithPixelSize: anotherSize
-
return another font corresponding to the receiver's family, face and style but
with another pixel size.
Alias for asPixelSize:
-
asItalic
-
return the italic font corresponding to the receiver
-
asNonXftFont
-
return a non XFT font/fontDescription corresponding to the receiver
-
asPixelSize: anotherSize
-
return another font corresponding to the receiver's family, face and style but
with another pixel size
-
asSize: anotherPointSize
-
return another font corresponding to the receiver's family,
face and style but with another (point-) size
-
asStyle: anotherStyle
-
CompoundFonts do not have a family
-
fromLiteralArrayEncoding: literalEncoding
-
read my contents from a aLiteralEncodedArray.
Must match to what is generated in #literalArrayEncoding
-
literalArrayEncoding
-
return myself encoded as a literal array.
Must match to what is expected in #fromLiteralArrayEncoding:
-
on: aDevice
-
given the receiver, return a device Font
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
onDevice: aDevice
-
given the receiver, return a device Font
-
scaled: factor
-
return another font corresponding to the receiver's family, face and style but
with another pixel size
-
size: anotherSize
-
return a font corresponding to the receiver, but with different size.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
displaying
-
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
-
displayOpaqueString: aString x: x y: y in: aGC
-
display a string at some position in aGC.
-
displayString: aString from: index1 to: index2 x: x y: y in: aGC
-
display a partial string at some position in aGC.
-
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 must be redefined in concrete classes (subclassResponsibility) **
-
displayString: aString from: index1 to: index2 x: x0 y: y0 in: aGC opaque: opaque maxWidth: maxWidth
-
redefined for subclasses that do not implement maxWidth
-
displayString: aString x: x y: y in: aGC
-
display a string at some position in aGC.
errors
-
errorNoDevice
-
a query was made for device-specific info
getting a device font
-
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).
-
onDevice: aDevice xFontsOnly: xFontsOnly xftFontsOnly: xftFontsOnly ifAbsent: exceptionBlock
-
create a new Font representing the same font as myself on aDevice.
The xFontsOnly/xftFontsOnly are only relevant for XWindow devices;
xFontsOnly will suppress xft fonts, whereas xftFontsOnly will suppress x fonts
(the first is useful if ST/X has a slow remote X connection for display,
on which xft fonts are very slow. Yes, this is actually a reasonable setup
in use at one of our customers)
This does NOT try to look for existing
or replacement fonts (i.e. can be used to get physical fonts).
inspecting
-
inspector2TabCharacterSet
( an extension from the stx:libtool package )
-
an extra tab showing the font
-
inspector2TabPreview
( an extension from the stx:libtool package )
-
an extra tab showing the quick brown fox
printing & storing
-
printOn: aStream
-
append a user-friendly representation of the receiver to aStream
-
storeOn: aStream
-
append a user-friendly representation of the receiver to aStream
-
userFriendlyName
-
return a user-friendly printed representation of the receiver
Usage example(s):
View defaultFont userFriendlyName
Button defaultFont userFriendlyName
|
private
-
installInDeviceForGCId: aGCId
-
install the font for aGCId.
This is a No-op. Subclasses may redefine this.
queries
-
bold
-
return true, if the receiver is a bold font -
Added for st-80 compatibility.
-
boldness
-
return the boldness of the characters in this font 0 .. 1 -
Added for st-80 compatibility
-
color
-
return the default color in which this font is to be rendered.
Added for st-80 compatibility.
For now always black.
-
existsOn: aDevice
-
return true, if the receiver 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.
-
fullName
-
-
hasOverlappingCharacters
-
answer true, if this is a windows font where characters overlap
-
isAntialiasedFont
-
answer true, if this is an antialiased font (currently Xft only)
-
isDecorativeFont
-
answer true, if this is an decorative font (currently Xft only)
-
isForceNonXFTFont
-
this flag is set if someone wants to preven an XFT font to be used
when the receiver is resolved.
This is a temporary hack - some functions (drawing into a bitmap) may not work
correctly when Xft fonts are used
-
isGenericFont
-
answer true, if this is a pseudo font
-
isOutlineFont
-
answer true, if this is an outline font (currently Xft only)
-
isScaledFont
-
answer true, if this is a scalable font
-
italic
-
return true if this is an italic font -
Added for st-80 compatibility
-
serif
-
return true, if this font has serifs.
Added for st-80 compatibility
-
size
-
return the size, a number
-
species
-
-
underline
-
return true if this is an underlined font -
Added for st-80 compatibility
(always false here)
-
usableForLanguage: aLanguageString
-
true, if this font is usable for the given language, which is an iso language
string such as 'de', 'en' etc.
If the font has no language info (i.e. non-Xft fonts),
true is returned.
queries-dimensions
-
ascent
-
return the ascent - the number of pixels above the baseLine.
** This method must be redefined in concrete classes (subclassResponsibility) **
-
ascentOn: aDevice
-
return the ascent - the number of pixels above the baseLine.
-
descent
-
return the descent - the number of pixels below the baseLine.
** This method must be redefined in concrete classes (subclassResponsibility) **
-
descentOn: aDevice
-
return the ascent - the number of pixels above the baseLine.
-
height
-
return the height - the number of pixels above plus below the baseLine.
** This method must be redefined in concrete classes (subclassResponsibility) **
-
heightOf: aString
-
return the height of the given string.
Here, assume the characters are of constant height
-
heightOf: aString on: aDevice
-
return the height of the given string on the given device.
-
heightOn: aDevice
-
return the height - the number of pixels above PLUS below the baseLine.
-
isFixedWidth
-
return true, if this is a fixed pitch font
(i.e. all characters are of the same width).
Also called monospaced fonts
** This method must be redefined in concrete classes (subclassResponsibility) **
-
maxAscent
-
return the font's maximum-ascent (i.e. the maximum of all characters);
That is the number of units (usually pixels) above the baseline.
** This method must be redefined in concrete classes (subclassResponsibility) **
-
maxCode
-
return the biggest UCS code in font.
Dummy for now
-
maxDescent
-
return the font's maximum-descent (i.e. the maximum of all characters);
That is the number of units (usually pixels) below the baseline.
** This method must be redefined in concrete classes (subclassResponsibility) **
-
maxHeight
-
return the font's characters maximum height;
That is the number of units (usually pixels).
-
maxWidth
-
return the font's maximum-width character (i.e. the maximum of all characters);
That is a number of units (usually pixels).
** This method must be redefined in concrete classes (subclassResponsibility) **
-
minCode
-
return the smallest UCS code in font.
Dummy for now
-
width
-
return the font's 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.
-
widthOf: aString
-
return the width of a string
-
widthOf: aString from: start to: stop
-
return the width of a sub string
** This method must be redefined in concrete classes (subclassResponsibility) **
-
widthOf: aString from: start to: stop on: aDevice
-
return the width of a sub string.
Here, assume that this fonts width is device independent.
-
widthOf: aString on: aDevice
-
return the width of a string
-
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
-
isASCII
-
return true, if the receiver's encoding is
compatible with ascii (i.e. its ascii or iso8859)
-
isISO8859
-
return true, if the receiver's encoding is
compatible with iso8859 (i.e. iso8859)
-
isJIS
-
return true, if the receiver's encoding is
compatible with jis (i.e. jisXXX)
testing
-
isAlienFont
-
answer true, if this is an alien font which does not have a device representation.
Alien fonts are eg. Hershey or Bitmap fonts, which are drawn by st/x itself.
-
isXftFont
-
anwer true, if this is an Xft font.
return false here; to be redefined in subclass(es)
|