FontDescription.st
author Claus Gittinger <cg@exept.de>
Tue, 17 Feb 2009 18:37:01 +0100
changeset 5166 a9cd84083df5
parent 5165 3b03bd5bb18e
child 5169 ad531e713603
permissions -rw-r--r--
preps for pixelSized fonts
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
"
3246
213e4771d6fb typo fixed
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
    12
"{ Package: 'stx:libview' }"
213e4771d6fb typo fixed
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
    13
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    14
Object subclass:#FontDescription
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    15
	instanceVariableNames:'family face style size encoding manufacturer name flags masks
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    16
		pixelSize'
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    17
	classVariableNames:'BoldnessMask FixedFlag ItalicFlag OutlineFlag SerifFlag
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
    18
		ShadowFlag StrikeoutFlag UnderlineFlag CharacterSetToFontMapping
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
    19
		CharacterEncodingToCharacterSetMapping'
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    20
	poolDictionaries:''
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    21
	category:'Graphics-Support'
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    22
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
    23
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    24
!FontDescription class methodsFor:'documentation'!
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    25
edf02eb2939c Initial revision
claus
parents:
diff changeset
    26
copyright
edf02eb2939c Initial revision
claus
parents:
diff changeset
    27
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    28
 COPYRIGHT (c) 1994 by Claus Gittinger
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
    29
	      All Rights Reserved
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    30
edf02eb2939c Initial revision
claus
parents:
diff changeset
    31
 This software is furnished under a license and may be used
edf02eb2939c Initial revision
claus
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
edf02eb2939c Initial revision
claus
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
edf02eb2939c Initial revision
claus
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
edf02eb2939c Initial revision
claus
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
edf02eb2939c Initial revision
claus
parents:
diff changeset
    36
 hereby transferred.
edf02eb2939c Initial revision
claus
parents:
diff changeset
    37
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    38
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
    39
edf02eb2939c Initial revision
claus
parents:
diff changeset
    40
documentation
edf02eb2939c Initial revision
claus
parents:
diff changeset
    41
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    42
    FontDescription is just a place-holder for scanned font names.
