author | Claus Gittinger <cg@exept.de> |
Wed, 07 May 2003 16:32:08 +0200 | |
changeset 3880 | c4c8268a2d9f |
parent 3827 | 3390983893a2 |
child 3987 | 796ff0ae8306 |
permissions | -rw-r--r-- |
52 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
89 | 3 |
All Rights Reserved |
52 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
3246 | 13 |
"{ Package: 'stx:libview' }" |
14 |
||
52 | 15 |
Object subclass:#FontDescription |
1275 | 16 |
instanceVariableNames:'family face style size encoding manufacturer name flags masks |
17 |
pixelSize' |
|
1265
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
18 |
classVariableNames:'BoldnessMask FixedFlag ItalicFlag OutlineFlag SerifFlag |
3827
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
19 |
ShadowFlag StrikeoutFlag UnderlineFlag CharacterSetToFontMapping' |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
20 |
poolDictionaries:'' |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
21 |
category:'Graphics-Support' |
52 | 22 |
! |
23 |
||
1275 | 24 |
!FontDescription class methodsFor:'documentation'! |
52 | 25 |
|
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
89 | 29 |
All Rights Reserved |
52 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
FontDescription is just a place-holder for scanned font names. |
|
43 |
||
611 | 44 |
[Instance variables:] |
45 |
family <String> the fonts family ('courier', 'helvetica' etc) |
|
46 |
face <String> the fonts face ('bold', 'medium' etc) |
|
47 |
style <String> the fonts style ('roman', 'italic', 'oblique') |
|
48 |
size <String> the fonts size (not in pixels) |
|
49 |
encoding <Symbol> the fonts encoding (usually #iso8859) |
|
50 |
||
1265
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
51 |
manufacturer <nil|String|Array> |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
52 |
the fonts origin - if known |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
53 |
name <nil|String|Array> |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
54 |
the platform specific name |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
55 |
|
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
56 |
flags <SmallInteger> holds serif/italic etc. as flag bits |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
57 |
masks <SmallInteger> currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
58 |
pixelSize <SmallInteger> currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
59 |
|
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
60 |
[class variables:] |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
61 |
BoldnessMask currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
62 |
FixedFlag currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
63 |
ItalicFlag currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
64 |
OutlineFlag currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
65 |
SerifFlag currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
66 |
ShadowFlag currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
67 |
StrikeoutFlag currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
68 |
UnderlineFlag currently dummy; to allow ST-80 compatible subclassing |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
69 |
|
611 | 70 |
[author:] |
71 |
Claus Gittinger |
|
629 | 72 |
|
73 |
[see also:] |
|
74 |
Font |
|
75 |
FontPanel |
|
76 |
GraphicsContext |
|
77 |
( introduction to view programming :html: programming/viewintro.html#FONTS ) |
|
52 | 78 |
" |
79 |
! ! |
|
80 |
||
1265
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
81 |
!FontDescription class methodsFor:'initialization'! |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
82 |
|
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
83 |
initialize |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
84 |
"initialize class variables" |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
85 |
|
3827
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
86 |
BoldnessMask := 2r0000000111. "/ allows for 8 boldnesses to be encoded |
1265
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
87 |
FixedFlag := 2r0000001000. |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
88 |
ItalicFlag := 2r0000010000. |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
89 |
OutlineFlag := 2r0000100000. |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
90 |
SerifFlag := 2r0001000000. |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
91 |
ShadowFlag := 2r0010000000. |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
92 |
StrikeoutFlag := 2r0100000000. |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
93 |
UnderlineFlag := 2r1000000000. |
3827
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
94 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
95 |
self initializeCharacterSetToFontMapping. |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
96 |
! |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
97 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
98 |
initializeCharacterSetToFontMapping |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
99 |
"character sets" |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
100 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
101 |
CharacterSetToFontMapping isNil ifTrue:[ |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
102 |
CharacterSetToFontMapping := Dictionary new |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
103 |
]. |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
104 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
105 |
#( |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
106 |
'iso2022-jp' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
107 |
'x-iso2022-jp' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
108 |
'x-euc-jp' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
109 |
'x-shift-jis' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
110 |
'x-sjis' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
111 |
'x-jis7' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
112 |
'jis7' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
113 |
'euc' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
114 |
'euc-jp' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
115 |
'sjis' 'jis*0208*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
116 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
117 |
'big5' 'big5*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
118 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
119 |
'gb2312' 'gb*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
120 |
'hz-gb-2312' 'gb*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
121 |
'x-gbk' 'gb*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
122 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
123 |
'iso2022-kr' 'ksc*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
124 |
'x-euc-kr' 'ksc*' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
125 |
) pairWiseDo:[:charSet :fontEncoding| |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
126 |
CharacterSetToFontMapping at:charSet put:fontEncoding |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
127 |
]. |
1265
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
128 |
! ! |
c8030e99f941
added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
129 |
|
1275 | 130 |
!FontDescription class methodsFor:'instance creation'! |
52 | 131 |
|
153 | 132 |
family:familyString |
133 |
"returns a font for given family and default (12pt) size |
|
134 |
with unspecified encoding. |
|
629 | 135 |
The new fonts face defaults `medium', its style to `roman'. |
153 | 136 |
The returned font is not associated to a specific device" |
137 |
||
138 |
^ self family:familyString |
|
629 | 139 |
face:'medium' |
140 |
style:'roman' |
|
141 |
size:12 |
|
142 |
encoding:nil |
|
153 | 143 |
|
144 |
" |
|
145 |
Font family:'helvetica' |
|
146 |
Font family:'courier' |
|
147 |
" |
|
629 | 148 |
|
149 |
"Modified: 30.4.1996 / 17:20:44 / cg" |
|
153 | 150 |
! |
151 |
||
109 | 152 |
family:familyString face:faceString size:sizeNum |
153 |
"returns a font for given family and size with unspecified encoding. |
|
629 | 154 |
The new fonts style defaults to `roman'. |
109 | 155 |
The returned font is not associated to a specific device" |
156 |
||
157 |
^ self family:familyString |
|
629 | 158 |
face:faceString |
159 |
style:'roman' |
|
160 |
size:sizeNum |
|
161 |
encoding:nil |
|
109 | 162 |
|
163 |
" |
|
164 |
Font family:'helvetica' face:'medium' size:10 |
|
165 |
Font family:'helvetica' face:'bold' size:10 |
|
166 |
Font family:'courier' face:'bold' size:10 |
|
167 |
" |
|
629 | 168 |
|
169 |
"Modified: 30.4.1996 / 17:21:07 / cg" |
|
109 | 170 |
! |
171 |
||
172 |
family:familyString face:faceString style:styleString size:sizeNum |
|
173 |
"returns a font for given family, face, style and size with |
|
174 |
unspecified encoding. |
|
175 |
The returned font is not associated to a specific device" |
|
176 |
||
177 |
^ self family:familyString |
|
178 |
face:faceString |
|
179 |
style:styleString |
|
180 |
size:sizeNum |
|
181 |
encoding:nil |
|
182 |
||
183 |
" |
|
184 |
Font family:'helvetica' face:'medium' style:'roman' size:10 |
|
185 |
Font family:'helvetica' face:'medium' style:'italic' size:10 |
|
186 |
Font family:'helvetica' face:'bold' style:'roman' size:10 |
|
187 |
Font family:'courier' face:'bold' style:'italic' size:10 |
|
188 |
" |
|
189 |
! |
|
190 |
||
52 | 191 |
family:familyString face:faceString style:styleString size:sizeNum encoding:encodingSym |
576 | 192 |
"returns a font for given family, face, style, size and |
193 |
the specified encoding. |
|
194 |
The returned font is not associated to a specific device" |
|
195 |
||
52 | 196 |
^ self new |
576 | 197 |
family:familyString |
198 |
face:faceString |
|
199 |
style:styleString |
|
200 |
size:sizeNum |
|
201 |
encoding:encodingSym |
|
202 |
||
203 |
"Modified: 20.4.1996 / 23:19:04 / cg" |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
204 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
205 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
206 |
family:familyString size:sizeNum |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
207 |
"returns a font for given family and size with unspecified encoding. |
629 | 208 |
The new fonts face defaults to `medium', its style to `roman'. |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
209 |
The returned font is not associated to a specific device" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
210 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
211 |
^ self family:familyString |
629 | 212 |
face:'medium' |
213 |
style:'roman' |
|
214 |
size:sizeNum |
|
215 |
encoding:nil |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
216 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
217 |
" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
218 |
Font family:'helvetica' size:10 |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
219 |
Font family:'courier' size:10 |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
220 |
" |
629 | 221 |
|
222 |
"Modified: 30.4.1996 / 17:21:40 / cg" |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
223 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
224 |
|
1071 | 225 |
family:familyString style:aStyle size:sizeNum |
226 |
"returns a font for given family and size with unspecified encoding. |
|
227 |
The new fonts face defaults to `medium', its style to `roman'. |
|
228 |
The returned font is not associated to a specific device" |
|
229 |
||
230 |
^ self family:familyString |
|
231 |
face:'medium' |
|
232 |
style:aStyle |
|
233 |
size:sizeNum |
|
234 |
encoding:nil |
|
235 |
||
236 |
" |
|
237 |
Font family:'helvetica' style:#roman size:48 |
|
238 |
Font family:'courier' style:#roman size:10 |
|
239 |
" |
|
240 |
||
241 |
"Modified: 30.4.1996 / 17:21:40 / cg" |
|
242 |
"Created: 8.10.1996 / 18:33:55 / cg" |
|
243 |
! |
|
244 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
245 |
name:aFontName |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
246 |
"returns a font with the given explicit name. |
629 | 247 |
WARNING: |
248 |
You shuld not use explicit naming, since font names vary |
|
249 |
with operatingSystems, devices and architecture. |
|
250 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
251 |
This interface is provided for special purposes only. |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
252 |
On X, the name given should be according the X fontname conventions; |
629 | 253 |
i.e. something like: '-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'. |
254 |
||
255 |
On other devices, font naming may be completely different." |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
256 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
257 |
^ self family:aFontName |
629 | 258 |
face:nil |
259 |
style:nil |
|
260 |
size:nil |
|
261 |
encoding:nil |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
262 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
263 |
" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
264 |
Font name:'-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1' |
629 | 265 |
Font name:'6x10' |
266 |
Font name:'k14' |
|
267 |
((Font name:'k14') on:Display) encoding |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
268 |
" |
629 | 269 |
|
270 |
"Modified: 30.4.1996 / 17:23:09 / cg" |
|
52 | 271 |
! ! |
272 |
||
3827
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
273 |
!FontDescription class methodsFor:'queries'! |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
274 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
275 |
fontNamePatternForCharset:aCharSetName |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
276 |
"return the font-encoding for an iso-charset" |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
277 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
278 |
^ CharacterSetToFontMapping at:aCharSetName ifAbsent:nil |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
279 |
|
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
280 |
" |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
281 |
FontDescription fontNamePatternForCharset:'iso2022-jp' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
282 |
FontDescription fontNamePatternForCharset:'euc-jp' |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
283 |
" |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
284 |
! ! |
3390983893a2
font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents:
3785
diff
changeset
|
285 |
|
3880 | 286 |
!FontDescription methodsFor:'Compatibility-ST80'! |
1277 | 287 |
|
288 |
boldness:aNumber |
|
289 |
"added for ST-80 compatibility; actually ignored currently" |
|
290 |
||
291 |
|val| |
|
292 |
||
293 |
flags isNil ifTrue:[ |
|
294 |
flags := masks := 0 |
|
295 |
]. |
|
296 |
||
297 |
"/ scale from 0..1 to 0..BoldnessMask |
|
298 |
val := (aNumber max:0.0) min:1.0. |
|
299 |
val := (BoldnessMask * val) rounded. |
|
300 |
||
301 |
flags := flags bitOr:val. |
|
302 |
masks := masks bitOr:BoldnessMask |
|
303 |
||
304 |
"Created: 25.1.1997 / 03:20:05 / cg" |
|
305 |
"Modified: 25.1.1997 / 03:20:47 / cg" |
|
306 |
! |
|
307 |
||
308 |
color:aColor |
|
309 |
"added for ST-80 compatibility; actually ignored currently" |
|
310 |
||
311 |
"Created: 25.1.1997 / 03:21:28 / cg" |
|
312 |
! |
|
313 |
||
1760
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
314 |
encodings:aCollectionOfEncodings |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
315 |
"added for ST-80 compatibility; actually ignored currently" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
316 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
317 |
"Created: 20.6.1997 / 09:52:46 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
318 |
! |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
319 |
|
1277 | 320 |
fixedWidth:aBoolean |
321 |
"added for ST-80 compatibility; actually ignored currently" |
|
322 |
||
323 |
flags isNil ifTrue:[ |
|
324 |
flags := masks := 0 |
|
325 |
]. |
|
326 |
flags := flags bitOr:FixedFlag. |
|
327 |
masks := masks bitOr:FixedFlag |
|
328 |
||
329 |
"Created: 25.1.1997 / 03:14:06 / cg" |
|
330 |
"Modified: 25.1.1997 / 03:21:03 / cg" |
|
331 |
! |
|
332 |
||
333 |
italic:aBoolean |
|
334 |
"added for ST-80 compatibility; actually ignored currently" |
|
335 |
||
336 |
flags isNil ifTrue:[ |
|
337 |
flags := masks := 0 |
|
338 |
]. |
|
339 |
flags := flags bitOr:ItalicFlag. |
|
340 |
masks := masks bitOr:ItalicFlag |
|
341 |
||
342 |
"Created: 25.1.1997 / 03:15:37 / cg" |
|
343 |
"Modified: 25.1.1997 / 03:20:55 / cg" |
|
344 |
! |
|
345 |
||
1760
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
346 |
outline:aBoolean |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
347 |
"added for ST-80 compatibility; actually ignored currently" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
348 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
349 |
flags isNil ifTrue:[ |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
350 |
flags := masks := 0 |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
351 |
]. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
352 |
flags := flags bitOr:OutlineFlag. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
353 |
masks := masks bitOr:OutlineFlag |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
354 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
355 |
"Modified: 25.1.1997 / 03:20:55 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
356 |
"Created: 20.6.1997 / 09:50:06 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
357 |
! |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
358 |
|
1277 | 359 |
pixelSize:aNumber |
360 |
"added for ST-80 compatibility; actually ignored currently" |
|
361 |
||
362 |
pixelSize := aNumber |
|
363 |
||
364 |
"Modified: 25.1.1997 / 03:20:47 / cg" |
|
365 |
"Created: 25.1.1997 / 03:21:47 / cg" |
|
366 |
! |
|
367 |
||
368 |
serif:aBoolean |
|
369 |
"added for ST-80 compatibility; actually ignored currently" |
|
370 |
||
371 |
flags isNil ifTrue:[ |
|
372 |
flags := masks := 0 |
|
373 |
]. |
|
374 |
flags := flags bitOr:SerifFlag. |
|
375 |
masks := masks bitOr:SerifFlag |
|
376 |
||
377 |
"Created: 25.1.1997 / 03:15:17 / cg" |
|
378 |
"Modified: 25.1.1997 / 03:20:59 / cg" |
|
1760
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
379 |
! |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
380 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
381 |
shadow:aBoolean |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
382 |
"added for ST-80 compatibility; actually ignored currently" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
383 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
384 |
flags isNil ifTrue:[ |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
385 |
flags := masks := 0 |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
386 |
]. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
387 |
flags := flags bitOr:ShadowFlag. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
388 |
masks := masks bitOr:ShadowFlag |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
389 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
390 |
"Modified: 25.1.1997 / 03:20:55 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
391 |
"Created: 20.6.1997 / 09:51:03 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
392 |
! |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
393 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
394 |
strikeout:aBoolean |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
395 |
"added for ST-80 compatibility; actually ignored currently" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
396 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
397 |
flags isNil ifTrue:[ |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
398 |
flags := masks := 0 |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
399 |
]. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
400 |
flags := flags bitOr:StrikeoutFlag. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
401 |
masks := masks bitOr:StrikeoutFlag |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
402 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
403 |
"Modified: 25.1.1997 / 03:20:55 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
404 |
"Created: 20.6.1997 / 09:51:36 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
405 |
! |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
406 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
407 |
underline:aBoolean |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
408 |
"added for ST-80 compatibility; actually ignored currently" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
409 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
410 |
flags isNil ifTrue:[ |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
411 |
flags := masks := 0 |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
412 |
]. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
413 |
flags := flags bitOr:UnderlineFlag. |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
414 |
masks := masks bitOr:UnderlineFlag |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
415 |
|
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
416 |
"Modified: 25.1.1997 / 03:20:55 / cg" |
ccd221469891
more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
417 |
"Created: 20.6.1997 / 09:51:18 / cg" |
1277 | 418 |
! ! |
419 |
||
52 | 420 |
!FontDescription methodsFor:'accessing'! |
421 |
||
2544 | 422 |
device |
423 |
"return the device I am on" |
|
424 |
||
3661 | 425 |
self obsoleteMethodWarning:'use #graphicsDevice'. |
426 |
^ self graphicsDevice |
|
2544 | 427 |
! |
428 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
429 |
encoding |
575 | 430 |
"return the fonts encoding, as a symbol |
456 | 431 |
such as #'iso8859', #'jis0208.1983' or #ascii. |
432 |
If the fonts encoding is not known, return nil; |
|
433 |
You should assume ascii-encoding then." |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
434 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
435 |
^ encoding |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
436 |
|
575 | 437 |
"Modified: 20.4.1996 / 23:14:36 / cg" |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
438 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
439 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
440 |
face |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
441 |
"return the face, a string" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
442 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
443 |
^ face |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
444 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
445 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
446 |
family |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
447 |
"return the family, a string" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
448 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
449 |
^ family |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
450 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
451 |
|
1277 | 452 |
family:aString |
453 |
"set the family, a string" |
|
454 |
||
455 |
family := aString |
|
456 |
||
457 |
"Created: 25.1.1997 / 03:12:12 / cg" |
|
458 |
! |
|
459 |
||
89 | 460 |
family:familyString face:faceString style:styleString size:sizeNum encoding:encodingString |
576 | 461 |
"set the instance values" |
462 |
||
89 | 463 |
family := familyString asSymbol. |
229
099543e5d779
handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents:
219
diff
changeset
|
464 |
(faceString notNil and:[faceString notEmpty]) ifTrue:[ |
576 | 465 |
face := faceString asSymbol. |
89 | 466 |
]. |
229
099543e5d779
handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents:
219
diff
changeset
|
467 |
(styleString notNil and:[styleString notEmpty]) ifTrue:[ |
576 | 468 |
style := styleString asSymbol. |
89 | 469 |
]. |
52 | 470 |
size := sizeNum. |
229
099543e5d779
handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents:
219
diff
changeset
|
471 |
(encodingString notNil and:[encodingString notEmpty]) ifTrue:[ |
576 | 472 |
encoding := encodingString asSymbol. |
89 | 473 |
] |
229
099543e5d779
handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents:
219
diff
changeset
|
474 |
|
576 | 475 |
"Modified: 20.4.1996 / 23:19:25 / cg" |
52 | 476 |
! |
477 |
||
2544 | 478 |
fontId |
479 |
"return the device-dependent font-id" |
|
480 |
||
481 |
^ nil |
|
482 |
||
483 |
||
484 |
! |
|
485 |
||
3661 | 486 |
graphicsDevice |
487 |
"return the device I am on" |
|
488 |
||
489 |
^ nil |
|
490 |
! |
|
491 |
||
1277 | 492 |
manufacturer |
493 |
"return the value of the instance variable 'manufacturer' (automatically generated)" |
|
494 |
||
495 |
^ manufacturer |
|
496 |
||
497 |
"Created: 25.1.1997 / 03:12:43 / cg" |
|
498 |
! |
|
499 |
||
500 |
manufacturer:something |
|
501 |
"set the value of the instance variable 'manufacturer' (automatically generated)" |
|
502 |
||
503 |
manufacturer := something. |
|
504 |
||
505 |
"Created: 25.1.1997 / 03:12:43 / cg" |
|
506 |
! |
|
507 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
508 |
style |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
509 |
"return the style, a string" |
109 | 510 |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
511 |
^ style |
109 | 512 |
! ! |
513 |
||
514 |
!FontDescription methodsFor:'comparing'! |
|
515 |
||
516 |
= aFont |
|
517 |
"two fonts are considered equal, if the font-name components are; |
|
518 |
independent of the device, the font is on" |
|
519 |
||
520 |
(aFont species == self species) ifTrue:[ |
|
521 |
(size == aFont size) ifTrue:[ |
|
522 |
(family = aFont family) ifTrue:[ |
|
523 |
(face = aFont face) ifTrue:[ |
|
524 |
(style = aFont style) ifTrue:[ |
|
525 |
(encoding == aFont encoding) ifTrue:[ |
|
526 |
^ true |
|
527 |
] |
|
528 |
] |
|
529 |
] |
|
530 |
] |
|
531 |
] |
|
532 |
]. |
|
533 |
^ false |
|
2160 | 534 |
! |
535 |
||
536 |
hash |
|
537 |
"return a number for hashing - req'd since = is redefined." |
|
538 |
||
2771
25c96682a2f3
really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents:
2770
diff
changeset
|
539 |
^ ( (family hash bitAnd:16r1FFFFFFF) |
25c96682a2f3
really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents:
2770
diff
changeset
|
540 |
+ (face hash bitAnd:16r1FFFFFFF) |
25c96682a2f3
really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents:
2770
diff
changeset
|
541 |
+ (style hash bitAnd:16r1FFFFFFF) |
3019
6dc6821c111c
oops - care for fractional size in #hash
Claus Gittinger <cg@exept.de>
parents:
2980
diff
changeset
|
542 |
+ (size ? 0) asInteger) bitAnd:16r3FFFFFFF |
2160 | 543 |
|
544 |
"Created: / 19.6.1998 / 04:19:06 / cg" |
|
2164 | 545 |
"Modified: / 20.6.1998 / 17:04:00 / cg" |
109 | 546 |
! ! |
547 |
||
548 |
!FontDescription methodsFor:'converting'! |
|
549 |
||
550 |
asBold |
|
551 |
"return the bold font corresponding to the receiver" |
|
552 |
||
3254
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
553 |
family isNil ifTrue:[ |
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
554 |
^ self |
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
555 |
]. |
109 | 556 |
^ self class |
3254
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
557 |
family:family |
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
558 |
face:'bold' |
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
559 |
style:style |
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
560 |
size:size |
984d6c2f0f79
asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents:
3246
diff
changeset
|
561 |
encoding:encoding |
109 | 562 |
! |
563 |
||
564 |
asItalic |
|
565 |
"return the italic font corresponding to the receiver" |
|
566 |
||
567 |
^ self class |
|
568 |
family:family |
|
569 |
face:face |
|
570 |
style:'oblique' |
|
571 |
size:size |
|
572 |
encoding:encoding |
|
573 |
! |
|
574 |
||
1740 | 575 |
fromLiteralArrayEncoding:encoding |
2436 | 576 |
"read my contents from a aLiteralEncodedArray. |
577 |
Must match to what is generated in #literalArrayEncoding" |
|
1740 | 578 |
|
579 |
family := encoding at:2. |
|
580 |
face := encoding at:3. |
|
581 |
style := encoding at:4. |
|
582 |
size := encoding at:5. |
|
583 |
! |
|
584 |
||
585 |
literalArrayEncoding |
|
2436 | 586 |
"return myself encoded as a literal array. |
587 |
Must match to what is expected in #fromLiteralArrayEncoding:" |
|
1740 | 588 |
|
589 |
^ Array |
|
590 |
with:self class name asSymbol |
|
591 |
with:family |
|
592 |
with:face |
|
593 |
with:style |
|
594 |
with:size |
|
595 |
! |
|
596 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
597 |
on:aDevice |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
598 |
"given the receiver, return a device Font" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
599 |
|
3623 | 600 |
"/ send out a warning: #on: is typically used to create views |
601 |
"/ operating on a model. |
|
602 |
"/ Please use #onDevice: to avoid confusion. |
|
603 |
||
604 |
<resource:#obsolete> |
|
605 |
||
606 |
self obsoleteMethodWarning:'use #onDevice:'. |
|
3629 | 607 |
^ self onDevice:aDevice. |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
608 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
609 |
|
1497
697ac9b15962
added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
1277
diff
changeset
|
610 |
onDevice:aDevice |
697ac9b15962
added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
1277
diff
changeset
|
611 |
"given the receiver, return a device Font" |
697ac9b15962
added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
1277
diff
changeset
|
612 |
|
2980
409e9547a45c
ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents:
2934
diff
changeset
|
613 |
aDevice isNil ifTrue:[^ self]. |
3629 | 614 |
^ (Font |
615 |
family:family |
|
616 |
face:face |
|
617 |
style:style |
|
618 |
size:size |
|
619 |
encoding:encoding) onDevice:aDevice |
|
1497
697ac9b15962
added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
1277
diff
changeset
|
620 |
|
697ac9b15962
added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
1277
diff
changeset
|
621 |
"Created: 28.3.1997 / 16:09:30 / cg" |
697ac9b15962
added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
1277
diff
changeset
|
622 |
! |
697ac9b15962
added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
1277
diff
changeset
|
623 |
|
109 | 624 |
size:newSize |
625 |
"return a font corresponding to the receiver, but with different size." |
|
626 |
||
627 |
^ self class |
|
628 |
family:family |
|
629 |
face:face |
|
630 |
style:style |
|
631 |
size:newSize |
|
632 |
encoding:encoding |
|
633 |
! ! |
|
634 |
||
2544 | 635 |
!FontDescription methodsFor:'displaying'! |
636 |
||
637 |
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aGC |
|
3663 | 638 |
"display a partial string at some position in aGC. |
639 |
- display part of a string, drawing both fore- and background pixels" |
|
2544 | 640 |
|
3663 | 641 |
self displayString:aString from:index1 to:index2 x:x y:y in:aGC opaque:true |
2544 | 642 |
! |
643 |
||
644 |
displayOpaqueString:aString x:x y:y in:aGC |
|
645 |
"display a string at some position in aGC." |
|
646 |
||
647 |
self displayOpaqueString:aString from:1 to:aString size x:x y:y in:aGC |
|
648 |
! |
|
649 |
||
650 |
displayString:aString from:index1 to:index2 x:x y:y in:aGC |
|
651 |
"display a partial string at some position in aGC." |
|
652 |
||
3663 | 653 |
self displayString:aString from:index1 to:index2 x:x y:y in:aGC opaque:false |
654 |
! |
|
655 |
||
656 |
displayString:aString from:index1 to:index2 x:x y:y in:aGC opaque:opaque |
|
657 |
"display a partial string at some position in aGC." |
|
658 |
||
2544 | 659 |
self subclassResponsibility |
660 |
! |
|
661 |
||
662 |
displayString:aString x:x y:y in:aGC |
|
663 |
"display a string at some position in aGC." |
|
664 |
||
665 |
self displayString:aString from:1 to:aString size x:x y:y in:aGC |
|
666 |
||
667 |
! ! |
|
668 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
669 |
!FontDescription methodsFor:'errors'! |
109 | 670 |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
671 |
errorNoDevice |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
672 |
"a query was made for device-specific info" |
109 | 673 |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
674 |
" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
675 |
this happens, when you ask a font for its height or width, |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
676 |
ascent or any other dimension which depends on the device on |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
677 |
which the font is rendered, AND the receiver font is not (yet) |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
678 |
associated to a device. |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
679 |
You should always use |
3159 | 680 |
font := font on:someDevice |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
681 |
to get a device font, before asking for device specifics. |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
682 |
" |
3159 | 683 |
self error:'query device independent font for device specific info' |
684 |
||
685 |
"Modified: / 27.1.2000 / 16:55:05 / stefan" |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
686 |
! ! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
687 |
|
3785 | 688 |
!FontDescription methodsFor:'getting a device font'! |
689 |
||
690 |
onDevice:aDevice ifAbsent:exceptionBlock |
|
691 |
"create a new Font representing the same font as |
|
692 |
myself on aDevice. This does NOT try to look for existing |
|
693 |
or replacement fonts (i.e. can be used to get physical fonts)." |
|
694 |
||
695 |
|newFont id| |
|
696 |
||
697 |
"ask that device for the font" |
|
698 |
id := aDevice getFontWithFamily:family face:face style:style size:size encoding:encoding. |
|
699 |
id isNil ifTrue:[ |
|
700 |
"oops did not work - (device has no such font)" |
|
701 |
||
702 |
^ exceptionBlock value |
|
703 |
]. |
|
704 |
||
705 |
newFont := (Font basicNew) |
|
706 |
setFamily:family |
|
707 |
face:face |
|
708 |
style:style |
|
709 |
size:size |
|
710 |
encoding:encoding |
|
711 |
device:aDevice. |
|
712 |
newFont setFontId:id. |
|
713 |
newFont getFontInfos. |
|
714 |
aDevice registerFont:newFont. |
|
715 |
^ newFont |
|
716 |
! ! |
|
717 |
||
1618 | 718 |
!FontDescription methodsFor:'printing & storing'! |
719 |
||
720 |
userFriendlyName |
|
721 |
"return a user-friendly printed representation of the receiver" |
|
722 |
||
723 |
|nm| |
|
724 |
||
725 |
nm := family. |
|
726 |
face notNil ifTrue:[ |
|
727 |
nm := nm , '-', face. |
|
728 |
]. |
|
729 |
style notNil ifTrue:[ |
|
730 |
nm := nm , '-', style. |
|
731 |
]. |
|
732 |
size notNil ifTrue:[ |
|
733 |
nm := nm , '-', size printString. |
|
734 |
]. |
|
735 |
encoding notNil ifTrue:[ |
|
736 |
nm := nm , '-', encoding . |
|
737 |
]. |
|
738 |
^ nm |
|
739 |
||
740 |
" |
|
741 |
View defaultFont userFriendlyName |
|
742 |
Button defaultFont userFriendlyName |
|
743 |
" |
|
744 |
||
745 |
"Modified: 20.4.1996 / 23:25:36 / cg" |
|
746 |
"Created: 19.4.1997 / 18:09:25 / cg" |
|
747 |
! ! |
|
748 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
749 |
!FontDescription methodsFor:'queries'! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
750 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
751 |
bold |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
752 |
"return true, if the receiver is a bold font - |
1585 | 753 |
Added for st-80 compatibility." |
754 |
||
755 |
"/ Currently, this implementation is a dirty hack and will be changed soon. |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
756 |
|
1275 | 757 |
^ face = 'bold' |
758 |
||
1585 | 759 |
"Modified: 11.4.1997 / 21:31:25 / cg" |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
760 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
761 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
762 |
boldness |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
763 |
"return the boldness of the characters in this font 0 .. 1 - |
1275 | 764 |
Added for st-80 compatibility" |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
765 |
|
1585 | 766 |
"/ Currently, this implementation is a dirty hack and will be changed soon. |
767 |
||
768 |
face = 'roman' ifTrue:[^ 0.5]. |
|
769 |
face = 'normal' ifTrue:[^ 0.5]. |
|
770 |
face = 'bold' ifTrue:[^ 0.75]. |
|
771 |
face = 'light' ifTrue:[^ 0.25]. |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
772 |
^ 0.5 |
1275 | 773 |
|
1585 | 774 |
"Modified: 11.4.1997 / 21:31:31 / cg" |
1275 | 775 |
! |
776 |
||
777 |
color |
|
778 |
"return the default color in which this font is to be rendered. |
|
779 |
Added for st-80 compatibility. |
|
780 |
For now always black." |
|
781 |
||
782 |
^ Color black |
|
783 |
||
784 |
"Created: 25.1.1997 / 02:59:15 / cg" |
|
785 |
"Modified: 25.1.1997 / 03:02:14 / cg" |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
786 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
787 |
|
2544 | 788 |
existsOn:aDevice |
789 |
"return true, if the recevier is available on aDevice; |
|
790 |
false otherwise. This is a kludge method; its better to |
|
791 |
ask a device for its available fonts and use this info ... |
|
792 |
Notice, that if you simply use a font by name, the system |
|
793 |
will automatically take a replacement font." |
|
794 |
||
3629 | 795 |
^ ((Font |
796 |
family:family |
|
797 |
face:face |
|
798 |
style:style |
|
799 |
size:size |
|
800 |
encoding:encoding) onDevice:aDevice ifAbsent:nil) notNil |
|
2544 | 801 |
! |
802 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
803 |
fullName |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
804 |
^ nil |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
805 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
806 |
"Created: 23.2.1996 / 00:45:45 / cg" |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
807 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
808 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
809 |
italic |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
810 |
"return true if this is an italic font - |
1585 | 811 |
Added for st-80 compatibility" |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
812 |
|
1585 | 813 |
"/ Currently, this implementation is a dirty hack and will be changed soon. |
814 |
||
815 |
style = 'italic' ifTrue:[^ true]. |
|
3246 | 816 |
style = 'oblique' ifTrue:[^ true]. |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
817 |
^ false |
1275 | 818 |
|
1585 | 819 |
"Modified: 11.4.1997 / 21:31:42 / cg" |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
820 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
821 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
822 |
serif |
1275 | 823 |
"return true, if this font has serifs. |
1585 | 824 |
Added for st-80 compatibility" |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
825 |
|
1585 | 826 |
"/ Currently, this implementation is a dirty hack and will be changed soon. |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
827 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
828 |
family = 'Times' ifTrue:[^ true]. |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
829 |
family = 'times' ifTrue:[^ true]. |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
830 |
^ false. |
1275 | 831 |
|
1585 | 832 |
"Modified: 11.4.1997 / 21:31:51 / cg" |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
833 |
! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
834 |
|
3265 | 835 |
size |
836 |
"return the size, a number" |
|
837 |
||
838 |
^ size |
|
839 |
! |
|
840 |
||
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
841 |
species |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
842 |
^ Font |
1275 | 843 |
! |
844 |
||
845 |
underline |
|
846 |
"return true if this is an underlined font - |
|
847 |
Added for st-80 compatibility |
|
848 |
(always false here)" |
|
849 |
||
850 |
^ false |
|
851 |
||
852 |
"Created: 25.1.1997 / 02:58:30 / cg" |
|
853 |
"Modified: 25.1.1997 / 03:01:12 / cg" |
|
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
854 |
! ! |
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
855 |
|
2544 | 856 |
!FontDescription methodsFor:'queries-dimensions'! |
857 |
||
858 |
ascent |
|
859 |
"return the ascent - the number of pixels above the baseLine." |
|
860 |
||
861 |
^ self subclassResponsibility |
|
862 |
! |
|
863 |
||
864 |
ascentOn:aDevice |
|
865 |
"return the ascent - the number of pixels above the baseLine." |
|
866 |
||
867 |
^ (self onDevice:aDevice) ascent |
|
868 |
! |
|
869 |
||
870 |
descent |
|
871 |
"return the descent - the number of pixels below the baseLine." |
|
872 |
||
873 |
^ self subclassResponsibility |
|
874 |
! |
|
875 |
||
876 |
descentOn:aDevice |
|
877 |
"return the ascent - the number of pixels above the baseLine." |
|
878 |
||
879 |
^ (self onDevice:aDevice) descent |
|
880 |
||
881 |
||
882 |
! |
|
883 |
||
884 |
height |
|
885 |
"return the height - the number of pixels above plus below the baseLine." |
|
886 |
||
887 |
^ self subclassResponsibility |
|
888 |
! |
|
889 |
||
890 |
heightOf:aString |
|
891 |
"return the height of the given string. |
|
892 |
Here, assume the characters are of constant height" |
|
893 |
||
894 |
^ self height |
|
895 |
! |
|
896 |
||
897 |
heightOf:aString on:aDevice |
|
898 |
"return the height of the given string on the given device." |
|
899 |
||
900 |
^ (self onDevice:aDevice) heightOf:aString |
|
901 |
! |
|
902 |
||
903 |
heightOn:aDevice |
|
904 |
"return the height - the number of pixels above PLUS below the baseLine." |
|
905 |
||
906 |
^ (self onDevice:aDevice) height |
|
907 |
! |
|
908 |
||
909 |
isFixedWidth |
|
910 |
"return true, if this is a fixed pitch font (i.e. all characters |
|
911 |
are of the same width)" |
|
912 |
||
913 |
self subclassResponsibility |
|
914 |
! |
|
915 |
||
916 |
maxAscent |
|
917 |
"return the fonts maximum-ascent (i.e. the maximum of all characters); |
|
918 |
That is the number of units (usually pixels) above the baseline." |
|
919 |
||
920 |
^ self subclassResponsibility |
|
921 |
||
922 |
! |
|
923 |
||
924 |
maxDescent |
|
925 |
"return the fonts maximum-descent (i.e. the maximum of all characters); |
|
926 |
That is the number of units (usually pixels) below the baseline." |
|
927 |
||
928 |
^ self subclassResponsibility |
|
929 |
||
930 |
! |
|
931 |
||
932 |
maxHeight |
|
933 |
"return the fonts characters maximum height; |
|
934 |
That is the number of units (usually pixels)." |
|
935 |
||
936 |
^ self maxAscent + self maxDescent |
|
937 |
||
938 |
! |
|
939 |
||
940 |
maxWidth |
|
941 |
"return the fonts maximum-width character (i.e. the maximum of all characters); |
|
942 |
That is a number of units (usually pixels)." |
|
943 |
||
944 |
^ self subclassResponsibility |
|
945 |
||
946 |
! |
|
947 |
||
948 |
width |
|
949 |
"return the fonts characters width; |
|
950 |
That is a number of units (usually pixels). |
|
951 |
For variable pitch fonts, the width of the space character is returned. |
|
952 |
For fixed fonts, this is the same as minWidth or maxWidth (or any character). |
|
953 |
The receiver must be associated to a device, for this query to be legal." |
|
954 |
||
955 |
^ self widthOf:' ' |
|
956 |
||
957 |
"Modified: 30.4.1996 / 16:43:45 / cg" |
|
958 |
||
959 |
||
960 |
! |
|
961 |
||
962 |
widthOf:aString |
|
963 |
"return the width of a string" |
|
964 |
||
3667 | 965 |
^ self widthOf:aString string from:1 to:aString size |
2544 | 966 |
|
967 |
||
968 |
! |
|
969 |
||
970 |
widthOf:aString from:start to:stop |
|
971 |
"return the width of a sub string" |
|
972 |
||
973 |
^ self subclassResponsibility |
|
974 |
||
975 |
||
976 |
! |
|
977 |
||
978 |
widthOf:aString from:start to:stop on:aDevice |
|
979 |
"return the width of a sub string. |
|
980 |
Here, assume that this fonts width is device independent." |
|
981 |
||
982 |
^ (self onDevice:aDevice) widthOf:aString from:start to:stop |
|
983 |
||
984 |
||
985 |
! |
|
986 |
||
987 |
widthOf:aString on:aDevice |
|
988 |
"return the width of a string" |
|
989 |
||
990 |
^ (self onDevice:aDevice) widthOf:aString |
|
991 |
||
992 |
||
993 |
||
994 |
||
995 |
||
996 |
! |
|
997 |
||
998 |
widthOn:aDevice |
|
999 |
"return the width on some device; that is the width of the space character |
|
1000 |
(which is the width of any character iff the font is a fixed pitch font)" |
|
1001 |
||
1002 |
^ (self onDevice:aDevice) width |
|
1003 |
! ! |
|
1004 |
||
456 | 1005 |
!FontDescription methodsFor:'queries-encoding'! |
1006 |
||
1007 |
isASCII |
|
576 | 1008 |
"return true, if the receivers encoding is |
1009 |
compatible with ascii (i.e. its ascii or iso8859)" |
|
1010 |
||
456 | 1011 |
^ (encoding == #iso8859) or:[encoding == #ascii] |
1012 |
||
1013 |
"Created: 24.2.1996 / 22:47:30 / cg" |
|
576 | 1014 |
"Modified: 20.4.1996 / 23:20:01 / cg" |
456 | 1015 |
! |
1016 |
||
1017 |
isISO8859 |
|
576 | 1018 |
"return true, if the receivers encoding is |
1019 |
compatible with iso8859 (i.e. iso8859)" |
|
1020 |
||
456 | 1021 |
^ encoding == #iso8859 |
1022 |
||
1023 |
"Created: 24.2.1996 / 22:47:12 / cg" |
|
576 | 1024 |
"Modified: 20.4.1996 / 23:20:13 / cg" |
456 | 1025 |
! |
1026 |
||
1027 |
isJIS |
|
576 | 1028 |
"return true, if the receivers encoding is |
1029 |
compatible with jis (i.e. jisXXX)" |
|
1030 |
||
456 | 1031 |
^ (encoding startsWith:'jis') |
1032 |
||
1033 |
"Created: 24.2.1996 / 22:47:47 / cg" |
|
576 | 1034 |
"Modified: 20.4.1996 / 23:20:30 / cg" |
456 | 1035 |
! ! |
1036 |
||
1275 | 1037 |
!FontDescription class methodsFor:'documentation'! |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
1038 |
|
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
1039 |
version |
3880 | 1040 |
^ '$Header: /cvs/stx/stx/libview/FontDescription.st,v 1.46 2003-05-07 14:32:08 cg Exp $' |
437
a81ce3a8038b
return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents:
229
diff
changeset
|
1041 |
! ! |
3785 | 1042 |
|
1275 | 1043 |
FontDescription initialize! |