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