edf02eb2939c Initial revision
claus
parents:
diff changeset
    43
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    44
    [Instance variables:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    45
        family          <String>        the fonts family ('courier', 'helvetica' etc)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    46
        face            <String>        the fonts face ('bold', 'medium' etc)
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    47
        style           <String>        the fonts style ('roman', 'italic', 'oblique')
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    48
        size            <String>        the fonts size (not in pixels) 
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    49
        encoding        <Symbol>        the fonts encoding (usually #iso8859-1)
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    50
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    51
        manufacturer    <nil|String|Array>
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    52
                                        the fonts origin - if known
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    53
        name            <nil|String|Array>
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    54
                                        the platform specific name
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    55
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    56
        flags           <SmallInteger>  holds serif/italic etc. as flag bits
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    57
        masks           <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    58
        pixelSize       <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    59
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    60
    [class variables:]
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    61
        BoldnessMask                    currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    62
        FixedFlag                       currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    63
        ItalicFlag                      currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    64
        OutlineFlag                     currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    65
        SerifFlag                       currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    66
        ShadowFlag                      currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    67
        StrikeoutFlag                   currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    68
        UnderlineFlag                   currently dummy; to allow ST-80 compatible subclassing
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    69
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    70
    [author:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    71
        Claus Gittinger
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    72
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    73
    [see also:]
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    74
        Font
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    75
        FontPanel
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    76
        GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    77
        ( introduction to view programming :html: programming/viewintro.html#FONTS )
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    78
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    79
! !
edf02eb2939c Initial revision
claus
parents:
diff changeset
    80
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    81
!FontDescription class methodsFor:'initialization'!
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    82
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    83
initialize
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    84
    "initialize class variables"
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    85
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
    86
    BoldnessMask  := 2r0000000111.      "/ allows for 8 boldnesses to be encoded
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    87
    FixedFlag     := 2r0000001000.
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    88
    ItalicFlag    := 2r0000010000.
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    89
    OutlineFlag   := 2r0000100000.
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    90
    SerifFlag     := 2r0001000000.
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    91
    ShadowFlag    := 2r0010000000.
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    92
    StrikeoutFlag := 2r0100000000.
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    93
    UnderlineFlag := 2r1000000000.
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
    94
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
    95
    self initializeCharacterEncodingToCharacterSetMapping.
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
    96
    self initializeCharacterSetToFontMapping.
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
    97
!
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
    98
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
    99
initializeCharacterEncodingToCharacterSetMapping
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   100
    "character encoding"
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   101
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   102
    CharacterEncodingToCharacterSetMapping isNil ifTrue:[
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   103
        CharacterEncodingToCharacterSetMapping := Dictionary new
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   104
    ].
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   105
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   106
    #(
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   107
        'utf7'      'unicode'
4011
724145f3d343 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4010
diff changeset
   108
        'utf-7'     'unicode'
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   109
        'utf8'      'unicode'
4011
724145f3d343 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4010
diff changeset
   110
        'utf-8'     'unicode'
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   111
    ) pairWiseDo:[:encoding :fontEncoding|
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   112
         CharacterEncodingToCharacterSetMapping at:encoding put:fontEncoding
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   113
    ].
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   114
!
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   115
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   116
initializeCharacterSetToFontMapping
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   117
    "character sets"
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   118
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   119
    CharacterSetToFontMapping isNil ifTrue:[
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   120
        CharacterSetToFontMapping := Dictionary new
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   121
    ].
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   122
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   123
    #(
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   124
        'unicode'      'iso10646-*'
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   125
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   126
        'koi8-r'       'iso8859-5'
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   127
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   128
        'iso2022-jp'   'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   129
        'x-iso2022-jp' 'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   130
        'x-euc-jp'     'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   131
        'x-shift-jis'  'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   132
        'x-sjis'       'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   133
        'x-jis7'       'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   134
        'jis7'         'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   135
        'euc'          'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   136
        'euc-jp'       'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   137
        'sjis'         'jis*0208*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   138
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   139
        'big5'         'big5*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   140
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   141
        'gb2312'       'gb*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   142
        'hz-gb-2312'   'gb*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   143
        'x-gbk'        'gb*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   144
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   145
        'iso2022-kr'   'ksc*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   146
        'x-euc-kr'     'ksc*'
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   147
    ) pairWiseDo:[:charSet :fontEncoding|
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   148
         CharacterSetToFontMapping at:charSet put:fontEncoding
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   149
    ].
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
   150
! !
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
   151
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   152
!FontDescription class methodsFor:'instance creation'!
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   153
153
claus
parents: 109
diff changeset
   154
family:familyString
claus
parents: 109
diff changeset
   155
    "returns a font for given family and default (12pt) size 
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   156
     with default encoding.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   157
     The new fonts face defaults `medium', its style to `roman'.
153
claus
parents: 109
diff changeset
   158
     The returned font is not associated to a specific device"
claus
parents: 109
diff changeset
   159
claus
parents: 109
diff changeset
   160
    ^ self family:familyString
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   161
           face:(self defaultFace) 
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   162
           style:(self defaultStyle) 
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   163
           size:(self defaultSize) 
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   164
           encoding:(self defaultEncoding)
153
claus
parents: 109
diff changeset
   165
claus
parents: 109
diff changeset
   166
    "
claus
parents: 109
diff changeset
   167
     Font family:'helvetica'
claus
parents: 109
diff changeset
   168
     Font family:'courier'
claus
parents: 109
diff changeset
   169
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   170
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   171
    "Modified: 30.4.1996 / 17:20:44 / cg"
153
claus
parents: 109
diff changeset
   172
!
claus
parents: 109
diff changeset
   173
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   174
family:familyString face:faceString size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   175
    "returns a font for given family and size with default encoding.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   176
     The new fonts style defaults to `roman'.
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   177
     The returned font is not associated to a specific device"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   178
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   179
    ^ self family:familyString
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   180
           face:faceString 
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   181
           style:(self defaultStyle)
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   182
           size:sizeNum
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   183
           encoding:(self defaultEncoding)
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   184
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   185
    "
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   186
     Font family:'helvetica' face:'medium' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   187
     Font family:'helvetica' face:'bold' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   188
     Font family:'courier'   face:'bold' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   189
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   190
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   191
    "Modified: 30.4.1996 / 17:21:07 / cg"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   192
!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   193
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   194
family:familyString face:faceString style:styleString size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   195
    "returns a font for given family, face, style and size with default encoding. 
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   196
     The returned font is not associated to a specific device"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   197
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   198
    ^ self family:familyString
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   199
           face:faceString
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   200
           style:styleString
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   201
           size:sizeNum
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   202
           encoding:(self defaultEncoding)
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   203
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   204
    "
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   205
     Font family:'helvetica' face:'medium' style:'roman'  size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   206
     Font family:'helvetica' face:'medium' style:'italic' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   207
     Font family:'helvetica' face:'bold'   style:'roman'  size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   208
     Font family:'courier'   face:'bold'   style:'italic' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   209
    "
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   210
!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   211
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   212
family:familyString face:faceString style:styleString size:sizeNum encoding:encoding
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   213
    "returns a font for given family, face, style, size and the specified encoding. 
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   214
     The returned font is not associated to a specific device"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   215
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   216
    ^ self new
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   217
          family:familyString 
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   218
          face:faceString 
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   219
          style:styleString 
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   220
          size:sizeNum 
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   221
          encoding:encoding
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   222
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   223
    "Modified: 20.4.1996 / 23:19:04 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   224
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   225
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   226
family:familyString size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   227
    "returns a font for given family and size with default encoding.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   228
     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
   229
     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
   230
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   231
    ^ self family:familyString
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   232
           face:(self defaultFace)
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   233
           style:(self defaultStyle)
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   234
           size:sizeNum
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   235
           encoding:(self defaultEncoding)
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   236
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   237
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   238
     Font family:'helvetica' size:10
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   239
     Font family:'courier' size:10
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   240
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   241
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   242
    "Modified: 30.4.1996 / 17:21:40 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   243
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   244
4005
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   245
family:familyString size:sizeNum encoding:encoding
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   246
    "returns a font for given family and size with default encoding.
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   247
     The new fonts face defaults to `medium', its style to `roman'.
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   248
     The returned font is not associated to a specific device"
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   249
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   250
    ^ self family:familyString
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   251
           face:(self defaultFace)
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   252
           style:(self defaultStyle)
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   253
           size:sizeNum
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   254
           encoding:encoding
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   255
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   256
    "
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   257
     Font family:'helvetica' size:10 encoding:#'iso8859-1'
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   258
     Font family:'courier' size:10 encoding:#'iso8859-1'
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   259
    "
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   260
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   261
    "Modified: 30.4.1996 / 17:21:40 / cg"
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   262
!
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   263
1071
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   264
family:familyString style:aStyle size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   265
    "returns a font for given family and size with default encoding.
1071
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   266
     The new fonts face defaults to `medium', its style to `roman'.
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   267
     The returned font is not associated to a specific device"
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   268
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   269
    ^ self family:familyString
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   270
           face:(self defaultFace)
1071
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   271
           style:aStyle 
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   272
           size:sizeNum
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   273
           encoding:(self defaultEncoding)
1071
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   274
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   275
    "
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   276
     Font family:'helvetica' style:#roman size:48
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   277
     Font family:'courier' style:#roman size:10
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   278
    "
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   279
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   280
    "Modified: 30.4.1996 / 17:21:40 / cg"
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   281
    "Created: 8.10.1996 / 18:33:55 / cg"
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   282
!
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   283
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   284
name:aFontName
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   285
    "returns a font with the given explicit name.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   286
     WARNING:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   287
       You shuld not use explicit naming, since font names vary
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   288
       with operatingSystems, devices and architecture.
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   289
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   290
     This interface is provided for special purposes only.
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   291
     On X, the name given should be according the X fontname conventions;
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   292
     i.e. something like: '-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'.
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   293
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   294
     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
   295
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   296
    ^ self family:aFontName 
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   297
           face:nil
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   298
           style:nil
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   299
           size:nil 
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   300
           encoding:nil
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   301
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   302
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   303
     Font name:'-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   304
     Font name:'6x10'
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   305
     Font name:'k14'
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   306
     ((Font name:'k14') on:Display) encoding
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   307
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   308
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   309
    "Modified: 30.4.1996 / 17:23:09 / cg"
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   310
! !
edf02eb2939c Initial revision
claus
parents:
diff changeset
   311
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   312
!FontDescription class methodsFor:'defaults'!
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   313
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   314
defaultEncoding
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   315
    ^ #'iso8859-1'
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   316
!
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   317
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   318
defaultFace
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   319
    ^ 'medium'
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   320
!
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   321
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   322
defaultSize
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   323
    ^ 12
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   324
!
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   325
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   326
defaultStyle
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   327
    ^ 'roman' 
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   328
! !
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   329
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   330
!FontDescription class methodsFor:'queries'!
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   331
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   332
characterSetForCharacterEncoding:encodingName
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   333
    "return the font-encoding for a character encoding"
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   334
4018
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   335
    ^ CharacterEncodingToCharacterSetMapping at:encodingName ifAbsent:encodingName
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   336
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   337
    "
4018
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   338
     FontDescription characterSetForCharacterEncoding:'utf8'     
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   339
     FontDescription characterSetForCharacterEncoding:'koi8-r'     
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   340
     FontDescription characterSetForCharacterEncoding:'unicode'     
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   341
    "
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   342
!
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   343
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   344
fontNamePatternForCharset:aCharSetName
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   345
    "return the font-encoding for an iso-charset"
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   346
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   347
    ^ CharacterSetToFontMapping at:aCharSetName ifAbsent:nil
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   348
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   349
    "
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   350
     FontDescription fontNamePatternForCharset:'iso2022-jp'       
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   351
     FontDescription fontNamePatternForCharset:'euc-jp'     
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   352
    "
4010
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   353
!
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   354
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   355
preferredFontEncodingFor:fileEncoding
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   356
    "given a file encoding, return a corresponding match pattern for a preferred fontEncoding"
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   357
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   358
    |ce fe|
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   359
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   360
    ce := FontDescription characterSetForCharacterEncoding:fileEncoding.
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   361
    ce isNil ifTrue:[
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   362
        ce := fileEncoding.
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   363
    ].
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   364
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   365
    fe := FontDescription fontNamePatternForCharset:ce.
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   366
    fe notNil ifTrue:[^ fe].
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   367
    ^ ce ? 'iso8859*'
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   368
! !
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   369
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3827
diff changeset
   370
!FontDescription methodsFor:'Compatibility-ST80'!
1277
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
boldness:aNumber
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   373
    "added for ST-80 compatibility; actually ignored currently"
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
    |val|
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
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   378
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   379
    ].
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   380
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   381
    "/ scale from 0..1 to 0..BoldnessMask
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   382
    val := (aNumber max:0.0) min:1.0.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   383
    val := (BoldnessMask * val) rounded.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   384
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   385
    flags := flags bitOr:val.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   386
    masks := masks bitOr:BoldnessMask
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   387
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   388
    "Created: 25.1.1997 / 03:20:05 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   389
    "Modified: 25.1.1997 / 03:20:47 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   390
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   391
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   392
color:aColor
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   393
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   394
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   395
    "Created: 25.1.1997 / 03:21:28 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   396
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   397
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   398
encodings:aCollectionOfEncodings
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   399
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   400
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   401
    "Created: 20.6.1997 / 09:52:46 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   402
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   403
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   404
fixedWidth:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   405
    "added for ST-80 compatibility; actually ignored currently"
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
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   408
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   409
    ].
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   410
    flags := flags bitOr:FixedFlag.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   411
    masks := masks bitOr:FixedFlag
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   412
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   413
    "Created: 25.1.1997 / 03:14:06 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   414
    "Modified: 25.1.1997 / 03:21:03 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   415
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   416
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   417
italic:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   418
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   419
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   420
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   421
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   422
    ].
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   423
    flags := flags bitOr:ItalicFlag.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   424
    masks := masks bitOr:ItalicFlag
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   425
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   426
    "Created: 25.1.1997 / 03:15:37 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   427
    "Modified: 25.1.1997 / 03:20:55 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   428
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   429
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   430
outline:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   431
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   432
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   433
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   434
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   435
    ].
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   436
    flags := flags bitOr:OutlineFlag.
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   437
    masks := masks bitOr:OutlineFlag
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   438
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   439
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   440
    "Created: 20.6.1997 / 09:50:06 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   441
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   442
5165
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   443
pixelSize
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   444
    ^ pixelSize 
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   445
!
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   446
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   447
pixelSize:aNumber
5165
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   448
    "if specified as non-nil, the size is ignored, and a pixel-sized font is chosen."
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   449
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   450
    pixelSize := aNumber
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   451
!
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
serif:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   454
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   455
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   456
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   457
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   458
    ].
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   459
    flags := flags bitOr:SerifFlag.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   460
    masks := masks bitOr:SerifFlag
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   461
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   462
    "Created: 25.1.1997 / 03:15:17 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   463
    "Modified: 25.1.1997 / 03:20:59 / cg"
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   464
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   465
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   466
shadow:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   467
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   468
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   469
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   470
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   471
    ].
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   472
    flags := flags bitOr:ShadowFlag.
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   473
    masks := masks bitOr:ShadowFlag
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   474
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   475
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   476
    "Created: 20.6.1997 / 09:51:03 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   477
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   478
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   479
strikeout:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   480
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   481
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   482
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   483
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   484
    ].
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   485
    flags := flags bitOr:StrikeoutFlag.
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   486
    masks := masks bitOr:StrikeoutFlag
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   487
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   488
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   489
    "Created: 20.6.1997 / 09:51:36 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   490
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   491
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   492
underline:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   493
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   494
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   495
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   496
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   497
    ].
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   498
    flags := flags bitOr:UnderlineFlag.
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   499
    masks := masks bitOr:UnderlineFlag
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   500
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   501
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   502
    "Created: 20.6.1997 / 09:51:18 / cg"
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   503
! !
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   504
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   505
!FontDescription methodsFor:'accessing'!
edf02eb2939c Initial revision
claus
parents:
diff changeset
   506
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   507
device
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   508
    "return the device I am on"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   509
