--- a/FontDescription.st Thu Feb 22 22:20:12 1996 +0100
+++ b/FontDescription.st Fri Feb 23 03:22:17 1996 +0100
@@ -11,10 +11,10 @@
"
Object subclass:#FontDescription
- instanceVariableNames:'family face style size encoding'
- classVariableNames:''
- poolDictionaries:''
- category:'Graphics-Support'
+ instanceVariableNames:'family face style size encoding'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Graphics-Support'
!
!FontDescription class methodsFor:'documentation'!
@@ -33,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libview/FontDescription.st,v 1.6 1995-11-16 16:25:25 cg Exp $'
-!
-
documentation
"
FontDescription is just a place-holder for scanned font names.
@@ -53,25 +49,6 @@
!FontDescription class methodsFor:'instance creation'!
-name:aFontName
- "returns a font with the given explicit name.
- 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'."
-
- ^ self family:aFontName
- face:nil
- style:nil
- size:nil
- encoding:nil
-
- "
- Font name:'-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'
- "
-!
-
family:familyString
"returns a font for given family and default (12pt) size
with unspecified encoding.
@@ -90,23 +67,6 @@
"
!
-family:familyString size:sizeNum
- "returns a font for given family and size with unspecified encoding.
- Face is taken as medium, style as roman.
- The returned font is not associated to a specific device"
-
- ^ self family:familyString
- face:'medium'
- style:'roman'
- size:sizeNum
- encoding:nil
-
- "
- Font family:'helvetica' size:10
- Font family:'courier' size:10
- "
-!
-
family:familyString face:faceString size:sizeNum
"returns a font for given family and size with unspecified encoding.
Style is taken as roman.
@@ -151,10 +111,69 @@
style:styleString
size:sizeNum
encoding:encodingSym
+!
+
+family:familyString size:sizeNum
+ "returns a font for given family and size with unspecified encoding.
+ Face is taken as medium, style as roman.
+ The returned font is not associated to a specific device"
+
+ ^ self family:familyString
+ face:'medium'
+ style:'roman'
+ size:sizeNum
+ encoding:nil
+
+ "
+ Font family:'helvetica' size:10
+ Font family:'courier' size:10
+ "
+!
+
+name:aFontName
+ "returns a font with the given explicit name.
+ 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'."
+
+ ^ self family:aFontName
+ face:nil
+ style:nil
+ size:nil
+ encoding:nil
+
+ "
+ Font name:'-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'
+ "
! !
!FontDescription methodsFor:'accessing'!
+encoding
+ "return the encoding, a symbol
+ such as #'ISO8859-1', #'JIS0208.1983-0' or #ASCII.
+ If the fonts encoding is not known, return nil; You should assume
+ ascii-encoding then."
+
+ ^ encoding
+
+ "Modified: 23.2.1996 / 00:45:33 / cg"
+!
+
+face
+ "return the face, a string"
+
+ ^ face
+!
+
+family
+ "return the family, a string"
+
+ ^ family
+!
+
family:familyString face:faceString style:styleString size:sizeNum encoding:encodingString
family := familyString asSymbol.
(faceString notNil and:[faceString notEmpty]) ifTrue:[
@@ -171,94 +190,16 @@
"Modified: 16.11.1995 / 17:13:21 / cg"
!
-family
- "return the family, a string"
-
- ^ family
-!
-
-face
- "return the face, a string"
-
- ^ face
-!
-
-style
- "return the style, a string"
-
- ^ style
-!
-
size
"return the size, a number"
^ size
!
-encoding
- "return the encoding, a symbol such as #iso8859"
-
- ^ encoding
-! !
-
-!FontDescription methodsFor:'queries'!
-
-species
- ^ Font
-!
-
-serif
- "return true, if this font has serifs"
-
- "this should be done in a better way ..."
-
- family = 'Times' ifTrue:[^ true].
- family = 'times' ifTrue:[^ true].
- ^ false.
-!
-
-italic
- "return true if this is an italic font -
- for st-80 compatibility"
-
- face = 'italic' ifTrue:[^ true].
- face = 'obligue' ifTrue:[^ true].
- ^ false
-!
+style
+ "return the style, a string"
-bold
- "return true, if the receiver is a bold font -
- for st-80 compatibility"
-
- ^ face = 'bold'
-!
-
-boldness
- "return the boldness of the characters in this font 0 .. 1 -
- for st-80 compatibility"
-
- style = 'roman' ifTrue:[^ 0.5].
- style = 'normal' ifTrue:[^ 0.5].
- style = 'bold' ifTrue:[^ 0.75].
- style = 'light' ifTrue:[^ 0.25].
- ^ 0.5
-! !
-
-!FontDescription methodsFor:'errors'!
-
-errorNoDevice
- "a query was made for device-specific info"
-
- "
- this happens, when you ask a font for its height or width,
- ascent or any other dimension which depends on the device on
- which the font is rendered, AND the receiver font is not (yet)
- associated to a device.
- You should always use
- font := font on:someDevice
- to get a device font, before asking for device specifics.
- "
- self error:'query device independent font for for device specific info'
+ ^ style
! !
!FontDescription methodsFor:'comparing'!
@@ -285,17 +226,6 @@
!FontDescription methodsFor:'converting'!
-on:aDevice
- "given the receiver, return a device Font"
-
- ^ (Font
- family:family
- face:'bold'
- style:style
- size:size
- encoding:encoding) on:aDevice
-!
-
asBold
"return the bold font corresponding to the receiver"
@@ -318,6 +248,17 @@
encoding:encoding
!
+on:aDevice
+ "given the receiver, return a device Font"
+
+ ^ (Font
+ family:family
+ face:'bold'
+ style:style
+ size:size
+ encoding:encoding) on:aDevice
+!
+
size:newSize
"return a font corresponding to the receiver, but with different size."
@@ -329,5 +270,74 @@
encoding:encoding
! !
+!FontDescription methodsFor:'errors'!
+errorNoDevice
+ "a query was made for device-specific info"
+ "
+ this happens, when you ask a font for its height or width,
+ ascent or any other dimension which depends on the device on
+ which the font is rendered, AND the receiver font is not (yet)
+ associated to a device.
+ You should always use
+ font := font on:someDevice
+ to get a device font, before asking for device specifics.
+ "
+ self error:'query device independent font for for device specific info'
+! !
+
+!FontDescription methodsFor:'queries'!
+
+bold
+ "return true, if the receiver is a bold font -
+ for st-80 compatibility"
+
+ ^ face = 'bold'
+!
+
+boldness
+ "return the boldness of the characters in this font 0 .. 1 -
+ for st-80 compatibility"
+
+ style = 'roman' ifTrue:[^ 0.5].
+ style = 'normal' ifTrue:[^ 0.5].
+ style = 'bold' ifTrue:[^ 0.75].
+ style = 'light' ifTrue:[^ 0.25].
+ ^ 0.5
+!
+
+fullName
+ ^ nil
+
+ "Created: 23.2.1996 / 00:45:45 / cg"
+!
+
+italic
+ "return true if this is an italic font -
+ for st-80 compatibility"
+
+ face = 'italic' ifTrue:[^ true].
+ face = 'obligue' ifTrue:[^ true].
+ ^ false
+!
+
+serif
+ "return true, if this font has serifs"
+
+ "this should be done in a better way ..."
+
+ family = 'Times' ifTrue:[^ true].
+ family = 'times' ifTrue:[^ true].
+ ^ false.
+!
+
+species
+ ^ Font
+! !
+
+!FontDescription class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libview/FontDescription.st,v 1.7 1996-02-23 02:22:17 cg Exp $'
+! !