FontDescription.st
author ca
Wed, 04 Jun 1997 13:16:58 +0200
changeset 1740 804c5b51ec29
parent 1618 044de84f0d5f
child 1760 ccd221469891
permissions -rw-r--r--
fromLiteralArrayEncoding: literalArrayEncoding added
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
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   237
!FontDescription methodsFor:'ST-80 compatibility'!
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
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   265
fixedWidth:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   266
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   267
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   268
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   269
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   270
    ].
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   271
    flags := flags bitOr:FixedFlag.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   272
    masks := masks bitOr:FixedFlag
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
    "Created: 25.1.1997 / 03:14:06 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   275
    "Modified: 25.1.1997 / 03:21:03 / cg"
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
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   278
italic:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   279
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   280
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   281
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   282
        flags := masks := 0
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
    flags := flags bitOr:ItalicFlag.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   285
    masks := masks bitOr:ItalicFlag
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
    "Created: 25.1.1997 / 03:15:37 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   288
    "Modified: 25.1.1997 / 03:20:55 / cg"
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
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   291
pixelSize:aNumber
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   292
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   293
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   294
    pixelSize := aNumber
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
    "Modified: 25.1.1997 / 03:20:47 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   297
    "Created: 25.1.1997 / 03:21:47 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   298
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   299
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   300
serif:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   301
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   302
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   303
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   304
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   305
    ].
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   306
    flags := flags bitOr:SerifFlag.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   307
    masks := masks bitOr:SerifFlag
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   308
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   309
    "Created: 25.1.1997 / 03:15:17 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   310
    "Modified: 25.1.1997 / 03:20:59 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   311
! !
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   312
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   313
!FontDescription methodsFor:'accessing'!
edf02eb2939c Initial revision
claus
parents:
diff changeset
   314
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   315
encoding
575
ad65411701b0 commentary
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   316
    "return the fonts encoding, as a symbol
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   317
     such as #'iso8859', #'jis0208.1983' or #ascii.
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   318
     If the fonts encoding is not known, return nil; 
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   319
     You should assume ascii-encoding then."
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   320
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   321
    ^ encoding
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   322
575
ad65411701b0 commentary
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   323
    "Modified: 20.4.1996 / 23:14:36 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   324
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   325
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   326
face
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   327
    "return the face, a string"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   328
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   329
    ^ face
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   330
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   331
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   332
family
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   333
    "return the family, a string"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   334
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   335
    ^ family
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   336
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   337
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   338
family:aString
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   339
    "set the family, a string"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   340
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   341
    family := aString
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   342
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   343
    "Created: 25.1.1997 / 03:12:12 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   344
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   345
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   346
family:familyString face:faceString style:styleString size:sizeNum encoding:encodingString
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   347
    "set the instance values"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   348
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   349
    family := familyString asSymbol.
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   350
    (faceString notNil and:[faceString notEmpty]) ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   351
        face := faceString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   352
    ].
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   353
    (styleString notNil and:[styleString notEmpty]) ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   354
        style := styleString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   355
    ].
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   356
    size := sizeNum.
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   357
    (encodingString notNil and:[encodingString notEmpty]) ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   358
        encoding := encodingString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   359
    ]
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   360
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   361
    "Modified: 20.4.1996 / 23:19:25 / cg"
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   362
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
   363
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   364
manufacturer
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   365
    "return the value of the instance variable 'manufacturer' (automatically generated)"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   366
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   367
    ^ manufacturer
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   368
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   369
    "Created: 25.1.1997 / 03:12:43 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   370
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   371
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   372
manufacturer:something
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   373
    "set the value of the instance variable 'manufacturer' (automatically generated)"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   374
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   375
    manufacturer := something.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   376
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   377
    "Created: 25.1.1997 / 03:12:43 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   378
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   379
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   380
size
edf02eb2939c Initial revision
claus
parents:
diff changeset
   381
    "return the size, a number"
edf02eb2939c Initial revision
claus
parents:
diff changeset
   382
edf02eb2939c Initial revision
claus
parents:
diff changeset
   383
    ^ size