4146
4c46ae30bd64 Use #graphicsDevice
Stefan Vogel <sv@exept.de>
parents: 4018
diff changeset
   510
    <resource:#obsolete>
4c46ae30bd64 Use #graphicsDevice
Stefan Vogel <sv@exept.de>
parents: 4018
diff changeset
   511
3661
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   512
    self obsoleteMethodWarning:'use #graphicsDevice'.
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   513
    ^ self graphicsDevice
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   514
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   515
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   516
encoding
575
ad65411701b0 commentary
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   517
    "return the fonts encoding, as a symbol
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   518
     such as #'iso8859', #'jis0208.1983' or #ascii.
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   519
     If the fonts encoding is not known, return nil; 
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   520
     You should assume ascii-encoding then."
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   521
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   522
    ^ encoding
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   523
575
ad65411701b0 commentary
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   524
    "Modified: 20.4.1996 / 23:14:36 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   525
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   526
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   527
face
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   528
    "return the face, a string"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   529
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   530
    ^ face
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   531
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   532
4892
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   533
face:aString
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   534
    "set the face, a string such as 'bold'"
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   535
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   536
    self assert:(self fontId isNil). "/ cannot change an instanciated font
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   537
    face := aString
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   538
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   539
    "Created: 25.1.1997 / 03:12:12 / cg"
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   540
!
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   541
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   542
family
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   543
    "return the family, a string"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   544
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   545
    ^ family
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   546
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   547
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   548
family:aString
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   549
    "set the family, a string"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   550
