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