edf02eb2939c Initial revision
claus
parents:
diff changeset
   384
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
   385
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   386
style
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   387
    "return the style, a string"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   388
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   389
    ^ style
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   390
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   391
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   392
!FontDescription methodsFor:'comparing'!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   393
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   394
= aFont
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   395
    "two fonts are considered equal, if the font-name components are;
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   396
     independent of the device, the font is on"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   397
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   398
    (aFont species == self species) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   399
	(size == aFont size) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   400
	    (family = aFont family) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   401
		(face = aFont face) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   402
		    (style = aFont style) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   403
			(encoding == aFont encoding) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   404
			    ^ true
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   405
			]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   406
		    ]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   407
		]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   408
	    ]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   409
	]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   410
    ].
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   411
    ^ false
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   412
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   413
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   414
!FontDescription methodsFor:'converting'!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   415
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   416
asBold
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   417
    "return the bold font corresponding to the receiver"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   418
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   419
    ^ self class 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   420
	family:family 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   421
	face:'bold' 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   422
	style:style 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   423
	size:size 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   424
	encoding:encoding
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   425
!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   426
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   427
asItalic
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   428
    "return the italic font corresponding to the receiver"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   429
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   430
    ^ self class 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   431
	family:family 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   432
	face:face 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   433
	style:'oblique' 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   434
	size:size 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   435
	encoding:encoding
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   436
!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   437
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   438
fromLiteralArrayEncoding:encoding
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   439
    "read my contents from a aLiteralEncodedArray"
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   440
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   441
    |items groups values|
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   442
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   443
    family := encoding at:2.
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   444
    face   := encoding at:3.
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   445
    style  := encoding at:4.
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   446
    size   := encoding at:5.
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   447
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   448
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   449
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   450
!
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   451
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   452
literalArrayEncoding
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   453
    "return myself encoded as a literal array"
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   454
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   455
    ^ Array
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   456
        with:self class name asSymbol
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   457
        with:family
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   458
        with:face
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   459
        with:style
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   460
        with:size
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   461
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   462
!
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   463
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   464
on:aDevice
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   465
    "given the receiver, return a device Font"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   466
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   467
    ^ (Font
478
91a8a5889bf2 oops - always returned a bold font
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
   468
        family:family 
91a8a5889bf2 oops - always returned a bold font
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
   469
        face:face 
91a8a5889bf2 oops - always returned a bold font
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
   470
        style:style 
91a8a5889bf2 oops - always returned a bold font
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
   471
        size:size 
91a8a5889bf2 oops - always returned a bold font
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
   472
        encoding:encoding) on:aDevice
91a8a5889bf2 oops - always returned a bold font
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
   473
91a8a5889bf2 oops - always returned a bold font
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
   474
    "Modified: 29.2.1996 / 04:45:11 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   475
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   476
1497
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   477
onDevice:aDevice
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   478
    "given the receiver, return a device Font"
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   479
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   480
    ^ self on:aDevice
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   481
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   482
    "Created: 28.3.1997 / 16:09:30 / cg"
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   483
!
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   484
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   485
size:newSize 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   486
    "return a font corresponding to the receiver, but with different size."
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   487
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   488
    ^ self class 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   489
	family:family 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   490
	face:face 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   491
	style:style 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   492
	size:newSize
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   493
	encoding:encoding
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   494
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   495
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   496
!FontDescription methodsFor:'errors'!
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   497
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   498
errorNoDevice
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   499
    "a query was made for device-specific info"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   500
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   501
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   502
     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
   503
     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
   504
     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
   505
     associated to a device.
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   506
     You should always use 
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   507
	font := font on:someDevice
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   508
     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
   509
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   510
    self error:'query device independent font for for device specific info'
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   511
! !
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   512
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   513
!FontDescription methodsFor:'printing & storing'!
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   514
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   515
userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   516
    "return a user-friendly printed representation of the receiver"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   517
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   518
    |nm|
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   519
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   520
    nm := family.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   521
    face notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   522
        nm := nm , '-', face.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   523
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   524
    style notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   525
        nm := nm , '-', style.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   526
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   527
    size notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   528
        nm := nm , '-', size printString.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   529
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   530
    encoding notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   531
        nm := nm , '-', encoding .
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   532
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   533
    ^ nm
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   534
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   535
    "
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   536
     View defaultFont userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   537
     Button defaultFont userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   538
    "
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   539
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   540
    "Modified: 20.4.1996 / 23:25:36 / cg"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   541
    "Created: 19.4.1997 / 18:09:25 / cg"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   542