4892
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   551
    self assert:(self fontId isNil). "/ cannot change an instanciated font
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   552
    family := aString
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   553
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   554
    "Created: 25.1.1997 / 03:12:12 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   555
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   556
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   557
family:familyString face:faceString style:styleString size:sizeNum encoding:encodingString
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   558
    "set the instance values"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   559
4892
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   560
    self assert:(self fontId isNil). "/ cannot change an instanciated font
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   561
    family := familyString asSymbol.
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   562
    (faceString notNil and:[faceString notEmpty]) ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   563
        face := faceString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   564
    ].
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   565
    (styleString notNil and:[styleString notEmpty]) ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   566
        style := styleString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   567
    ].
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   568
    size := sizeNum.
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   569
    (encodingString notNil and:[encodingString notEmpty]) ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   570
        encoding := encodingString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   571
    ]
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   572
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   573
    "Modified: 20.4.1996 / 23:19:25 / cg"
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   574
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
   575
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   576
fontId
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   577
    "return the device-dependent font-id"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   578
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   579
    ^ nil
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
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   582
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   583
3661
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   584
graphicsDevice
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   585
    "return the device I am on"
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   586
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   587
    ^ nil
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   588
!
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   589
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   590
manufacturer
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   591
    "return the value of the instance variable 'manufacturer' (automatically generated)"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   592
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   593
    ^ manufacturer
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   594
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   595
    "Created: 25.1.1997 / 03:12:43 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   596
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   597
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   598
manufacturer:something
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   599
    "set the value of the instance variable 'manufacturer' (automatically generated)"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   600
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   601
    manufacturer := something.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   602
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   603
    "Created: 25.1.1997 / 03:12:43 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   604
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   605
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   606
style
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   607
    "return the style, a string"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   608
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   609
    ^ style
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   610
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   611
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   612
!FontDescription methodsFor:'comparing'!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   613
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   614
= aFont
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   615
    "two fonts are considered equal, if the font-name components are;
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   616
     independent of the device, the font is on"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   617
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   618
    (aFont species == self species) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   619
	(size == aFont size) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   620
	    (family = aFont family) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   621
		(face = aFont face) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   622
		    (style = aFont style) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   623
			(encoding == aFont encoding) ifTrue:[
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   624
			    ^ true
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   625
			]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   626
		    ]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   627
		]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   628
	    ]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   629
	]
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   630
    ].
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   631
    ^ false
