Font.st
author Claus Gittinger <cg@exept.de>
Sat, 24 Feb 1996 17:29:41 +0100
changeset 453 a1541566a972
parent 442 eb4ee58f5f0a
child 454 b31d0a7e5530
permissions -rw-r--r--
added #userFriendlyName
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    13
FontDescription subclass:#Font
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    14
	instanceVariableNames:'device fontId replacementFont ascent descent width isFixedWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    15
		minWidth maxWidth maxAscent maxDescent'
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    16
	classVariableNames:'Lobby Replacements'
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    17
	poolDictionaries:''
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    18
	category:'Graphics-Support'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    19
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    20
48194c26a46c Initial revision
claus
parents:
diff changeset
    21
!Font class methodsFor:'documentation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
    22
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    23
copyright
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    24
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    25
 COPYRIGHT (c) 1992 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    26
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    27
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    28
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    29
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    31
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    32
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    33
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    34
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    35
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    36
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    37
documentation
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    38
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    39
    Font represents fonts in a device independent manner; after being
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    40
    created using 'Font family:family face:face style:style size:size',
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    41
    the returned font is not associated to a specific device.
157
claus
parents: 151
diff changeset
    42
    (therefore, those fonts can be used to draw on any GC)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    43
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    44
    To get a device font, any font can be sent the message
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    45
    'aFont on:aDevice' which returns an instance of Font which is
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    46
    associated to a device (it returns the receiver, if that is already
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    47
    associated to that device).
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    48
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    49
    For proper operation, each graphics operation working with fonts
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    50
    must get a device font before doing the draw.
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    51
    Most draw methods in DeviceDrawable do that automatically for you, 