! !
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   543
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   544
!FontDescription methodsFor:'queries'!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   545
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   546
bold
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   547
    "return true, if the receiver is a bold font -
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   548
     Added for st-80 compatibility."
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   549
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   550
    "/ 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
   551
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   552
    ^ face = 'bold'
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   553
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   554
    "Modified: 11.4.1997 / 21:31:25 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   555
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   556
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   557
boldness
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   558
    "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
   559
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   560
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   561
    "/ 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
   562
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   563
    face = 'roman' ifTrue:[^ 0.5].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   564
    face = 'normal' ifTrue:[^ 0.5].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   565
    face = 'bold' ifTrue:[^ 0.75].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   566
    face = 'light' ifTrue:[^ 0.25].
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   567
    ^ 0.5
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   568
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   569
    "Modified: 11.4.1997 / 21:31:31 / cg"
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   570
!
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   571
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   572
color
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   573
    "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
   574
     Added for st-80 compatibility.
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   575
     For now always black."
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   576
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   577
    ^ Color black
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   578
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   579
    "Created: 25.1.1997 / 02:59:15 / cg"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   580
    "Modified: 25.1.1997 / 03:02:14 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   581
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   582
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   583
fullName
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   584
    ^ nil
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   585
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   586
    "Created: 23.2.1996 / 00:45:45 / cg"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   587
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   588
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   589
italic
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   590
    "return true if this is an italic font -
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   591
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   592
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   593
    "/ 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
   594
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   595
    style = 'italic' ifTrue:[^ true].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   596
    style = 'obligue' ifTrue:[^ true].
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   597
    ^ false
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   598
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   599
    "Modified: 11.4.1997 / 21:31:42 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   600
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   601
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   602
serif
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   603
    "return true, if this font has serifs.
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   604
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   605
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   606
    "/ 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
   607
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   608
    family = 'Times' ifTrue:[^ true].
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   609
    family = 'times' ifTrue:[^ true].
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   610
    ^ false.
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   611
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   612
    "Modified: 11.4.1997 / 21:31:51 / cg"
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
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   615
species
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   616
    ^ Font
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   617
!
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   618
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   619
underline
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   620
    "return true if this is an underlined font -
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   621
     Added for st-80 compatibility
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   622
     (always false here)"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   623
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   624
    ^ false
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   625
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   626
    "Created: 25.1.1997 / 02:58:30 / cg"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   627
    "Modified: 25.1.1997 / 03:01:12 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   628
! !
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   629
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   630
!FontDescription methodsFor:'queries-encoding'!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   631
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   632
isASCII
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   633
    "return true, if the receivers encoding is
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   634
     compatible with ascii (i.e. its ascii or iso8859)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   635
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   636
    ^ (encoding == #iso8859) or:[encoding == #ascii]
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   637
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   638
    "Created: 24.2.1996 / 22:47:30 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   639
    "Modified: 20.4.1996 / 23:20:01 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   640
!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   641
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   642
isISO8859
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   643
    "return true, if the receivers encoding is
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   644
     compatible with iso8859 (i.e. iso8859)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   645
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   646
    ^ encoding == #iso8859
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   647
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   648
    "Created: 24.2.1996 / 22:47:12 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   649
    "Modified: 20.4.1996 / 23:20:13 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   650
!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   651
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   652
isJIS
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   653
    "return true, if the receivers encoding is
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   654
     compatible with jis (i.e. jisXXX)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   655
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   656
    ^ (encoding startsWith:'jis')
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   657
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   658
    "Created: 24.2.1996 / 22:47:47 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   659
    "Modified: 20.4.1996 / 23:20:30 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   660
! !
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   661
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   662
!FontDescription class methodsFor:'documentation'!
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   663
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   664
version
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   665
    ^ '$Header: /cvs/stx/stx/libview/FontDescription.st,v 1.22 1997-06-04 11:16:58 ca Exp $'
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   666
! !
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   667
FontDescription initialize!