2160
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   632
!
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   633
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   634
hash
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   635
    "return a number for hashing - req'd since = is redefined."
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   636
2771
25c96682a2f3 really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
   637
    ^ ( (family hash bitAnd:16r1FFFFFFF)
25c96682a2f3 really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
   638
      + (face hash bitAnd:16r1FFFFFFF)
25c96682a2f3 really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
   639
      + (style hash bitAnd:16r1FFFFFFF)
3019
6dc6821c111c oops - care for fractional size in #hash
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
   640
      + (size ? 0) asInteger) bitAnd:16r3FFFFFFF
2160
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   641
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   642
    "Created: / 19.6.1998 / 04:19:06 / cg"
2164
2bd89f5166a9 oops - fixed #hash.
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
   643
    "Modified: / 20.6.1998 / 17:04:00 / cg"
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   644
!
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   645
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   646
sameDeviceFontAs:aFont
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   647
    (family = aFont family) ifFalse:[ ^ false ].
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   648
    (face = aFont face) ifFalse:[ ^ false ].
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   649
    ((style = aFont style) 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   650
    or:[ (style = 'italic' and:[aFont style = 'oblique'])
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   651
    or:[ style = 'oblique' and:[aFont style = 'italic']]]) ifFalse:[ ^ false ].
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   652
    (encoding isNil or:[encoding = aFont encoding]) ifFalse:[ ^ false ].
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   653
    ((pixelSize notNil and:[pixelSize == aFont pixelSize])
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   654
     or:[pixelSize isNil and:[ size = aFont size ]]) ifFalse:[ ^ false ].
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   655
    ^ true
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   656
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   657
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   658
!FontDescription methodsFor:'converting'!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   659
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   660
asBold
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   661
    "return the bold font corresponding to the receiver"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   662
4627
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   663
    family isNil ifTrue:[
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   664
        "CompoundFonts do not have a family"
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   665
        ^ self
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   666
    ].
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   667
    ^ (self class 
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   668
        family:family 
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   669
        face:'bold' 
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   670
        style:style 
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   671
        size:size 
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   672
        encoding:encoding) onDevice:self graphicsDevice.
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   673
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   674
    "Modified: / 27-09-2006 / 13:08:11 / cg"
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   675
!
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   676
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   677
asFace:face
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   678
    "return the bold font corresponding to the receiver"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   679
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   680
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   681
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   682
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   683
    ].
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   684
    ^ (self class 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   685
        family:family 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   686
        face:face 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   687
        style:style 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   688
        size:size 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   689
        encoding:encoding) onDevice:self graphicsDevice.
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   690
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   691
    "Modified: / 27-09-2006 / 13:08:11 / cg"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   692
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   693
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   694
asFamily:family
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   695
    "return another font corresponding to the receiver face, style and size but
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   696
     with another family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   697
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   698
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   699
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   700
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   701
    ].
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   702
    ^ (self class 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   703
        family:family 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   704
        face:face 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   705
        style:style 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   706
        size:size 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   707
        encoding:encoding) onDevice:self graphicsDevice.
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   708
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   709
4627
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   710
asItalic
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   711
    "return the italic font corresponding to the receiver"
4626
a763ec04e1f3 asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4532
diff changeset
   712
3254
984d6c2f0f79 asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
   713
    family isNil ifTrue:[
4526
62c606aabfb7 check for nil family in #asItalic
Stefan Vogel <sv@exept.de>
parents: 4298
diff changeset
   714
        "CompoundFonts do not have a family"
3254
984d6c2f0f79 asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
   715
        ^ self
984d6c2f0f79 asBold: care if not boldifyanle
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
   716
    ].
4627
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   717
    ^ (self class 
4526
62c606aabfb7 check for nil family in #asItalic
Stefan Vogel <sv@exept.de>
parents: 4298
diff changeset
   718
        family:family 
62c606aabfb7 check for nil family in #asItalic
Stefan Vogel <sv@exept.de>
parents: 4298
diff changeset
   719
        face:face 
62c606aabfb7 check for nil family in #asItalic
Stefan Vogel <sv@exept.de>
parents: 4298
diff changeset
   720
        style:'oblique' 
62c606aabfb7 check for nil family in #asItalic
Stefan Vogel <sv@exept.de>
parents: 4298
diff changeset
   721
        size:size 
4627
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   722
        encoding:encoding) onDevice:self graphicsDevice.