157
claus
parents: 151
diff changeset
    52
    before doing the draw; so you do not have to care.
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    53
81
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    54
    However, some operations require explicit conversion to a device font
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    55
    before being allowed. For example, a query for a fonts height (in device
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    56
    units) can only be done if the font being asked is associated to
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    57
    a device (which should be clear, since a 'courier-roman-12' font may
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    58
    have a different number of pixels on a 75dpi vs. a 120dpi display. And
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    59
    a total number of device units on a 600dpi laser printer.
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    60
    Thus, to query a font for its height (or ascent, or descent, or width),
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    61
    use something like:
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    62
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    63
	myFont := Font family:'courier' ... size:12.
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    64
	    ...
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    65
        
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    66
	'want to know its height on the Display'
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    67
        
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    68
	h := (myFont on:Display) height.
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    69
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    70
        
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    71
	'want to know its height on a printer'
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    72
        
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    73
	h := (myFont on:aPrinter) height.
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    74
        
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    75
    Keep in mind, that each device is free to think in whatever units it
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    76
    likes - a display may return units of pixels, a postscript printer may
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    77
    think in (fractions of) inches, a dot matrix printer may think in dots.
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    78
    Also, notice that currently only graphic displays are really supported;
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    79
    printer devices are being developped and may or may not be in the current
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    80
    system.
4ba554473294 *** empty log message ***
claus
parents: 71
diff changeset
    81
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    82
    Sometimes, a font cannot be represented on a device, then a replacement
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    83
    font is chosen and kept in the replacementFont instance variable. 
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    84
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    85
    Instance variables:
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    86
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    87
      family          <String>        the fonts family ('courier', 'helvetica' etc)
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    88
      face            <String>        the fonts face ('bold', 'medium' etc)
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    89
      style           <String>        the fonts style ('roman', 'italic', 'oblique')
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    90
      size            <String>        the fonts size (not in pixels) 
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    91
      encoding        <Symbol>        the fonts encoding (usually #iso8859)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    92
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    93
      device          <Object>        the device the font is associated to, or nil
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    94
      fontId          <Object>        the id of the font on that device, or nil
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    95
      replacement     <Font>          the replacement font or nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    96
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    97
      ascent          <Integer>       the fonts ascent in device units on device
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    98
      descent         <Integer>       the fonts descent in device units on device
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
    99
      width           <Integer>       the character width in device units on device
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   100
				      (for variable fonts, its the width of a space)
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   101
      isFixedWidth    <Boolean>       true if font is a fixed width font
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   102
      minWidth        <Integer>       width of the smallest-width character in
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   103
				      in device units on device
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   104
      maxWidth        <Integer>       width of the largest-width character in
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   105
				      in device units on device
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   106
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   107
    class variables:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   108
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   109
      Lobby           <Registry>      keeps track of all known fonts
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   110
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   111
      Replacements    <Dictionary>    replacement fonts
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   112
"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   113
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   114
48194c26a46c Initial revision
claus
parents:
diff changeset
   115
!Font class methodsFor:'initialization'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   116
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   117
flushDeviceFontsFor:aDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   118
    "unassign all fonts from their device if they are assigned
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   119
     to aDevice"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   120
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   121
    Lobby do:[:aFont |
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   122
	(aDevice isNil or:[aFont device == aDevice]) ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   123
	    aFont restored.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   124
	    Lobby registerChange:aFont
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   125
	]
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   126
    ]
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   127
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   128
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   129
initialize
48194c26a46c Initial revision
claus
parents:
diff changeset
   130
    "initialize the font tracking array"
48194c26a46c Initial revision
claus
parents:
diff changeset
   131
23
4a7e02de7b72 *** empty log message ***
claus
parents: 12
diff changeset
   132
    Lobby isNil ifTrue:[
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   133
	Lobby := Registry new.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   134
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   135
	"
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   136
	 want to be informed when returning from snapshot
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   137
	"
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   138
	ObjectMemory addDependent:self.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   139
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   140
	"
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   141
	 replacement handling is not yet finished
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   142
	"
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   143
	Replacements := Dictionary new.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   144
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   145
	Replacements at:'clean'                  put:'courier'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   146
	Replacements at:'fixed'                  put:'courier'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   147
	Replacements at:'new century schoolbook' put:'times'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   148
	Replacements at:'lucida'                 put:'helvetica'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   149
	Replacements at:'lucidabright'           put:'helvetica'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   150
	Replacements at:'lucidatypewriter'       put:'courier'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   151
	Replacements at:'charter'                put:'times'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   152
	Replacements at:'terminal'               put:'courier'.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   153
    ]
48194c26a46c Initial revision
claus
parents:
diff changeset
   154
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   155
48194c26a46c Initial revision
claus
parents:
diff changeset
   156
update:something
414
bf996c417cc8 flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   157
    (something == #earlyRestart) ifTrue:[
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   158
	"
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   159
	 this is sent by ObjectMemory when restarting from
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   160
	 an image. All device specific information (especially device
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   161
	 handles) are now invalid and have to be flushed
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   162
	"
414
bf996c417cc8 flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   163
	self flushDeviceFontsFor:nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   164
    ]
48194c26a46c Initial revision
claus
parents:
diff changeset
   165
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   166
48194c26a46c Initial revision
claus
parents:
diff changeset
   167
!Font class methodsFor:'instance creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   168
48194c26a46c Initial revision
claus
parents:
diff changeset
   169
family:familyString face:faceString style:styleString size:sizeNum encoding:encodingSym
48194c26a46c Initial revision
claus
parents:
diff changeset
   170
    "returns a font for given family, face, style, size and encoding. 
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   171
     The returned font is not associated to a specific device"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   172
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   173
    |family newFont|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   174
48194c26a46c Initial revision
claus
parents:
diff changeset
   175
    (familyString at:1) isUppercase ifTrue:[
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   176
	family := familyString asLowercase
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   177
    ] ifFalse:[
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   178
	family := familyString
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   179
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   180
48194c26a46c Initial revision
claus
parents:
diff changeset
   181
    "look if this font is already known"
48194c26a46c Initial revision
claus
parents:
diff changeset
   182
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
   183
    Lobby do:[:aFont |
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   184
	(aFont family = family) ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   185
	    (aFont face = faceString) ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   186
		(aFont style = styleString) ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   187
		     (aFont size == sizeNum) ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   188
			(encodingSym isNil or:[aFont encoding == encodingSym]) ifTrue:[
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   189
			    ^ aFont
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   190
			]
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   191
		    ]
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   192
		]
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   193
	    ]
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   194
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   195
    ].
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   196
    newFont := self basicNew setFamily:familyString
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   197
				  face:faceString
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   198
				 style:styleString
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   199
				  size:sizeNum
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   200
			      encoding:encodingSym
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   201
				device:nil.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 12
diff changeset
   202
    Lobby register:newFont.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   203
    ^ newFont