4626
a763ec04e1f3 asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4532
diff changeset
   723
4627
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
   724
    "Modified: / 27-09-2006 / 13:08:28 / cg"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   725
!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   726
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   727
asSize:size
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   728
    "return another font corresponding to the receivers family, face and style but
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   729
     with another size"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   730
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   731
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   732
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   733
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   734
    ].
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   735
    ^ (self class 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   736
        family:family 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   737
        face:face 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   738
        style:style 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   739
        size:size 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   740
        encoding:encoding) onDevice:self graphicsDevice.
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   741
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   742
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   743
asStyle:style
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   744
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   745
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   746
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   747
    ].
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   748
    ^ (self class 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   749
        family:family 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   750
        face:face 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   751
        style:style 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   752
        size:size 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   753
        encoding:encoding) onDevice:self graphicsDevice.
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   754
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   755
    "Modified: / 27-09-2006 / 13:08:11 / cg"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   756
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
   757
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   758
fromLiteralArrayEncoding:literalEncoding
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   759
    "read my contents from a aLiteralEncodedArray.
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   760
     Must match to what is generated in #literalArrayEncoding"
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   761
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   762
    family := literalEncoding at:2.
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   763
    face   := literalEncoding at:3.
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   764
    style  := literalEncoding at:4.
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   765
    size   := literalEncoding at:5.
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   766
    literalEncoding size > 5 ifTrue:[
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   767
        encoding := literalEncoding at:6
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   768
    ] ifFalse:[
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   769
        encoding := #'iso8859-1'
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   770
    ].
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   771
!
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   772
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   773
literalArrayEncoding
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   774
    "return myself encoded as a literal array.
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   775
     Must match to what is expected in #fromLiteralArrayEncoding:"
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   776
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   777
    |myName|
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   778
4532
81d5a57183bd Fix comments.
Stefan Vogel <sv@exept.de>
parents: 4526
diff changeset
   779
    myName := self class name.
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   780
    encoding == #'iso8859-1' ifTrue:[
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   781
        ^ Array
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   782
            with:myName
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   783
            with:family
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   784
            with:face
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   785
            with:style
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   786
            with:size
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   787
    ].
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   788
    ^ Array
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
   789
        with:myName
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   790
        with:family
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   791
        with:face
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   792
        with:style
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   793
        with:size
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
   794
        with:encoding
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   795
!
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
   796
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   797
on:aDevice
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   798
    "given the receiver, return a device Font"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   799
3623
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
   800
    "/ send out a warning: #on: is typically used to create views
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
   801
    "/ operating on a model.
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
   802
    "/ Please use #onDevice: to avoid confusion.
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
   803
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
   804
    <resource:#obsolete>
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
   805
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
   806
    self obsoleteMethodWarning:'use #onDevice:'.
3629
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
   807
    ^ self onDevice:aDevice.
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   808
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   809
1497
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   810
onDevice:aDevice
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   811
    "given the receiver, return a device Font"
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   812
2980
409e9547a45c ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
   813
    aDevice isNil ifTrue:[^ self].
3629
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
   814
    ^ (Font
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
   815
        family:family 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
   816
        face:face 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
   817
        style:style 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
   818
        size:size 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
   819
        encoding:encoding) onDevice:aDevice
1497
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   820
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   821
    "Created: 28.3.1997 / 16:09:30 / cg"
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   822
!
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
   823
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   824
size:newSize 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   825
    "return a font corresponding to the receiver, but with different size."
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   826
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   827
    ^ self class 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   828
	family:family 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   829
	face:face 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   830
	style:style 
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   831
	size:newSize
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   832
	encoding:encoding
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   833
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   834
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   835
!FontDescription methodsFor:'displaying'!
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
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aGC
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   838
    "display a partial string at some position in aGC.
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   839
     - display part of a string, drawing both fore- and background pixels"
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   840
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   841
    self displayString:aString from:index1 to:index2 x:x y:y in:aGC opaque:true
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   842
!
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
displayOpaqueString:aString x:x y:y in:aGC
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   845
    "display a string at some position in aGC."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   846
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   847
    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
   848
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   849
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   850
displayString:aString from:index1 to:index2 x:x y:y in:aGC
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   851
    "display a partial string at some position in aGC."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   852
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   853
    self displayString:aString from:index1 to:index2 x:x y:y in:aGC opaque:false
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   854
!
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   855
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   856
displayString:aString from:index1 to:index2 x:x y:y in:aGC opaque:opaque
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   857
    "display a partial string at some position in aGC."
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
   858
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   859
    self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   860
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   861
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   862
displayString:aString x:x y:y in:aGC
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   863
    "display a string at some position in aGC."
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
    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
   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
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   869
!FontDescription methodsFor:'errors'!
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   870
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   871
errorNoDevice
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   872
    "a query was made for device-specific info"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   873
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   874
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   875
     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
   876
     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
   877
     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
   878
     associated to a device.
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   879
     You should always use 
3159
3b040b0e4ae4 Fix error string 'for for'
Stefan Vogel <sv@exept.de>
parents: 3144
diff changeset
   880
        font := font on:someDevice
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   881
     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
   882
    "
3159
3b040b0e4ae4 Fix error string 'for for'
Stefan Vogel <sv@exept.de>
parents: 3144
diff changeset
   883
    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
   884