48194c26a46c Initial revision
claus
parents:
diff changeset
   204
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   205
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   206
!Font methodsFor:'accessing'!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   207
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   208
device
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   209
    "return the device I am on"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   210
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   211
    ^ device
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   212
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   213
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   214
fontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   215
    "return the device-dependent font-id"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   216
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   217
    ^ fontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   218
! !
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   219
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   220
!Font methodsFor:'binary storage'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   221
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   222
readBinaryContentsFrom: stream manager: manager
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   223
    "tell the newly restored Font about restoration"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   224
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   225
    super readBinaryContentsFrom: stream manager: manager.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   226
    self restored
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   227
! !
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   228
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   229
!Font methodsFor:'displaying'!
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   230
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   231
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aGC
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   232
    "this is only called for fonts which have a nil fontId,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   233
     and therefore use the replacementFont. Should never be called
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   234
     for non-replacement fonts."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   235
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   236
    |prevFont|
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   237
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   238
    replacementFont isNil ifTrue:[
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   239
        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   240
        ^ self
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   241
    ].
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   242
    prevFont := aGC font.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   243
    aGC basicFont:replacementFont.
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   244
    aGC displayOpaqueString:aString from:index1 to:index2 x:x y:y.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   245
    aGC basicFont:prevFont
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   246
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   247
    "Modified: 23.2.1996 / 17:16:24 / cg"
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   248
!
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   249
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   250
displayOpaqueString:aString x:x y:y in:aGC
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   251
    "this is only called for fonts which have a nil fontId,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   252
     and therefore use the replacementFont. Should never be called
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   253
     for non-replacement fonts."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   254
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   255
    |prevFont|
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   256
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   257
    replacementFont isNil ifTrue:[
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   258
        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   259
        ^ self
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   260
    ].
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   261
    prevFont := aGC font.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   262
    aGC basicFont:replacementFont.
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   263
    aGC displayOpaqueString:aString x:x y:y.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   264
    aGC basicFont:prevFont.
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   265
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   266
    "Modified: 23.2.1996 / 17:16:29 / cg"
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   267
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   268
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   269
displayString:aString from:index1 to:index2 x:x y:y in:aGC
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   270
    "this is only called for fonts which have a nil fontId,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   271
     and therefore use the replacementFont. Should never be called
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   272
     for non-replacement fonts."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   273
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   274
    |prevFont|
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   275
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   276
    replacementFont isNil ifTrue:[
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   277
        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   278
        ^ self
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   279
    ].
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   280
    prevFont := aGC font.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   281
    aGC basicFont:replacementFont.
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   282
    aGC displayString:aString from:index1 to:index2 x:x y:y.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   283
    aGC basicFont:prevFont.
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   284
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   285
    "Modified: 23.2.1996 / 17:16:33 / cg"
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   286
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   287
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   288
displayString:aString x:x y:y in:aGC
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   289
    "this is only called for fonts which have a nil fontId,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   290
     and therefore use the replacementFont. Should never be called
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   291
     for non-replacement fonts."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   292
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   293
    |prevFont|
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   294
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   295
    replacementFont isNil ifTrue:[
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   296
        'FONT: oops - no replacementFont. should not happen' errorPrintNL.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   297
        ^ self
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   298
    ].
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   299
    prevFont := aGC font.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   300
    aGC basicFont:replacementFont.
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   301
    aGC displayString:aString x:x y:y.
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   302
    aGC basicFont:prevFont.
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   303
442
eb4ee58f5f0a use #basicFont:
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   304
    "Modified: 23.2.1996 / 17:16:37 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   305
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   306
48194c26a46c Initial revision
claus
parents:
diff changeset
   307
!Font methodsFor:'getting a device font'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   308
48194c26a46c Initial revision
claus
parents:
diff changeset
   309
on:aDevice
48194c26a46c Initial revision
claus
parents:
diff changeset
   310
    "create a new Font representing the same font as
48194c26a46c Initial revision
claus
parents:
diff changeset
   311
     myself on aDevice; if one already exists, return the one."
48194c26a46c Initial revision
claus
parents:
diff changeset
   312
336
fa55b8596c8c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   313
    |newFont rep|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   314
48194c26a46c Initial revision
claus
parents:
diff changeset
   315
    "if I am already assigned to that device ..."
48194c26a46c Initial revision
claus
parents:
diff changeset
   316
    (device == aDevice) ifTrue:[^ self].
48194c26a46c Initial revision
claus
parents:
diff changeset
   317
48194c26a46c Initial revision
claus
parents:
diff changeset
   318
    "first look if not already there"
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
   319
    Lobby do:[:aFont |
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   320
        (aDevice == aFont device) ifTrue:[
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   321
            (size == aFont size) ifTrue:[
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   322
                (family = aFont family) ifTrue:[
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   323
                    (face = aFont face) ifTrue:[
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   324
                        (style = aFont style) ifTrue:[
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   325
                            (encoding isNil or:[encoding == aFont encoding]) ifTrue:[
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   326
                                ^ aFont
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   327
                            ]
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   328
                        ]
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   329
                    ]
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   330
                ]
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   331
            ]
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   332
        ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   333
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   334
157
claus
parents: 151
diff changeset
   335
    newFont := self on:aDevice ifAbsent:nil.
claus
parents: 151
diff changeset
   336
    newFont isNil ifTrue:[
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   337
        "oops did not work - (device has no such font)"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   338
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   339
        rep := self replacementFontOn:aDevice.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   340
        device isNil ifTrue:[
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   341
            device := aDevice.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   342
            replacementFont := rep.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   343
            Lobby registerChange:self.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   344
            ^ self
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   345
        ].
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   346
        newFont := (self class basicNew)
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   347
                     setFamily:family face:face style:style size:size encoding:encoding device:aDevice.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   348
        newFont setReplacementFont:rep.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   349
        Lobby register:newFont.
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   350
        ^ newFont
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   351
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   352
48194c26a46c Initial revision
claus
parents:
diff changeset
   353
    ^ newFont
441
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   354
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   355
    "
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   356
     Font family:'foo' size:17
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   357
    "
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   358
91c3ba82098f replacementFont fixes
Claus Gittinger <cg@exept.de>
parents: 438
diff changeset
   359
    "Modified: 23.2.1996 / 16:30:06 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   360
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   361
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   362
on:aDevice ifAbsent:exceptionBlock 
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   363
    "create a new Font representing the same font as
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   364
     myself on aDevice. This does NOT try to look for existing
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   365
     or replacement fonts (i.e. can be used to get physical fonts)."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   366
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   367
    |newFont id|
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   368
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   369
    "ask that device for the font"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   370
    id := aDevice getFontWithFamily:family face:face style:style size:size encoding:encoding.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   371
    id isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   372
	"oops did not work - (device has no such font)"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   373
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   374
	^ exceptionBlock value
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   375
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   376
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   377
    "receiver was not associated - do it now"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   378
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   379
	device := aDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   380
	fontId := id.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   381
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   382
	self getFontInfos.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   383
	Lobby registerChange:self.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   384
	^ self
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   385
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   386
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   387
    "receiver was already associated to another device - need a new font"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   388
    newFont := (self class basicNew) setFamily:family 
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   389
					  face:face
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   390
					 style:style
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   391
					  size:size
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   392
				      encoding:encoding
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   393
					device:aDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   394
    newFont setFontId:id.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   395
    newFont getFontInfos.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   396
    Lobby register:newFont.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   397
    ^ newFont
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   398
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   399
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   400
replacementFontOn:aDevice
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   401
    "return a replacement font for the receiver - this is needed, if
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   402
     an image is restored on another type of display, or one which has
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   403
     a different set of fonts."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   404
48194c26a46c Initial revision
claus
parents:
diff changeset
   405
    |id f alternative|
48194c26a46c Initial revision
claus
parents:
diff changeset
   406
144
claus
parents: 127
diff changeset
   407
    alternative := Replacements at:family ifAbsent:nil.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   408
    alternative notNil ifTrue:[
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   409
	id := aDevice getFontWithFamily:alternative
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   410
				   face:face
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   411
				  style:style 
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   412
				   size:size
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   413
			       encoding:encoding.
144
claus
parents: 127
diff changeset
   414
    ].
claus
parents: 127
diff changeset
   415
    id notNil ifTrue:[
151
claus
parents: 149
diff changeset
   416
	('replaced ' , family , '- with ' , alternative , '-font') infoPrintNL.
144
claus
parents: 127
diff changeset
   417
    ] ifFalse:[
claus
parents: 127
diff changeset
   418
	id := aDevice getDefaultFont.
151
claus
parents: 149
diff changeset
   419
	('replaced ' , family , '- with default-font') infoPrintNL.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   420
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   421
    id isNil ifTrue:[
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   422
	"oops did not work - this is a serious an error"
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   423
	self error:'cannot get default font'.
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   424
	^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   425
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   426
    f := self class basicNew.
48194c26a46c Initial revision
claus
parents:
diff changeset
   427
    f setDevice:aDevice fontId:id.
48194c26a46c Initial revision
claus
parents:
diff changeset
   428
    f getFontInfos.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 12
diff changeset
   429
    Lobby register:f.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   430
    ^ f
48194c26a46c Initial revision
claus
parents:
diff changeset
   431
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   432
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   433
!Font methodsFor:'instance release'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   434
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   435
disposed
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   436
    "some Font has been collected - tell it to the x-server"
157
claus
parents: 151
diff changeset
   437
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   438
    fontId notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   439
	device releaseFont:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   440
	fontId := nil
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   441
    ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   442
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   443
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   444
shallowCopyForFinalization
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   445
    |aCopy|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   446
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   447
    aCopy := self class basicNew.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   448
    aCopy setDevice:device fontId:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   449
   ^ aCopy
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   450
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   451
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   452
!Font methodsFor:'printing & storing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   453
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   454
printOn:aStream
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   455
    face isNil ifTrue:[
157
claus
parents: 151
diff changeset
   456
	family isNil ifTrue:[
claus
parents: 151
diff changeset
   457
	    aStream nextPutAll:('a replacement-Font').
claus
parents: 151
diff changeset
   458
	    ^ self
claus
parents: 151
diff changeset
   459
	].
claus
parents: 151
diff changeset
   460
	aStream nextPutAll:('a ' , family , '-Font').
claus
parents: 151
diff changeset
   461
	^ self.
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
   462
    ].
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   463
    aStream nextPutAll:('a ' , family , '-' , 
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   464
			       face , '-' , 
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   465
			       style , '-' , 
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   466
			       size printString , '-Font')
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   467
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   468
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   469
storeOn:aStream
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   470
    "append a character sequence to the argument, aStream from which the
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   471
     receiver can be reconstructed using readFrom:."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   472
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   473
    aStream nextPutAll:'(Font family:'. family storeOn:aStream.
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   474
    aStream nextPutAll:' face:'.        face storeOn:aStream.
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   475
    aStream nextPutAll:' style:'.       style storeOn:aStream.
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   476
    aStream nextPutAll:' size:'.        size storeOn:aStream.
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   477
    aStream nextPutAll:' encoding:'.    encoding storeOn:aStream.
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   478
    aStream nextPut:$)
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   479
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   480
    "
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   481
     (Font family:'helvetica' size:10) storeString
ba47d9d6bda8 *** empty log message ***
claus
parents: 99
diff changeset
   482
    "
453
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   483
!
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   484
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   485
userFriendlyName
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   486
    |nm|
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   487
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   488
    nm := family.
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   489
    face notNil ifTrue:[
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   490
        nm := nm , '-', face.
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   491
    ].
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   492
    style notNil ifTrue:[
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   493
        nm := nm , '-', style.
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   494
    ].
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   495
    size notNil ifTrue:[
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   496
        nm := nm , '-', size printString.
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   497
    ].
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   498
    ^ nm
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   499
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   500
    "
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   501
     View defaultFont userFriendlyName
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   502
     Button defaultFont userFriendlyName
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   503
    "
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   504
! !
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   505
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   506
!Font methodsFor:'private'!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   507
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   508
getFontInfos
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   509
    replacementFont isNil ifTrue:[
438
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   510
        encoding := device encodingOf:fontId.
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   511
        ascent := device ascentOf:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   512
        descent := device descentOf:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   513
        maxAscent := device maxAscentOf:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   514
        maxDescent := device maxDescentOf:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   515
        minWidth := device minWidthOfFont:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   516
        maxWidth := device maxWidthOfFont:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   517
        width := device widthOf:' ' inFont:fontId.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   518
        width < minWidth ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   519
            width := minWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   520
        ]
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   521
    ] ifFalse:[
438
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   522
        encoding := replacementFont encoding.
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   523
        ascent := replacementFont ascent.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   524
        descent := replacementFont descent.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   525
        maxAscent := replacementFont maxAscent.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   526
        maxDescent := replacementFont maxDescent.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   527
        width := replacementFont width.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   528
        minWidth := replacementFont minWidth.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   529
        maxWidth := replacementFont maxWidth.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   530
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   531
    isFixedWidth := minWidth == maxWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   532
438
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   533
    "Modified: 23.2.1996 / 00:46:04 / cg"
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   534
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   535
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   536
restored
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   537
    device := nil.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   538
    fontId := nil.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   539
    replacementFont := nil
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   540
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   541
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   542
setDevice:aDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   543
    device := aDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   544
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   545
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   546
setDevice:aDevice fontId:aFontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   547
    device := aDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   548
    fontId := aFontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   549
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   550
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   551
setFamily:familyString face:faceString style:styleString size:sizeNum encoding:encodingSym device:aDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   552
    family := familyString.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   553
    face := faceString.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   554
    style := styleString.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   555
    size := sizeNum.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   556
    encoding := encodingSym.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   557
    device := aDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   558
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   559
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   560
setFontId:aFontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   561
    fontId := aFontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   562
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   563
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   564
setReplacementFont:aFont
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   565
    replacementFont := aFont
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   566
! !
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   567
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   568
!Font methodsFor:'queries'!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   569
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   570
ascent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   571
    "return the font-ascent (i.e. the normal average of all characters);
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   572
     That is the number of units (usually pixels) above the baseline.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   573
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   574
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   575
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   576
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   577
	self errorNoDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   578
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   579
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   580
	^ replacementFont ascent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   581
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   582
    ^ ascent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   583
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   584
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   585
descent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   586
    "return the font-descent (i.e. the normal average of all characters);
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   587
     That is the number of units (usually pixels) below the baseline.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   588
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   589
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   590
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   591
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   592
	self errorNoDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   593
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   594
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   595
	^ replacementFont descent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   596
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   597
    ^ descent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   598
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   599
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   600
existsOn:aDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   601
    "return true, if the recevier is available on aDevice;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   602
     false otherwise. This is a kludge method; its better to
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   603
     ask a device for its available fonts and use this info ...
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   604
     Notice, that if you simply use a font by name, the system
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   605
     will automatically take a replacement font."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   606
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   607
    ^ (self on:aDevice ifAbsent:nil) notNil
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   608
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   609
438
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   610
fullName
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   611
    device isNil ifTrue:[
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   612
        ^ nil
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   613
    ].
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   614
    ^ device fullNameOf:fontId.
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   615
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   616
    "Created: 23.2.1996 / 00:44:10 / cg"
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   617
    "Modified: 23.2.1996 / 00:46:44 / cg"
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   618
!
03e433e2be99 return encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 435
diff changeset
   619
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   620
height
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   621
    "return the fonts characters normal (average) height;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   622
     That is the number of units (usually pixels) on the device.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   623
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   624
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   625
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   626
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   627
	self errorNoDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   628
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   629
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   630
	^ replacementFont height
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   631
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   632
    ^ descent + ascent.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   633
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   634
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   635
isFixedWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   636
    "return true, if all characters have same width (as in courier).
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   637
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   638
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   639
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   640
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   641
	self errorNoDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   642
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   643
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   644
	^ replacementFont isFixedWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   645
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   646
    ^ isFixedWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   647
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   648
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   649
maxAscent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   650
    "return the fonts maximum-ascent (i.e. the maximum of all characters);
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   651
     That is the number of units (usually pixels) above the baseline.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   652
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   653
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   654
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   655
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   656
	self errorNoDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   657
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   658
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   659
	^ replacementFont maxAscent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   660
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   661
    ^ maxAscent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   662
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   663
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   664
maxDescent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   665
    "return the font-descent (i.e. the maximum of all characters);
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   666
     That is the number of units (usually pixels) below the baseline.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   667
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   668
     for this query to be legal."
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   669
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   670
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   671
	self errorNoDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   672
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   673
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   674
	^ replacementFont maxDescent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   675
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   676
    ^ maxDescent
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   677
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   678
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   679
maxHeight
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   680
    "return the fonts characters maximum height;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   681
     That is the number of units (usually pixels) on the device.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   682
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   683
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   684
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   685
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   686
	self errorNoDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   687
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   688
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   689
	^ replacementFont maxHeight
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   690
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   691
    ^ maxDescent + maxAscent.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   692
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   693
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   694
maxWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   695
    "return the width of the widest character;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   696
     if the receiver is a fixed width font its the width of every character.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   697
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   698
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   699
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   700
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   701
	self errorNoDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   702
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   703
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   704
	^ replacementFont maxWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   705
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   706
    ^ maxWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   707
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   708
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   709
minWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   710
    "return the width of the smallest character;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   711
     if the receiver is a fixed width font its the width of every character.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   712
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   713
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   714
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   715
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   716
	self errorNoDevice
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   717
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   718
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   719
	^ replacementFont minWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   720
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   721
    ^ minWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   722
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   723
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   724
width
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   725
    "return the fonts characters width;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   726
     That is the number of units (usually pixels) on the device.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   727
     For variable pitch fonts, the width of the space character is returned.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   728
     For fixed fonts, this is the same as minWidth or maxWidth.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   729
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   730
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   731
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   732
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   733
	self errorNoDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   734
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   735
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   736
	^ replacementFont width
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   737
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   738
    ^ width
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   739
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   740
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   741
widthOf:textOrString
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   742
    "return the width (device specific) of the argument;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   743
     the argument may be a Character, String or some Text;
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   744
     in the last case the width of the longest line in the text is returned.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   745
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   746
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   747
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   748
    |this max|
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   749
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   750
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   751
        self errorNoDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   752
        ^ 0
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   753
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   754
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   755
        ^ replacementFont widthOf:textOrString
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   756
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   757
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   758
    (textOrString isString) ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   759
        isFixedWidth ifFalse:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   760
            ^ device widthOf:textOrString inFont:fontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   761
        ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   762
        ^ width * textOrString size
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   763
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   764
    (textOrString isCharacter) ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   765
        isFixedWidth ifFalse:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   766
            ^ device widthOf:textOrString asString inFont:fontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   767
        ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   768
        ^ width
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   769
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   770
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   771
    max := 0.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   772
    isFixedWidth ifFalse:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   773
        textOrString do:[:line |
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   774
            line notNil ifTrue:[
435
5288c637512e care for nonStrings when asked for the size
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   775
                this := device widthOf:line asString inFont:fontId.
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   776
                (this > max) ifTrue:[max := this]
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   777
            ]
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   778
        ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   779
        ^ max
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   780
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   781
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   782
    textOrString do:[:lineString |
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   783
        this := lineString size.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   784
        (this > max) ifTrue:[max := this]
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   785
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   786
    ^ max * width
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   787
435
5288c637512e care for nonStrings when asked for the size
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   788
    "Modified: 22.2.1996 / 21:53:52 / cg"
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   789
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   790
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   791
widthOf:aString from:start to:stop
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   792
    "return the width of a substring.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   793
     The receiver must be associated to a device,
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   794
     for this query to be legal."
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   795
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   796
    device isNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   797
	self errorNoDevice.
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   798
	^ 0
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   799
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   800
    replacementFont notNil ifTrue:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   801
	^ replacementFont widthOf:aString from:start to:stop
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   802
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   803
    (stop < start) ifTrue:[^ 0].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   804
    isFixedWidth ifFalse:[
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   805
	^ device widthOf:aString from:start to:stop inFont:fontId
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   806
    ].
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   807
    ^ (stop - start + 1) * width
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   808
! !
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   809
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   810
!Font methodsFor:'st-80 queries'!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   811
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   812
fixedWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   813
    "return true, if this font is a fixed width font -
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   814
     for st-80 compatibility"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   815
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   816
    ^ self isFixedWidth
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   817
!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   818
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   819
pixelSize
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   820
    "return the height of the font in pixels -
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   821
     for st-80 compatibility"
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   822
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   823
    ^ self height
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   824
! !
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   825
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   826
!Font class methodsFor:'documentation'!
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   827
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   828
version
453
a1541566a972 added #userFriendlyName
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   829
    ^ '$Header: /cvs/stx/stx/libview/Font.st,v 1.34 1996-02-24 16:29:41 cg Exp $'
434
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   830
! !
d1697f2ff1ec care for wrong info returned by server (width < minWidth) and fix this
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   831
Font initialize!