3b040b0e4ae4 Fix error string 'for for'
Stefan Vogel <sv@exept.de>
parents: 3144
diff changeset
   885
    "Modified: / 27.1.2000 / 16:55:05 / stefan"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   886
! !
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   887
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   888
!FontDescription methodsFor:'getting a device font'!
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   889
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   890
onDevice:aDevice ifAbsent:exceptionBlock 
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   891
    "create a new Font representing the same font as
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   892
     myself on aDevice. This does NOT try to look for existing
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   893
     or replacement fonts (i.e. can be used to get physical fonts)."
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   894
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   895
    |newFont id|
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   896
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   897
    "ask that device for the font"
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   898
    id := aDevice 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   899
            getFontWithFamily:family 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   900
            face:face 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   901
            style:style 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   902
            size:size 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   903
            pixelSize:pixelSize
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   904
            encoding:encoding.
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   905
    id isNil ifTrue:[
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   906
        "oops did not work - (device has no such font)"
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   907
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   908
        ^ exceptionBlock value
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   909
    ].
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   910
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   911
    newFont := (Font basicNew) 
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   912
                        setFamily:family 
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   913
                        face:face
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   914
                        style:style
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   915
                        size:size
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   916
                        pixelSize:pixelSize
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   917
                        encoding:encoding
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   918
                        device:aDevice.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   919
    newFont setFontId:id.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   920
    newFont getFontInfos.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   921
    aDevice registerFont:newFont.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   922
    ^ newFont
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   923
! !
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   924
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   925
!FontDescription methodsFor:'printing & storing'!
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   926
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
   927
printOn:aStream
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
   928
    "append a user-friendly representation of the receiver to aStream"
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
   929
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
   930
    aStream nextPutAll:self userFriendlyName
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
   931
!
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
   932
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   933
userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   934
    "return a user-friendly printed representation of the receiver"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   935
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   936
    |nm|
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   937
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   938
    nm := family.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   939
    face notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   940
        nm := nm , '-', face.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   941
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   942
    style notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   943
        nm := nm , '-', style.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   944
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   945
    size notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   946
        nm := nm , '-', size printString.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   947
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   948
    encoding notNil ifTrue:[
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
   949
        nm := nm , '(', encoding , ')'.
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   950
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   951
    ^ nm
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   952
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   953
    "
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   954
     View defaultFont userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   955
     Button defaultFont userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   956
    "
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   957
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   958
    "Modified: 20.4.1996 / 23:25:36 / cg"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   959
    "Created: 19.4.1997 / 18:09:25 / cg"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   960
! !
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
   961
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   962
!FontDescription methodsFor:'queries'!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   963
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   964
bold
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   965
    "return true, if the receiver is a bold font -
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   966
     Added for st-80 compatibility."
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   967
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   968
    "/ 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
   969
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   970
    ^ face = 'bold'
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   971
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   972
    "Modified: 11.4.1997 / 21:31:25 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   973
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   974
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   975
boldness
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   976
    "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
   977
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   978
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   979
    "/ 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
   980
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   981
    face = 'roman' ifTrue:[^ 0.5].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   982
    face = 'normal' ifTrue:[^ 0.5].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   983
    face = 'bold' ifTrue:[^ 0.75].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   984
    face = 'light' ifTrue:[^ 0.25].
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   985
    ^ 0.5
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   986
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   987
    "Modified: 11.4.1997 / 21:31:31 / cg"
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   988
!
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   989
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   990
color
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   991
    "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
   992
     Added for st-80 compatibility.
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   993
     For now always black."
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   994
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   995
    ^ Color black
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   996
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   997
    "Created: 25.1.1997 / 02:59:15 / cg"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   998
    "Modified: 25.1.1997 / 03:02:14 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   999
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1000
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1001
existsOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1002
    "return true, if the recevier is available on aDevice;
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1003
     false otherwise. This is a kludge method; its better to
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1004
     ask a device for its available fonts and use this info ...
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1005
     Notice, that if you simply use a font by name, the system
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1006
     will automatically take a replacement font."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1007
3629
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1008
    ^ ((Font
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1009
        family:family 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1010
        face:face 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1011
        style:style 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1012
        size:size 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1013
        encoding:encoding) onDevice:aDevice ifAbsent:nil) notNil
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1014
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1015
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1016
fullName
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1017
    ^ nil
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1018
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1019
    "Created: 23.2.1996 / 00:45:45 / cg"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1020
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1021
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1022
italic
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1023
    "return true if this is an italic font -
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1024
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1025
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1026
    "/ 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
  1027
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1028
    style = 'italic' ifTrue:[^ true].
3246
213e4771d6fb typo fixed
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
  1029
    style = 'oblique' ifTrue:[^ true].
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1030
    ^ false
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1031
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1032
    "Modified: 11.4.1997 / 21:31:42 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1033
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1034
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1035
serif
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1036
    "return true, if this font has serifs.
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1037
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1038
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1039
    "/ 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
  1040
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1041
    family = 'Times' ifTrue:[^ true].
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1042
    family = 'times' ifTrue:[^ true].
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1043
    ^ false.
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1044
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1045
    "Modified: 11.4.1997 / 21:31:51 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1046
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1047
3265
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1048
size
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1049
    "return the size, a number"
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1050
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1051
    ^ size
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1052
!
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1053
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1054
species
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1055
    ^ Font
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1056
!
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1057
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1058
underline
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1059
    "return true if this is an underlined font -
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1060
     Added for st-80 compatibility
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1061
     (always false here)"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1062
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1063
    ^ false
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1064
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1065
    "Created: 25.1.1997 / 02:58:30 / cg"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1066
    "Modified: 25.1.1997 / 03:01:12 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1067
! !
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1068
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1069
!FontDescription methodsFor:'queries-dimensions'!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1070
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1071
ascent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1072
    "return the ascent - the number of pixels above the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1073
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1074
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1075
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1076
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1077
ascentOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1078
    "return the ascent - the number of pixels above the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1079
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1080
    ^ (self onDevice:aDevice) ascent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1081
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1082
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1083
descent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1084
    "return the descent - the number of pixels below the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1085
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1086
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1087
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1088
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1089
descentOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1090
    "return the ascent - the number of pixels above the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1091
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1092
    ^ (self onDevice:aDevice) descent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1093
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1094
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1095
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1096
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1097
height
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1098
    "return the height - the number of pixels above plus below the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1099
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1100
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1101
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1102
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1103
heightOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1104
    "return the height of the given string.
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1105
     Here, assume the characters are of constant height"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1106
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1107
    ^ self height
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1108
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1109
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1110
heightOf:aString on:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1111
    "return the height of the given string on the given device."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1112
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1113
    ^ (self onDevice:aDevice) heightOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1114
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1115
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1116
heightOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1117
    "return the height - the number of pixels above PLUS below the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1118
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1119
    ^ (self onDevice:aDevice) height
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1120
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1121
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1122
isFixedWidth
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1123
    "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
  1124
     are of the same width)"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1125
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1126
    self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1127
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1128
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1129
maxAscent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1130
    "return the fonts maximum-ascent (i.e. the maximum of all characters);
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1131
     That is the number of units (usually pixels) above the baseline."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1132
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1133
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1134
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1135
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1136
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1137
maxDescent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1138
    "return the fonts maximum-descent (i.e. the maximum of all characters);
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1139
     That is the number of units (usually pixels) below the baseline."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1140
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1141
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1142
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1143
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1144
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1145
maxHeight
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1146
    "return the fonts characters maximum height;
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1147
     That is the number of units (usually pixels)."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1148
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1149
    ^ self maxAscent + self maxDescent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1150
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1151
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1152
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1153
maxWidth
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1154
    "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
  1155
     That is a number of units (usually pixels)."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1156
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1157
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1158
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1159
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1160
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1161
width
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1162
    "return the fonts characters width;
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1163
     That is a number of units (usually pixels).
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1164
     For variable pitch fonts, the width of the space character is returned.
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1165
     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
  1166
     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
  1167
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1168
    ^ self widthOf:' '
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1169
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1170
    "Modified: 30.4.1996 / 16:43:45 / cg"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1171
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1172
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1173
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1174
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1175
widthOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1176
    "return the width of a string"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1177
3667
53ebf11c6dd9 widthOf fixed for Text-item
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1178
    ^ self widthOf:aString string from:1 to:aString size
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1179
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1180
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1181
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1182
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1183
widthOf:aString from:start to:stop
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1184
    "return the width of a sub string"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1185
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1186
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1187
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1188
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1189
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1190
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1191
widthOf:aString from:start to:stop on:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1192
    "return the width of a sub string.
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1193
     Here, assume that this fonts width is device independent."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1194
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1195
    ^ (self onDevice:aDevice) widthOf:aString from:start to:stop
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1196
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1197
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1198
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1199
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1200
widthOf:aString on:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1201
    "return the width of a string"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1202
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1203
    ^ (self onDevice:aDevice) widthOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1204
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1205
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1206
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1207
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1208
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1209
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1210
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1211
widthOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1212
    "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
  1213
     (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
  1214
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1215
    ^ (self onDevice:aDevice) width
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1216
! !
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1217
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1218
!FontDescription methodsFor:'queries-encoding'!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1219
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1220
isASCII
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1221
    "return true, if the receivers encoding is
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1222
     compatible with ascii (i.e. its ascii or iso8859)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1223
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1224
    ^ (encoding == #iso8859) or:[encoding == #ascii]
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1225
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1226
    "Created: 24.2.1996 / 22:47:30 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1227
    "Modified: 20.4.1996 / 23:20:01 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1228
!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1229
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1230
isISO8859
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1231
    "return true, if the receivers encoding is
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1232
     compatible with iso8859 (i.e. iso8859)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1233
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1234
    ^ encoding == #iso8859
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1235
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1236
    "Created: 24.2.1996 / 22:47:12 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1237
    "Modified: 20.4.1996 / 23:20:13 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1238
!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1239
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1240
isJIS
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1241
    "return true, if the receivers encoding is
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1242
     compatible with jis (i.e. jisXXX)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1243
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1244
    ^ (encoding startsWith:'jis')
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1245
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1246
    "Created: 24.2.1996 / 22:47:47 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1247
    "Modified: 20.4.1996 / 23:20:30 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1248
! !
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1249
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1250
!FontDescription class methodsFor:'documentation'!
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1251
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1252
version
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
  1253
    ^ '$Header: /cvs/stx/stx/libview/FontDescription.st,v 1.66 2009-02-17 17:37:01 cg Exp $'
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1254
! !
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1255
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1256
FontDescription initialize!