FontDescription.st
author matilk
Wed, 13 Sep 2017 09:40:34 +0200
changeset 8174 2704c965b97b
parent 8071 4b9d1e67dfa2
child 8377 c9b6d993484f
permissions -rw-r--r--
#BUGFIX by Maren class: DeviceGraphicsContext changed: #displayDeviceOpaqueForm:x:y: nil check
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
6723
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
    14
"{ NameSpace: Smalltalk }"
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
    15
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    16
Object subclass:#FontDescription
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    17
	instanceVariableNames:'family face style size encoding manufacturer name flags masks
6824
915782c7f935 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6723
diff changeset
    18
		sizeUnit pixelSize weight slant'
7623
aa70617876bb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7609
diff changeset
    19
	classVariableNames:'AntialiasedFlag BoldnessMask
aa70617876bb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7609
diff changeset
    20
		CharacterEncodingToCharacterSetMapping CharacterSetToFontMapping
aa70617876bb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7609
diff changeset
    21
		DecorativeFlag DefaultEncoding FixedFlag GenericFlag GenericFonts
aa70617876bb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7609
diff changeset
    22
		IsTrueTypeFlag ItalicFlag OutlineFlag OverlappingCharactersFlag
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    23
		ScalableFlag SerifFlag ShadowFlag StrikeoutFlag UnderlineFlag
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    24
		ForceNonXFTFlag'
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    25
	poolDictionaries:''
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    26
	category:'Graphics-Support'
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    27
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
    28
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
    29
!FontDescription class methodsFor:'documentation'!
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    30
edf02eb2939c Initial revision
claus
parents:
diff changeset
    31
copyright
edf02eb2939c Initial revision
claus
parents:
diff changeset
    32
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    33
 COPYRIGHT (c) 1994 by Claus Gittinger
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
    34
	      All Rights Reserved
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    35
edf02eb2939c Initial revision
claus
parents:
diff changeset
    36
 This software is furnished under a license and may be used
edf02eb2939c Initial revision
claus
parents:
diff changeset
    37
 only in accordance with the terms of that license and with the
edf02eb2939c Initial revision
claus
parents:
diff changeset
    38
 inclusion of the above copyright notice.   This software may not
edf02eb2939c Initial revision
claus
parents:
diff changeset
    39
 be provided or otherwise made available to, or used by, any
edf02eb2939c Initial revision
claus
parents:
diff changeset
    40
 other person.  No title to or ownership of the software is
edf02eb2939c Initial revision
claus
parents:
diff changeset
    41
 hereby transferred.
edf02eb2939c Initial revision
claus
parents:
diff changeset
    42
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    43
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
    44
edf02eb2939c Initial revision
claus
parents:
diff changeset
    45
documentation
edf02eb2939c Initial revision
claus
parents:
diff changeset
    46
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    47
    FontDescription is just a place-holder for scanned font names.
edf02eb2939c Initial revision
claus
parents:
diff changeset
    48
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    49
    [Instance variables:]
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
    50
        family          <String>        the font's family ('courier', 'helvetica' etc)
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
    51
        face            <String>        the font's face ('bold', 'medium' etc)
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
    52
        style           <String>        the font's style ('roman', 'italic', 'oblique')
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
    53
        size            <String>        the font's size (by default, in points, not in pixels; but see sizeUnit) 
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
    54
        encoding        <Symbol>        the font's encoding (usually #iso8859-1)
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    55
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    56
        manufacturer    <nil|String|Array>
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
    57
                                        the font's origin - if known
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    58
        name            <nil|String|Array>
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    59
                                        the platform specific name
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    60
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    61
        flags           <SmallInteger>  holds serif/italic etc. as flag bits
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    62
        masks           <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    63
        pixelSize       <SmallInteger>  currently dummy; to allow ST-80 compatible subclassing
6825
4fcdfee4604c class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6824
diff changeset
    64
        sizeUnit        <Symbol>        #px or #pt; defines what size is measuring
4fcdfee4604c class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6824
diff changeset
    65
        weight          <SmallInteger>  for real fonts, which support it
4fcdfee4604c class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6824
diff changeset
    66
        slant           <SmallInteger>  for real fonts, which support it
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    67
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    68
    [class variables:]
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    69
        BoldnessMask                    currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    70
        FixedFlag                       currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    71
        ItalicFlag                      currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    72
        OutlineFlag                     currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    73
        SerifFlag                       currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    74
        ShadowFlag                      currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    75
        StrikeoutFlag                   currently dummy; to allow ST-80 compatible subclassing
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
    76
        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
    77
611
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    78
    [author:]
e0442439a3c6 documentation
Claus Gittinger <cg@exept.de>
parents: 576
diff changeset
    79
        Claus Gittinger
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    80
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    81
    [see also:]
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    82
        Font
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    83
        FontPanel
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    84
        GraphicsContext
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
    85
        ( introduction to view programming :html: programming/viewintro.html#FONTS )
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
    86
"
edf02eb2939c Initial revision
claus
parents:
diff changeset
    87
! !
edf02eb2939c Initial revision
claus
parents:
diff changeset
    88
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    89
!FontDescription class methodsFor:'initialization'!
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    90
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    91
initialize
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    92
    "initialize class variables"
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
    93
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    94
    BoldnessMask              := 2r00000000000000000000111.      "/ allows for 8 boldnesses to be encoded
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    95
    FixedFlag                 := 2r00000000000000000001000.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    96
    ItalicFlag                := 2r00000000000000000010000.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    97
    OutlineFlag               := 2r00000000000000000100000.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    98
    SerifFlag                 := 2r00000000000000001000000.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
    99
    ShadowFlag                := 2r00000000000000010000000.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   100
    StrikeoutFlag             := 2r00000000000000100000000.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   101
    UnderlineFlag             := 2r00000000000001000000000.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   102
    GenericFlag               := 2r00000000000010000000000.      "/ This is a pseudo font
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   103
    OverlappingCharactersFlag := 2r00000000000100000000000.      "/ special for windows
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   104
    AntialiasedFlag           := 2r00000000001000000000000.      "/ added for Xft
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   105
    ScalableFlag              := 2r00000000010000000000000.      "/ added for Xft
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   106
    DecorativeFlag            := 2r00000000100000000000000.      "/ added for Xft
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   107
    ForceNonXFTFlag           := 2r10000000000000000000000.      "/ added for Xft
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   108
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   109
    self initializeGenericFonts.
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   110
    self initializeCharacterEncodingToCharacterSetMapping.
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   111
    self initializeCharacterSetToFontMapping.
5644
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   112
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   113
    "Modified: / 12-02-2017 / 22:01:28 / cg"
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   114
!
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   115
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   116
initializeCharacterEncodingToCharacterSetMapping
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   117
    "character encoding"
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   118
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   119
    CharacterEncodingToCharacterSetMapping isNil ifTrue:[
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   120
        CharacterEncodingToCharacterSetMapping := Dictionary withKeysAndValues:#(
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   121
            utf7        unicode
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   122
            #'utf-7'    unicode
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   123
            utf8        unicode
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   124
            #'utf-8'    unicode
5916
ceb0f5faf565 changed:
Stefan Vogel <sv@exept.de>
parents: 5906
diff changeset
   125
            #utf16be    unicode
ceb0f5faf565 changed:
Stefan Vogel <sv@exept.de>
parents: 5906
diff changeset
   126
            #utf16le    unicode
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   127
        ).
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   128
    ].
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   129
!
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   130
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   131
initializeCharacterSetToFontMapping
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   132
    "character sets"
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   133
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   134
    CharacterSetToFontMapping isNil ifTrue:[
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   135
        CharacterSetToFontMapping := Dictionary withKeysAndValues: #(
5916
ceb0f5faf565 changed:
Stefan Vogel <sv@exept.de>
parents: 5906
diff changeset
   136
            unicode        'iso10646-1'
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   137
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   138
            'koi8-r'       'iso8859-5'
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   139
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   140
            'iso2022-jp'   'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   141
            'x-iso2022-jp' 'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   142
            'x-euc-jp'     'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   143
            'x-shift-jis'  'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   144
            'x-sjis'       'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   145
            'x-jis7'       'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   146
            'jis7'         'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   147
            'euc'          'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   148
            'euc-jp'       'jis*0208*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   149
            'sjis'         'jis*0208*'
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   150
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   151
            'big5'         'big5*'
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   152
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   153
            'gb2312'       'gb*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   154
            'hz-gb-2312'   'gb*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   155
            'x-gbk'        'gb*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   156
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   157
            'iso2022-kr'   'ksc*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   158
            'x-euc-kr'     'ksc*'
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   159
        ).
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   160
    ].
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   161
!
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   162
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   163
initializeGenericFonts
6105
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
   164
    "generic fonts, that do not exist as a device font and are
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   165
     replaced by a real font"
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   166
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   167
    GenericFonts isNil ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   168
        GenericFonts := OrderedCollection new.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   169
        GenericFonts add:((self family:#serif face:nil style:nil size:0 sizeUnit:#pt encoding:nil) isGenericFont:true).
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   170
        GenericFonts add:((self family:#'sans-serif' face:nil style:nil size:0 sizeUnit:#pt encoding:nil) isGenericFont:true).
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   171
        GenericFonts add:((self family:#monospace face:nil style:nil size:0 sizeUnit:#pt encoding:nil) isGenericFont:true).
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   172
    ].
1265
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
   173
! !
c8030e99f941 added ST-80 compatible instVars (currently ignored, though)
Claus Gittinger <cg@exept.de>
parents: 1071
diff changeset
   174
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   175
!FontDescription class methodsFor:'instance creation'!
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   176
153
claus
parents: 109
diff changeset
   177
family:familyString
claus
parents: 109
diff changeset
   178
    "returns a font for given family and default (12pt) size 
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   179
     with default encoding.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   180
     The new fonts face defaults `medium', its style to `roman'.
153
claus
parents: 109
diff changeset
   181
     The returned font is not associated to a specific device"
claus
parents: 109
diff changeset
   182
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   183
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   184
        family:familyString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   185
        face:(self defaultFace) 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   186
        style:(self defaultStyle) 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   187
        size:(self defaultSize) 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   188
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   189
        encoding:(self defaultEncoding)
153
claus
parents: 109
diff changeset
   190
claus
parents: 109
diff changeset
   191
    "
claus
parents: 109
diff changeset
   192
     Font family:'helvetica'
claus
parents: 109
diff changeset
   193
     Font family:'courier'
claus
parents: 109
diff changeset
   194
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   195
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   196
    "Modified: 30.4.1996 / 17:20:44 / cg"
153
claus
parents: 109
diff changeset
   197
!
claus
parents: 109
diff changeset
   198
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   199
family:familyString face:faceString size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   200
    "returns a font for given family and size with default encoding.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   201
     The new fonts style defaults to `roman'.
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   202
     The returned font is not associated to a specific device"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   203
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   204
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   205
        family:familyString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   206
        face:faceString 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   207
        style:(self defaultStyle)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   208
        size:sizeNum
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   209
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   210
        encoding:(self defaultEncoding)
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   211
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   212
    "
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   213
     Font family:'helvetica' face:'medium' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   214
     Font family:'helvetica' face:'bold' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   215
     Font family:'courier'   face:'bold' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   216
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   217
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   218
    "Modified: 30.4.1996 / 17:21:07 / cg"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   219
!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   220
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   221
family:familyString face:faceString style:styleString size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   222
    "returns a font for given family, face, style and size with default encoding. 
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   223
     The returned font is not associated to a specific device"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   224
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   225
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   226
        family:familyString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   227
        face:faceString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   228
        style:styleString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   229
        size:sizeNum
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   230
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   231
        encoding:(self defaultEncoding)
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   232
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   233
    "
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   234
     Font family:'helvetica' face:'medium' style:'roman'  size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   235
     Font family:'helvetica' face:'medium' style:'italic' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   236
     Font family:'helvetica' face:'bold'   style:'roman'  size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   237
     Font family:'courier'   face:'bold'   style:'italic' size:10
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   238
    "
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   239
!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   240
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   241
family:familyString face:faceString style:styleString size:sizeNum encoding:encoding
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   242
    "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
   243
     The returned font is not associated to a specific device"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   244
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   245
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   246
          family:familyString 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   247
          face:faceString 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   248
          style:styleString 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   249
          size:sizeNum
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   250
          sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   251
          encoding:encoding
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   252
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   253
    "Modified: 20.4.1996 / 23:19:04 / cg"
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   254
!
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   255
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   256
family:familyString face:faceString style:styleString size:size sizeUnit:sizeUnit encoding:encoding
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   257
    "returns a font for given family, face, style, size and the specified encoding. 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   258
     The returned font is not associated to a specific device"
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   259
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   260
    ^ self new
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   261
          family:familyString 
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   262
          face:faceString 
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   263
          style:styleString 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   264
          size:size
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   265
          sizeUnit:sizeUnit
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   266
          encoding:encoding
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   267
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   268
    "Modified: 20.4.1996 / 23:19:04 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   269
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   270
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   271
family:familyString pixelSize:sizeNum
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   272
    "returns a font for given family and pixelSize with default encoding.
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   273
     The new fonts face defaults to `medium', its style to `roman'.
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   274
     Notice: the returned font will typically only be usable on a screen, 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   275
     and will not scale as to the devices resolution.
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   276
     Use #family:size: for resolution-independent sizing."
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   277
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   278
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   279
        family:familyString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   280
        face:(self defaultFace)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   281
        style:(self defaultStyle)
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   282
        size:sizeNum
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   283
        sizeUnit:#px
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   284
        encoding:(self defaultEncoding)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   285
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   286
    "
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   287
     (Font family:'helvetica' size:10) onDevice:Screen current
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   288
     (Font family:'helvetica' pixelSize:10) onDevice:Screen current
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   289
    "
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   290
!
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   291
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   292
family:familyString size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   293
    "returns a font for given family and size with default encoding.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   294
     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
   295
     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
   296
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   297
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   298
        family:familyString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   299
        face:(self defaultFace)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   300
        style:(self defaultStyle)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   301
        size:sizeNum
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   302
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   303
        encoding:(self defaultEncoding)
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   304
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   305
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   306
     Font family:'helvetica' size:10
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   307
     Font family:'courier' size:10
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   308
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   309
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   310
    "Modified: 30.4.1996 / 17:21:40 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   311
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   312
4005
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   313
family:familyString size:sizeNum encoding:encoding
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   314
    "returns a font for given family and size with default encoding.
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   315
     The new fonts face defaults to `medium', its style to `roman'.
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   316
     The returned font is not associated to a specific device"
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   317
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   318
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   319
        family:familyString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   320
        face:(self defaultFace)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   321
        style:(self defaultStyle)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   322
        size:sizeNum
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   323
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   324
        encoding:encoding
4005
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   325
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   326
    "
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   327
     Font family:'helvetica' size:10 encoding:#'iso8859-1'
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   328
     Font family:'courier' size:10 encoding:#'iso8859-1'
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   329
    "
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   330
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   331
    "Modified: 30.4.1996 / 17:21:40 / cg"
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   332
!
cbe56ccc85fa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3996
diff changeset
   333
1071
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   334
family:familyString style:aStyle size:sizeNum
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   335
    "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
   336
     The new fonts face defaults to `medium', its style to `roman'.
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   337
     The returned font is not associated to a specific device"
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   338
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   339
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   340
        family:familyString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   341
        face:(self defaultFace)
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   342
        style:aStyle 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   343
        size:sizeNum
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   344
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   345
        encoding:(self defaultEncoding)
1071
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   346
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   347
    "
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   348
     Font family:'helvetica' style:#roman size:48
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   349
     Font family:'courier' style:#roman size:10
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   350
    "
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   351
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   352
    "Modified: 30.4.1996 / 17:21:40 / cg"
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   353
    "Created: 8.10.1996 / 18:33:55 / cg"
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   354
!
ae5b36b93cf3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 629
diff changeset
   355
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   356
name:aFontName
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   357
    "returns a font with the given explicit name.
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   358
     WARNING:
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   359
       You shuld not use explicit naming, since font names vary
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   360
       with operatingSystems, devices and architecture.
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   361
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   362
     This interface is provided for special purposes only.
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   363
     On X, the name given should be according the X fontname conventions;
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   364
     i.e. something like: '-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'.
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   365
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   366
     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
   367
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   368
    ^ self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   369
        family:aFontName 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   370
        face:nil
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   371
        style:nil
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   372
        size:nil 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   373
        sizeUnit:#px
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   374
        encoding:nil
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   375
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   376
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   377
     Font name:'-*-times-bold-r-normal-*-*-240-*-*-*-*-iso8859-1'
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   378
     Font name:'6x10'
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   379
     Font name:'k14'
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   380
     ((Font name:'k14') on:Display) encoding
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   381
    "
629
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   382
Claus Gittinger <cg@exept.de>
parents: 611
diff changeset
   383
    "Modified: 30.4.1996 / 17:23:09 / cg"
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   384
! !
edf02eb2939c Initial revision
claus
parents:
diff changeset
   385
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   386
!FontDescription class methodsFor:'accessing'!
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   387
5991
c89cdc73a6bb class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
   388
defaultEncoding:encodingSymbol
c89cdc73a6bb class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
   389
    DefaultEncoding := encodingSymbol
c89cdc73a6bb class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
   390
!
c89cdc73a6bb class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
   391
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   392
genericFonts
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   393
    ^ GenericFonts
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   394
! !
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   395
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   396
!FontDescription class methodsFor:'defaults'!
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   397
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   398
defaultEncoding
5991
c89cdc73a6bb class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
   399
    ^ DefaultEncoding ? #'iso10646-1'.
5906
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
   400
"/    ^ #'iso8859-1'
5894
27858a4e6457 changed: #defaultEncoding
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
   401
27858a4e6457 changed: #defaultEncoding
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
   402
    "Modified: / 20-03-2012 / 23:48:24 / cg"
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   403
!
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   404
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   405
defaultFace
5906
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
   406
    ^ #medium
3996
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   407
!
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   408
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   409
defaultSize
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   410
    ^ 12
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   411
!
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   412
9ed3e413700c *** empty log message ***
ca
parents: 3993
diff changeset
   413
defaultStyle
5906
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
   414
    ^ #roman 
3993
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   415
! !
7fc0939208e2 defaultEncoding is now 8859-1
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   416
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   417
!FontDescription class methodsFor:'queries'!
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   418
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   419
characterSetForCharacterEncoding:encodingName
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   420
    "return the font-encoding for a character encoding"
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   421
4018
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   422
    ^ CharacterEncodingToCharacterSetMapping at:encodingName ifAbsent:encodingName
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   423
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   424
    "
4018
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   425
     FontDescription characterSetForCharacterEncoding:'utf8'     
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   426
     FontDescription characterSetForCharacterEncoding:'koi8-r'     
473a63a09368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   427
     FontDescription characterSetForCharacterEncoding:'unicode'     
3987
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   428
    "
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   429
!
796ff0ae8306 more mapping
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   430
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   431
fontNamePatternForCharset:aCharSetName
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   432
    "return the font-encoding for an iso-charset"
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   433
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   434
    ^ CharacterSetToFontMapping at:aCharSetName ifAbsent:nil
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   435
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   436
    "
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   437
     FontDescription fontNamePatternForCharset:'iso2022-jp'       
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   438
     FontDescription fontNamePatternForCharset:'euc-jp'     
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   439
    "
4010
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   440
!
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   441
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   442
preferredFontEncodingFor:fileEncoding
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   443
    "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
   444
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   445
    |ce fe|
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   446
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   447
    ce := FontDescription characterSetForCharacterEncoding:fileEncoding.
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   448
    ce isNil ifTrue:[
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   449
        ce := fileEncoding.
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   450
    ].
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   451
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   452
    fe := FontDescription fontNamePatternForCharset:ce.
7f899eceaf2d preferredFontEncodingFor moved from FileBrowser
Claus Gittinger <cg@exept.de>
parents: 4005
diff changeset
   453
    fe notNil ifTrue:[^ fe].
5906
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
   454
    ^ ce ? self defaultEncoding.
3827
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   455
! !
3390983893a2 font stuff moved from MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3785
diff changeset
   456
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3827
diff changeset
   457
!FontDescription methodsFor:'Compatibility-ST80'!
1277
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
boldness:aNumber
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   460
    "added for ST-80 compatibility; actually ignored currently"
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
    |val|
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   463
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   464
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   465
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   466
    ].
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   467
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   468
    "/ scale from 0..1 to 0..BoldnessMask
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   469
    val := (aNumber max:0.0) min:1.0.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   470
    val := (BoldnessMask * val) rounded.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   471
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   472
    flags := flags bitOr:val.
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   473
    masks := masks bitOr:BoldnessMask
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   474
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   475
    "Created: 25.1.1997 / 03:20:05 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   476
    "Modified: 25.1.1997 / 03:20:47 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   477
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   478
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   479
color:aColor
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   480
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   481
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   482
    "Created: 25.1.1997 / 03:21:28 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   483
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   484
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   485
encodings:aCollectionOfEncodings
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   486
    "added for ST-80 compatibility; actually ignored currently"
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
    "Created: 20.6.1997 / 09:52:46 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   489
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   490
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   491
fixedWidth:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   492
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   493
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   494
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   495
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   496
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   497
    aBoolean ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   498
        flags := flags bitOr:FixedFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   499
        masks := masks bitOr:FixedFlag
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   500
    ] ifFalse:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   501
        flags := flags bitClear:FixedFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   502
        masks := masks bitClear:FixedFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   503
    ].
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   504
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   505
    "Created: 25.1.1997 / 03:14:06 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   506
    "Modified: 25.1.1997 / 03:21:03 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   507
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   508
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   509
italic:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   510
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   511
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   512
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   513
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   514
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   515
    aBoolean ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   516
        flags := flags bitOr:ItalicFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   517
        masks := masks bitOr:ItalicFlag
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   518
    ] ifFalse:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   519
        flags := flags bitClear:ItalicFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   520
        masks := masks bitClear:ItalicFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   521
    ].
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   522
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   523
    "Created: 25.1.1997 / 03:15:37 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   524
    "Modified: 25.1.1997 / 03:20:55 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   525
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   526
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   527
outline:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   528
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   529
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   530
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   531
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   532
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   533
    aBoolean ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   534
        flags := flags bitOr:OutlineFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   535
        masks := masks bitOr:OutlineFlag
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   536
    ] ifFalse:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   537
        flags := flags bitClear:OutlineFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   538
        masks := masks bitClear:OutlineFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   539
    ].
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   540
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   541
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   542
    "Created: 20.6.1997 / 09:50:06 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   543
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   544
5165
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   545
pixelSize
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   546
    ^ pixelSize 
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   547
!
3b03bd5bb18e preps for pixelSize fonts
Claus Gittinger <cg@exept.de>
parents: 4894
diff changeset
   548
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   549
pixelSize:aNumber
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   550
    "if specified, 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
   551
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   552
    pixelSize := aNumber.
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   553
    sizeUnit := #px.
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   554
!
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
serif:aBoolean
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   557
    "added for ST-80 compatibility; actually ignored currently"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   558
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   559
    flags isNil ifTrue:[
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   560
        flags := masks := 0
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   561
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   562
    aBoolean ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   563
        flags := flags bitOr:SerifFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   564
        masks := masks bitOr:SerifFlag
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   565
    ] ifFalse:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   566
        flags := flags bitClear:SerifFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   567
        masks := masks bitClear:SerifFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   568
    ].
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   569
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   570
    "Created: 25.1.1997 / 03:15:17 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   571
    "Modified: 25.1.1997 / 03:20:59 / cg"
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   572
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   573
5196
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   574
setPixelSize:aNumber
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   575
    pixelSize := aNumber.
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   576
!
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
   577
6326
f48560d5ca58 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6320
diff changeset
   578
setSize:aNumber
6960
d26b0f5856db #FEATURE
Stefan Vogel <sv@exept.de>
parents: 6956
diff changeset
   579
    size := aNumber ? 0.
6326
f48560d5ca58 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6320
diff changeset
   580
!
f48560d5ca58 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6320
diff changeset
   581
f48560d5ca58 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6320
diff changeset
   582
setSizeUnit:aSymbol
f48560d5ca58 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6320
diff changeset
   583
    sizeUnit := aSymbol.
f48560d5ca58 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6320
diff changeset
   584
!
f48560d5ca58 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6320
diff changeset
   585
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   586
shadow:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   587
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   588
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   589
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   590
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   591
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   592
    aBoolean ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   593
        flags := flags bitOr:ShadowFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   594
        masks := masks bitOr:ShadowFlag
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   595
    ] ifFalse:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   596
        flags := flags bitClear:ShadowFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   597
        masks := masks bitClear:ShadowFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   598
    ].
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   599
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   600
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   601
    "Created: 20.6.1997 / 09:51:03 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   602
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   603
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   604
strikeout:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   605
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   606
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   607
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   608
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   609
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   610
    aBoolean ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   611
        flags := flags bitOr:StrikeoutFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   612
        masks := masks bitOr:StrikeoutFlag
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   613
    ] ifFalse:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   614
        flags := flags bitClear:StrikeoutFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   615
        masks := masks bitClear:StrikeoutFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   616
    ].
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   617
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   618
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   619
    "Created: 20.6.1997 / 09:51:36 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   620
!
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   621
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   622
underline:aBoolean
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   623
    "added for ST-80 compatibility; actually ignored currently"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   624
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   625
    flags isNil ifTrue:[
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   626
        flags := masks := 0
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   627
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   628
    aBoolean ifTrue:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   629
        flags := flags bitOr:UnderlineFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   630
        masks := masks bitOr:UnderlineFlag
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   631
    ] ifFalse:[
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   632
        flags := flags bitClear:UnderlineFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   633
        masks := masks bitClear:UnderlineFlag.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   634
    ].
1760
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   635
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   636
    "Modified: 25.1.1997 / 03:20:55 / cg"
ccd221469891 more ST80 compatibility (partially dummy)
Claus Gittinger <cg@exept.de>
parents: 1740
diff changeset
   637
    "Created: 20.6.1997 / 09:51:18 / cg"
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   638
! !
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   639
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   640
!FontDescription methodsFor:'accessing'!
edf02eb2939c Initial revision
claus
parents:
diff changeset
   641
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   642
device
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   643
    "return the device I am on"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   644
4146
4c46ae30bd64 Use #graphicsDevice
Stefan Vogel <sv@exept.de>
parents: 4018
diff changeset
   645
    <resource:#obsolete>
4c46ae30bd64 Use #graphicsDevice
Stefan Vogel <sv@exept.de>
parents: 4018
diff changeset
   646
3661
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   647
    self obsoleteMethodWarning:'use #graphicsDevice'.
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   648
    ^ self graphicsDevice
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   649
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   650
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   651
encoding
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
   652
    "return the font's encoding, as a symbol
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   653
     such as #'iso8859', #'jis0208.1983' or #ascii.
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
   654
     If the encoding is not known, return nil; 
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
   655
     You should assume ascii/iso8859-encoding then."
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   656
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   657
    ^ encoding
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   658
575
ad65411701b0 commentary
Claus Gittinger <cg@exept.de>
parents: 478
diff changeset
   659
    "Modified: 20.4.1996 / 23:14:36 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   660
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   661
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   662
face
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   663
    "return the face, a string"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   664
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   665
    ^ face
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   666
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   667
4892
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   668
face:aString
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   669
    "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
   670
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   671
    self assert:(self fontId isNil). "/ cannot change an instantiated font
7120
a13e27041519 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 7118
diff changeset
   672
    weight := nil.      "/ weight is the numeric equivalent to face
4892
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   673
    face := aString
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   674
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   675
    "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
   676
!
9b15605f58ff check: bad change of attributes of a REAL font
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
   677
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   678
family
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   679
    "return the family, a string"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   680
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   681
    ^ family
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   682
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   683
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   684
family:aString
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   685
    "set the family, a string"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   686
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   687
    self assert:(self fontId isNil). "/ cannot change an instantiated font
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   688
    family := aString
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   689
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   690
    "Created: 25.1.1997 / 03:12:12 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   691
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   692
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   693
family:familyString face:faceString style:styleString size:sizeNum encoding:encodingString
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   694
    <resource: #obsolete>
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   695
    "set the instance values"
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   696
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   697
    self 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   698
        family:familyString 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   699
        face:faceString 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   700
        style:styleString 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   701
        size:sizeNum 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   702
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   703
        encoding:encodingString
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   704
!
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
   705
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   706
family:familyString face:faceString style:styleString size:sizeArg sizeUnit:sizeUnitArg encoding:encodingString
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   707
    "set the instance values"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   708
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   709
    self assert:(self fontId isNil). "/ cannot change an instantiated font
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   710
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   711
    family := familyString asSymbol.
6961
29c66fcf1f94 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6960
diff changeset
   712
    faceString notEmptyOrNil ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   713
        face := faceString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   714
    ].
6961
29c66fcf1f94 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6960
diff changeset
   715
    styleString notEmptyOrNil ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   716
        style := styleString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   717
    ].
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   718
    sizeUnit := sizeUnitArg.
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   719
    sizeUnit == #px ifTrue:[
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   720
        pixelSize := sizeArg.
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   721
    ] ifFalse:[
6961
29c66fcf1f94 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6960
diff changeset
   722
        sizeUnit isNil ifTrue:[
29c66fcf1f94 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6960
diff changeset
   723
            sizeUnit := #pt.
29c66fcf1f94 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6960
diff changeset
   724
        ].
6960
d26b0f5856db #FEATURE
Stefan Vogel <sv@exept.de>
parents: 6956
diff changeset
   725
        size := sizeArg ? 0.
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   726
    ].
6961
29c66fcf1f94 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6960
diff changeset
   727
    encodingString notEmptyOrNil ifTrue:[
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   728
        encoding := encodingString asSymbol.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 52
diff changeset
   729
    ]
229
099543e5d779 handle empty family/style/encoding strings
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   730
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
   731
    "Modified: 20.4.1996 / 23:19:25 / cg"
52
edf02eb2939c Initial revision
claus
parents:
diff changeset
   732
!
edf02eb2939c Initial revision
claus
parents:
diff changeset
   733
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   734
file:aNumber
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   735
    "set the file"
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   736
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   737
    self assert:(self fontId isNil). "/ cannot change an instantiated font
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   738
"/    file := aNumber
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   739
!
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   740
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   741
flags
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   742
    ^ flags
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   743
!
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   744
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   745
flags:anInteger
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   746
    flags := anInteger.
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   747
!
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   748
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   749
fontFormat:aString
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   750
    "set the fontFormat"
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   751
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   752
    self assert:(self fontId isNil). "/ cannot change an instantiated font
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   753
"/    fontFormat := aString
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   754
!
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   755
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   756
fontId
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   757
    "return the device-dependent font-id"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   758
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   759
    ^ nil
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   760
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   761
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   762
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
   763
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   764
fontVersion:aNumber
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   765
    "set the fontVersion"
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   766
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   767
    self assert:(self fontId isNil). "/ cannot change an instantiated font
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   768
"/    fontVersion := aNumber
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   769
!
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   770
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   771
foundry
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   772
    "return the manufacturer/foundry"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   773
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   774
    ^ manufacturer
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   775
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   776
    "Created: 25.1.1997 / 03:12:43 / cg"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   777
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   778
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   779
foundry:aString
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   780
    "set the value of the manufacturer/foundry"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   781
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   782
    manufacturer := aString.
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   783
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   784
    "Created: 25.1.1997 / 03:12:43 / cg"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   785
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   786
3661
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   787
graphicsDevice
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   788
    "return the device I am on"
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   789
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   790
    ^ nil
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   791
!
b96d4f68b36e device -> graphicsDevice
Michael Beyl <mb@exept.de>
parents: 3629
diff changeset
   792
5644
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   793
hasOverlappingCharacters:aBoolean 
6111
0152b0e4461a class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6105
diff changeset
   794
    "set whether this has overlapping chars (for windows cleartype drawing only)"
5644
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   795
    
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   796
    flags := (flags ? 0) changeMask:OverlappingCharactersFlag to:aBoolean
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   797
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   798
    "Created: / 08-11-2010 / 13:16:23 / cg"
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   799
!
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   800
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   801
isAntialiasedFont:aBoolean 
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   802
    "set whether this is an antialiased font (currently for XftFonts only)"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   803
    
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   804
    flags := (flags ? 0) changeMask:AntialiasedFlag to:aBoolean
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   805
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   806
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   807
isDecorativeFont:aBoolean 
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   808
    "set whether this is a decorative font (currently for XftFonts only)"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   809
    
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   810
    flags := (flags ? 0) changeMask:DecorativeFlag to:aBoolean
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   811
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   812
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   813
isForceNonXFTFont:aBoolean 
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   814
    "set this to prevent that the font is resolved as an Xft font.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   815
     Special workaround hack: some operations (drawing into a form) 
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   816
     may not work correctly with Xft fonts"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   817
    
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   818
    flags := (flags ? 0) changeMask:ForceNonXFTFlag to:aBoolean
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   819
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   820
    "Created: / 12-02-2017 / 22:08:41 / cg"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   821
!
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
   822
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   823
isGenericFont:aBoolean 
6111
0152b0e4461a class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6105
diff changeset
   824
    "set whether this is a pseudo font"
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   825
    
5644
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   826
    flags := (flags ? 0) changeMask:GenericFlag to:aBoolean
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   827
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
   828
    "Modified: / 08-11-2010 / 12:58:03 / cg"
6111
0152b0e4461a class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6105
diff changeset
   829
    "Modified (comment): / 27-07-2013 / 15:39:50 / cg"
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   830
!
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   831
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   832
isOutlineFont:aBoolean 
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   833
    "set whether this is an outline font (currently for XftFonts only)"
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   834
    
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   835
    flags := (flags ? 0) changeMask:OutlineFlag to:aBoolean
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   836
!
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   837
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   838
isScalableFont:aBoolean 
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   839
    "set whether this is a scalable font (currently for XftFonts only)"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   840
    
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   841
    flags := (flags ? 0) changeMask:ScalableFlag to:aBoolean
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   842
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   843
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   844
manufacturer
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   845
    "return the manufacturer/foundry"
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   846
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   847
    ^ manufacturer
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   848
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   849
    "Created: 25.1.1997 / 03:12:43 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   850
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   851
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   852
manufacturer:aString
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   853
    "set the value of the manufacturer/foundry"
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   854
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   855
    manufacturer := aString.
1277
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   856
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   857
    "Created: 25.1.1997 / 03:12:43 / cg"
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   858
!
f79716195219 more ST-80 stuff
Claus Gittinger <cg@exept.de>
parents: 1275
diff changeset
   859
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   860
masks
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   861
    ^ masks
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   862
!
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   863
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   864
masks:something
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   865
    masks := something.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   866
!
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
   867
6723
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   868
name
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   869
    "the name (typically filename) if known"
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   870
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   871
    ^ name
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   872
!
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   873
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   874
name:aString
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   875
    name := aString.
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   876
!
8a4be06814d1 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6629
diff changeset
   877
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   878
sizeUnit
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   879
    "currently returns one of #pt or #px (internal use only)"
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   880
6961
29c66fcf1f94 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6960
diff changeset
   881
    ^ sizeUnit
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   882
!
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
   883
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   884
slant
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   885
    "get the slant"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   886
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   887
    ^ 0 "/ slant 
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   888
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   889
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   890
slant:aNumber
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   891
    "set the slant"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   892
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   893
    self assert:(self fontId isNil). "/ cannot change an instantiated font
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   894
"/    slant := aNumber
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   895
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   896
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   897
spacing
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   898
    "get the spacing"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   899
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   900
    ^ 100 "/ spacing 
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   901
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   902
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   903
spacing:aNumber
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   904
    "set the spacing"
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   905
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   906
    self assert:(self fontId isNil). "/ cannot change an instantiated font
6260
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   907
"/    spacing := aNumber
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   908
!
890ecfee1317 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6197
diff changeset
   909
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   910
style
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   911
    "return the style, a string"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   912
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
   913
    ^ style
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   914
!
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   915
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   916
style:aString
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   917
    "set the style"
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   918
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   919
    self assert:(self fontId isNil). "/ cannot change an instantiated font
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   920
    style := aString
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   921
!
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   922
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   923
weight:aNumber
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   924
    "set the weight"
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   925
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   926
    self assert:(self fontId isNil). "/ cannot change an instantiated font
7118
7314cb86e7e2 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 6991
diff changeset
   927
    weight := aNumber
6262
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   928
!
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   929
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   930
width:aNumber
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   931
    "set the width"
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   932
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   933
    self assert:(self fontId isNil). "/ cannot change an instantiated font
e1df0f1d5153 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
   934
"/    width := aNumber
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   935
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   936
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   937
!FontDescription methodsFor:'comparing'!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   938
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   939
= aFont
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   940
    "two fonts are considered equal, if the font-name components are;
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   941
     independent of the device, the font is on"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   942
7561
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   943
    (aFont species ~~ self species) ifTrue:[^ false].
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   944
    (size ~~ aFont size) ifTrue:[^ false].  
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   945
    (family ~= aFont family) ifTrue:[^ false].  
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   946
    (face ~= aFont face) ifTrue:[^ false].  
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   947
    (style ~= aFont style) ifTrue:[^ false].  
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   948
    (encoding ~~ aFont encoding) ifTrue:[^ false].  
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   949
    (sizeUnit ~~ aFont sizeUnit) ifTrue:[^ false].
6991
8271065cb89a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
   950
    sizeUnit == #px ifTrue:[
7561
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   951
        (pixelSize ~~ aFont pixelSize) ifTrue:[^ false].  
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   952
    ] ifFalse:[
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   953
        (size ~~ aFont size) ifTrue:[^ false].  
6991
8271065cb89a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
   954
    ].
6541
c75c0398462d class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6475
diff changeset
   955
    ^ true
6474
66caa2e18c27 class: FontDescription
sr
parents: 6467
diff changeset
   956
6475
950c091a7bbf class: FontDescription
sr
parents: 6474
diff changeset
   957
    "Modified: / 20-05-2014 / 11:18:31 / gg"
2160
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   958
!
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   959
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   960
hash
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   961
    "return a number for hashing - req'd since = is redefined."
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   962
2771
25c96682a2f3 really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
   963
    ^ ( (family hash bitAnd:16r1FFFFFFF)
25c96682a2f3 really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
   964
      + (face hash bitAnd:16r1FFFFFFF)
25c96682a2f3 really avoid LargeInteger arithmetic
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
   965
      + (style hash bitAnd:16r1FFFFFFF)
3019
6dc6821c111c oops - care for fractional size in #hash
Claus Gittinger <cg@exept.de>
parents: 2980
diff changeset
   966
      + (size ? 0) asInteger) bitAnd:16r3FFFFFFF
2160
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   967
b57a3f138ae3 added #hash
Claus Gittinger <cg@exept.de>
parents: 1760
diff changeset
   968
    "Created: / 19.6.1998 / 04:19:06 / cg"
2164
2bd89f5166a9 oops - fixed #hash.
Claus Gittinger <cg@exept.de>
parents: 2160
diff changeset
   969
    "Modified: / 20.6.1998 / 17:04:00 / cg"
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   970
!
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   971
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   972
sameDeviceFontAs:aFont
7561
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   973
    aFont species ~~ self species ifTrue:[^ false].
6541
c75c0398462d class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6475
diff changeset
   974
7561
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   975
    (family ~= aFont family) ifTrue:[ ^ false ].
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   976
    (face ~= aFont face) ifTrue:[ ^ false ].
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   977
    ((style = aFont style) 
6388
22758be61441 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6330
diff changeset
   978
      or:[ (style = 'italic' and:[aFont style = 'oblique'])
22758be61441 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6330
diff changeset
   979
      or:[ style = 'oblique' and:[aFont style = 'italic']]]) ifFalse:[ ^ false ].
5441
04ebe289a7e0 changed: #sameDeviceFontAs:
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
   980
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   981
    (encoding isNil or:[encoding = aFont encoding]) ifFalse:[ ^ false ].
7561
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   982
    (sizeUnit ? #pt) ~= aFont sizeUnit ifTrue:[ ^ false ].
5191
d3b4c72a8871 changed #sameDeviceFontAs:
Claus Gittinger <cg@exept.de>
parents: 5185
diff changeset
   983
    (sizeUnit ? #pt) == #pt ifTrue:[
7561
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   984
        (size ~= aFont size) ifTrue:[ ^ false ].
5191
d3b4c72a8871 changed #sameDeviceFontAs:
Claus Gittinger <cg@exept.de>
parents: 5185
diff changeset
   985
    ] ifFalse:[
7561
a9ba31e29ade #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   986
        (pixelSize ~= aFont pixelSize) ifTrue:[ ^ false ].
5191
d3b4c72a8871 changed #sameDeviceFontAs:
Claus Gittinger <cg@exept.de>
parents: 5185
diff changeset
   987
    ].
7876
44314d769878 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7875
diff changeset
   988
    (self isForceNonXFTFont or:[aFont isForceNonXFTFont]) ifTrue:[
7875
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
   989
        (self isXftFont or:[aFont isXftFont]) ifTrue:[^ false].        
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
   990
    ].    
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
   991
    ^ true
7875
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
   992
7876
44314d769878 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7875
diff changeset
   993
    "Modified: / 12-02-2017 / 22:59:40 / cg"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   994
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   995
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   996
!FontDescription methodsFor:'converting'!
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   997
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   998
asBold
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
   999
    "return the bold font corresponding to the receiver"
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1000
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1001
    ^ self asFace:#bold
4627
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
  1002
!
c3992b15969c asBold / asItalic return device fonts, if the receiver is one.
Claus Gittinger <cg@exept.de>
parents: 4626
diff changeset
  1003
5906
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1004
asEncoding:anotherEncoding
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1005
    |newFont|
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1006
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1007
    family isNil ifTrue:[
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1008
        "CompoundFonts do not have a family"
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1009
        ^ self
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1010
    ].
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1011
    newFont := self class 
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1012
        family:family 
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1013
        face:face 
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1014
        style:style 
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1015
        size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) 
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1016
        sizeUnit:sizeUnit
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1017
        encoding:anotherEncoding.
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1018
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1019
    newFont isGenericFont:self isGenericFont.
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1020
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1021
    ^ newFont onDevice:self graphicsDevice.
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1022
    "Modified: / 27-09-2006 / 13:08:11 / cg"
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1023
!
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1024
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1025
asFace:anotherFace
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1026
    "return the bold font corresponding to the receiver"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1027
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1028
    |newFont|
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1029
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1030
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1031
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1032
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1033
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1034
    newFont := self class 
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1035
                    family:family 
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1036
                    face:anotherFace 
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1037
                    style:style 
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1038
                    size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) 
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1039
                    sizeUnit:sizeUnit
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1040
                    encoding:encoding.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1041
    newFont isGenericFont:self isGenericFont.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1042
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1043
    ^ newFont onDevice:self graphicsDevice.
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1044
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1045
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1046
asFamily:anotherFamily
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1047
    "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
  1048
     with another family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1049
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1050
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1051
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1052
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1053
    ].
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1054
    ^ (self class 
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1055
        family:anotherFamily 
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1056
        face:face 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1057
        style:style 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1058
        size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) 
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1059
        sizeUnit:sizeUnit
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1060
        encoding:encoding) onDevice:self graphicsDevice.
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1061
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1062
5560
4f874d66dbde added: #asFontDescription
ca
parents: 5535
diff changeset
  1063
asFontDescription
4f874d66dbde added: #asFontDescription
ca
parents: 5535
diff changeset
  1064
    ^ self
4f874d66dbde added: #asFontDescription
ca
parents: 5535
diff changeset
  1065
!
4f874d66dbde added: #asFontDescription
ca
parents: 5535
diff changeset
  1066
5196
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
  1067
asFontWithPixelSize:anotherSize
7239
fc6eccef933b #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
  1068
    "return another font corresponding to the receiver's family, face and style but
8071
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1069
     with another pixel size.
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1070
     Alias for asPixelSize:"
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1071
8071
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1072
    ^ self asPixelSize:anotherSize
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1073
8071
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1074
    "Modified: / 12-08-2017 / 13:19:22 / cg"
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1075
!
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1076
5196
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
  1077
asItalic
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
  1078
    "return the italic font corresponding to the receiver"
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
  1079
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1080
    ^ self asStyle:#oblique
5196
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
  1081
!
90aeedb2a2b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5191
diff changeset
  1082
6629
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1083
asPixelSize:anotherSize
7239
fc6eccef933b #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
  1084
    "return another font corresponding to the receiver's family, face and style but
6629
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1085
     with another pixel size"
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1086
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1087
    |newFont|
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1088
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1089
    family isNil ifTrue:[
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1090
        "CompoundFonts do not have a family"
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1091
        ^ self
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1092
    ].
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1093
    newFont := self class 
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1094
        family:family 
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1095
        face:face 
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1096
        style:style 
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1097
        size:anotherSize 
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1098
        sizeUnit:#px
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1099
        encoding:encoding.
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1100
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1101
    newFont isGenericFont:self isGenericFont.
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1102
    ^ newFont onDevice:self graphicsDevice.
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1103
!
38198a85e3ed class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  1104
8071
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1105
asSize:anotherPointSize
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1106
    "return another font corresponding to the receiver's family, 
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1107
     face and style but with another (point-) size"
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1108
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1109
    |newFont|
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1110
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1111
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1112
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1113
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1114
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1115
    newFont := self class 
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1116
        family:family 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1117
        face:face 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1118
        style:style 
8071
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1119
        size:anotherPointSize 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1120
        sizeUnit:#pt
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1121
        encoding:encoding.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1122
6316
7fe0b1c1956f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6313
diff changeset
  1123
    newFont isGenericFont:self isGenericFont.
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1124
    ^ newFont onDevice:self graphicsDevice.
8071
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1125
4b9d1e67dfa2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 8017
diff changeset
  1126
    "Modified (comment): / 12-08-2017 / 13:19:50 / cg"
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1127
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1128
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1129
asStyle:anotherStyle
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1130
    |newFont|
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1131
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1132
    family isNil ifTrue:[
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1133
        "CompoundFonts do not have a family"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1134
        ^ self
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1135
    ].
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1136
    newFont := self class 
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1137
        family:family 
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1138
        face:face 
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1139
        style:anotherStyle 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1140
        size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) 
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1141
        sizeUnit:sizeUnit
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1142
        encoding:encoding.
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1143
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1144
    newFont isGenericFont:self isGenericFont.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1145
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1146
    ^ newFont onDevice:self graphicsDevice.
4894
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1147
    "Modified: / 27-09-2006 / 13:08:11 / cg"
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1148
!
37a8c77e6206 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4892
diff changeset
  1149
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1150
fromLiteralArrayEncoding:literalEncoding
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
  1151
    "read my contents from a aLiteralEncodedArray.
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
  1152
     Must match to what is generated in #literalArrayEncoding"
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1153
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1154
    family := literalEncoding at:2.
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1155
    face   := literalEncoding at:3.
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1156
    style  := literalEncoding at:4.
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1157
    size   := literalEncoding at:5.
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1158
    "/ the following kludge is for backward compatibility 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1159
    "/ do not cleanup !!
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1160
    literalEncoding size > 5 ifTrue:[
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1161
        literalEncoding size > 6 ifTrue:[
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1162
            sizeUnit := literalEncoding at:7.
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1163
            literalEncoding size > 7 ifTrue:[
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1164
                pixelSize := literalEncoding at:8.
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1165
            ].
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1166
        ].
5906
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1167
        encoding := literalEncoding at:6.
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1168
    ] ifFalse:[
5906
7aa045d62811 added: #asEncoding:
Stefan Vogel <sv@exept.de>
parents: 5894
diff changeset
  1169
        encoding := self class defaultEncoding.
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1170
    ].
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1171
!
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1172
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1173
literalArrayEncoding
2436
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
  1174
    "return myself encoded as a literal array.
4ef8d33c8951 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
  1175
     Must match to what is expected in #fromLiteralArrayEncoding:"
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1176
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1177
    |myName|
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1178
4532
81d5a57183bd Fix comments.
Stefan Vogel <sv@exept.de>
parents: 4526
diff changeset
  1179
    myName := self class name.
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1180
    "/ see comment in #fromLiteralArrayEncoding
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1181
    "/ do not cleanup !!
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1182
    (pixelSize isNil
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1183
    and:[ encoding == #'iso8859-1' ]) ifTrue:[
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1184
        ^ Array
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1185
            with:myName
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1186
            with:family
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1187
            with:face
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1188
            with:style
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1189
            with:size
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1190
    ].
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1191
    (pixelSize isNil and:[self sizeUnit == #pt]) ifTrue:[
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1192
        ^ Array
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1193
            with:myName
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1194
            with:family
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1195
            with:face
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1196
            with:style
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1197
            with:size
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1198
            with:encoding
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1199
    ].
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1200
    ^ Array
4298
2b347bca3941 encoding
Claus Gittinger <cg@exept.de>
parents: 4297
diff changeset
  1201
        with:myName
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1202
        with:family
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1203
        with:face
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1204
        with:style
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1205
        with:size
4297
10b461a37e26 added encoding to literal vector
Claus Gittinger <cg@exept.de>
parents: 4146
diff changeset
  1206
        with:encoding
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1207
        with:sizeUnit
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1208
        with:pixelSize
1740
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1209
!
804c5b51ec29 fromLiteralArrayEncoding:
ca
parents: 1618
diff changeset
  1210
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1211
on:aDevice
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1212
    "given the receiver, return a device Font"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1213
3623
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1214
    "/ send out a warning: #on: is typically used to create views
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1215
    "/ operating on a model.
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1216
    "/ Please use #onDevice: to avoid confusion.
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1217
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1218
    <resource:#obsolete>
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1219
16665d9b7263 #on: -> #onDevice
Claus Gittinger <cg@exept.de>
parents: 3265
diff changeset
  1220
    self obsoleteMethodWarning:'use #onDevice:'.
3629
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1221
    ^ self onDevice:aDevice.
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1222
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1223
1497
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1224
onDevice:aDevice
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1225
    "given the receiver, return a device Font"
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1226
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1227
    |newFont|
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1228
2980
409e9547a45c ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2934
diff changeset
  1229
    aDevice isNil ifTrue:[^ self].
7875
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1230
    
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1231
    newFont := Font
3629
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1232
        family:family 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1233
        face:face 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1234
        style:style 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1235
        size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) 
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1236
        sizeUnit:sizeUnit 
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1237
        encoding:encoding.
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1238
    newFont flags:flags.
5535
06501937fa4f #onDevice:aDevice -> creates a new font
sr
parents: 5511
diff changeset
  1239
    ^ newFont onDevice:aDevice.
5511
bc18d5eb3527 Support a list of replacement fonts and try each in order
Stefan Vogel <sv@exept.de>
parents: 5441
diff changeset
  1240
7875
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1241
    "Created: / 28-03-1997 / 16:09:30 / cg"
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1242
    "Modified (format): / 12-02-2017 / 22:15:12 / cg"
1497
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1243
!
697ac9b15962 added #onDevice: for protocol completeness.
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1244
7566
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1245
scaled:factor 
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1246
    "return another font corresponding to the receiver's family, face and style but
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1247
     with another pixel size"
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1248
    
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1249
    |newFont|
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1250
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1251
    family isNil ifTrue:[
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1252
        "CompoundFonts do not have a family"
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1253
        ^ self
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1254
    ].
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1255
    newFont := self class 
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1256
            family:family
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1257
            face:face
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1258
            style:style
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1259
            size:(size * factor) rounded
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1260
            sizeUnit:sizeUnit
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1261
            encoding:encoding.
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1262
    newFont isGenericFont:self isGenericFont.
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1263
    ^ newFont onDevice:self graphicsDevice.
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1264
!
e15d5734e788 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 7561
diff changeset
  1265
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1266
size:anotherSize
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1267
    <resource: #obsolete>
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1268
 
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1269
    "return a font corresponding to the receiver, but with different size."
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1270
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1271
    self obsoleteMethodWarning:'use #asSize:'.
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1272
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1273
    ^ self class 
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1274
        family:family 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1275
        face:face 
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1276
        style:style 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1277
        size:anotherSize 
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1278
        sizeUnit:#pt
5169
ad531e713603 pixelSized font preps
Claus Gittinger <cg@exept.de>
parents: 5166
diff changeset
  1279
        encoding:encoding
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1280
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1281
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1282
!FontDescription methodsFor:'displaying'!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1283
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1284
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aGC
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
  1285
    "display a partial string at some position in aGC.
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
  1286
     - display part of a string, drawing both fore- and background pixels"
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1287
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
  1288
    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
  1289
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1290
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1291
displayOpaqueString:aString x:x y:y in:aGC
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1292
    "display a string at some position in aGC."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1293
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1294
    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
  1295
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1296
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1297
displayString:aString from:index1 to:index2 x:x y:y in:aGC
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1298
    "display a partial string at some position in aGC."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1299
3663
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
  1300
    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
  1301
!
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
  1302
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
  1303
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
  1304
    "display a partial string at some position in aGC."
d40999d6cd1e refactored
Michael Beyl <mb@exept.de>
parents: 3661
diff changeset
  1305
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1306
    self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1307
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1308
6467
36da8c7a6ae9 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  1309
displayString:aString from:index1 to:index2 x:x0 y:y0 in:aGC opaque:opaque maxWidth:maxWidth
36da8c7a6ae9 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  1310
    "redefined for subclasses that do not implement maxWidth"
36da8c7a6ae9 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  1311
36da8c7a6ae9 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  1312
    self displayString:aString from:index1 to:index2 x:x0 y:y0 in:aGC opaque:opaque
36da8c7a6ae9 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  1313
!
36da8c7a6ae9 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  1314
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1315
displayString:aString x:x y:y in:aGC
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1316
    "display a string at some position in aGC."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1317
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1318
    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
  1319
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1320
! !
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1321
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1322
!FontDescription methodsFor:'errors'!
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1323
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1324
errorNoDevice
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1325
    "a query was made for device-specific info"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 89
diff changeset
  1326
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1327
    "
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1328
     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
  1329
     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
  1330
     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
  1331
     associated to a device.
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1332
     You should always use 
3159
3b040b0e4ae4 Fix error string 'for for'
Stefan Vogel <sv@exept.de>
parents: 3144
diff changeset
  1333
        font := font on:someDevice
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1334
     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
  1335
    "
3159
3b040b0e4ae4 Fix error string 'for for'
Stefan Vogel <sv@exept.de>
parents: 3144
diff changeset
  1336
    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
  1337
3b040b0e4ae4 Fix error string 'for for'
Stefan Vogel <sv@exept.de>
parents: 3144
diff changeset
  1338
    "Modified: / 27.1.2000 / 16:55:05 / stefan"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1339
! !
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1340
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1341
!FontDescription methodsFor:'getting a device font'!
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1342
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1343
onDevice:aDevice ifAbsent:exceptionBlock 
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1344
    "create a new Font representing the same font as
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1345
     myself on aDevice. This does NOT try to look for existing
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1346
     or replacement fonts (i.e. can be used to get physical fonts)."
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1347
7700
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1348
    |prefs|
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1349
7876
44314d769878 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7875
diff changeset
  1350
    self isForceNonXFTFont ifTrue:[
7875
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1351
        ^ self
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1352
            onDevice:aDevice 
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1353
            xFontsOnly:true 
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1354
            xftFontsOnly:false 
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1355
            ifAbsent:exceptionBlock 
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1356
    ].
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1357
    
7700
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1358
    prefs := UserPreferences current.
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1359
    ^ self
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1360
        onDevice:aDevice 
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1361
        xFontsOnly:(prefs useXFontsOnly) 
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1362
        xftFontsOnly:(prefs useXftFontsOnly) 
7875
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1363
        ifAbsent:exceptionBlock
d3f511dbeadc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7872
diff changeset
  1364
7876
44314d769878 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7875
diff changeset
  1365
    "Modified: / 12-02-2017 / 22:59:33 / cg"
7700
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1366
!
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1367
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1368
onDevice:aDevice xFontsOnly:xFontsOnly xftFontsOnly:xftFontsOnly ifAbsent:exceptionBlock 
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1369
    "create a new Font representing the same font as myself on aDevice. 
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1370
     The xFontsOnly/xftFontsOnly are only relevant for XWindow devices;
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1371
     xFontsOnly will suppress xft fonts, whereas xftFontsOnly will suppress x fonts
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1372
     (the first is useful if ST/X has a slow remote X connection for display,
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1373
      on which xft fonts are very slow. Yes, this is actually a reasonable setup
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1374
      in use at one of our customers)
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1375
     This does NOT try to look for existing
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1376
     or replacement fonts (i.e. can be used to get physical fonts)."
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1377
7623
aa70617876bb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7609
diff changeset
  1378
    |newFont id xftFont|
aa70617876bb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7609
diff changeset
  1379
7700
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1380
    (aDevice supportsXftFonts) ifTrue:[
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1381
        xFontsOnly ifTrue:[
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1382
            xftFont := (XftFontDescription for:self) onDevice:aDevice ifAbsent:[nil].
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1383
            xftFont notNil ifTrue:[^ xftFont].
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1384
            xftFontsOnly useXftFontsOnly ifTrue:[^ nil].
8a7791c4bceb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7623
diff changeset
  1385
        ].    
7623
aa70617876bb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7609
diff changeset
  1386
    ].    
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1387
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1388
    "ask that device for the font"
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
  1389
    id := aDevice 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
  1390
            getFontWithFamily:family 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
  1391
            face:face 
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
  1392
            style:style 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1393
            size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size])  
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1394
            sizeUnit:sizeUnit  
5166
a9cd84083df5 preps for pixelSized fonts
Claus Gittinger <cg@exept.de>
parents: 5165
diff changeset
  1395
            encoding:encoding.
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1396
    id isNil ifTrue:[
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1397
        "oops did not work - (device has no such font)"
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1398
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1399
        ^ exceptionBlock value
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1400
    ].
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1401
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1402
    newFont := (Font basicNew) 
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1403
                        setFamily:family 
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1404
                        face:face
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1405
                        style:style
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1406
                        size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size])  
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1407
                        sizeUnit:sizeUnit  
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1408
                        encoding:encoding
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1409
                        device:aDevice.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1410
    newFont setFontId:id.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1411
    newFont getFontInfos.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1412
    aDevice registerFont:newFont.
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1413
    ^ newFont
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1414
! !
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1415
8017
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1416
!FontDescription methodsFor:'inspecting'!
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1417
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1418
inspector2TabCharacterSet
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1419
    "an extra tab showing the font"
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1420
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1421
    |v|
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1422
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1423
    CharacterSetView 
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1424
            openOn:self 
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1425
            in:(v := View new) 
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1426
            label:'font' clickLabel:nil asInputFor:nil encoder:nil.
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1427
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1428
    ^ self newInspector2Tab
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1429
        label: 'Font';
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1430
        priority: 50;
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1431
        view: (HVScrollableView forView:v)
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1432
!
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1433
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1434
inspector2Tabs
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1435
    |tabs|
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1436
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1437
    tabs := super inspector2Tabs.
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1438
    ^ tabs copyWith:#inspector2TabCharacterSet
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1439
! !
59757832e8b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 7876
diff changeset
  1440
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1441
!FontDescription methodsFor:'printing & storing'!
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1442
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
  1443
printOn:aStream
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
  1444
    "append a user-friendly representation of the receiver to aStream"
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
  1445
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
  1446
    aStream nextPutAll:self userFriendlyName
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
  1447
!
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
  1448
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1449
userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1450
    "return a user-friendly printed representation of the receiver"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1451
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1452
    |nm|
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1453
6197
b4d4a3dc00bf class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6111
diff changeset
  1454
    nm := family ? 'nil font family'.
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1455
    face notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1456
        nm := nm , '-', face.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1457
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1458
    style notNil ifTrue:[
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1459
        nm := nm , '-', style.
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1460
    ].
6962
e310074c6d77 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6961
diff changeset
  1461
    sizeUnit == #px ifTrue:[
e310074c6d77 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6961
diff changeset
  1462
        (pixelSize notNil and:[pixelSize ~~ 0]) ifTrue:[
e310074c6d77 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6961
diff changeset
  1463
            nm := nm , '-', pixelSize printString,'px'.
e310074c6d77 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6961
diff changeset
  1464
        ].
6329
4907031e1432 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6326
diff changeset
  1465
    ] ifFalse:[
6962
e310074c6d77 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6961
diff changeset
  1466
        (size notNil and:[size ~~ 0]) ifTrue:[
e310074c6d77 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 6961
diff changeset
  1467
            nm := nm , '-', size printString,'pt'.
6329
4907031e1432 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6326
diff changeset
  1468
        ].
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1469
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1470
    encoding notNil ifTrue:[
3991
9810f304f469 printString
Claus Gittinger <cg@exept.de>
parents: 3989
diff changeset
  1471
        nm := nm , '(', encoding , ')'.
1618
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1472
    ].
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1473
    ^ nm
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1474
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1475
    "
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1476
     View defaultFont userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1477
     Button defaultFont userFriendlyName
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1478
    "
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1479
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1480
    "Modified: 20.4.1996 / 23:25:36 / cg"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1481
    "Created: 19.4.1997 / 18:09:25 / cg"
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1482
! !
044de84f0d5f moved userFriendlyName up
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  1483
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1484
!FontDescription methodsFor:'private'!
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1485
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1486
installInDeviceForGCId:aGCId
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1487
    "install the font for aGCId.
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1488
     This is a No-op. Subclasses may redefine this."
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1489
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1490
    ^ self.
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1491
! !
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 7343
diff changeset
  1492
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1493
!FontDescription methodsFor:'queries'!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1494
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1495
bold
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1496
    "return true, if the receiver is a bold font -
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1497
     Added for st-80 compatibility."
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1498
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1499
    "/ 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
  1500
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1501
    ^ face = 'bold'
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1502
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1503
    "Modified: 11.4.1997 / 21:31:25 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1504
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1505
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1506
boldness
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1507
    "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
  1508
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1509
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1510
    "/ 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
  1511
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1512
    face = 'roman' ifTrue:[^ 0.5].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1513
    face = 'normal' ifTrue:[^ 0.5].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1514
    face = 'bold' ifTrue:[^ 0.75].
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1515
    face = 'light' ifTrue:[^ 0.25].
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1516
    ^ 0.5
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1517
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1518
    "Modified: 11.4.1997 / 21:31:31 / cg"
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1519
!
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1520
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1521
color
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1522
    "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
  1523
     Added for st-80 compatibility.
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1524
     For now always black."
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1525
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1526
    ^ Color black
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1527
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1528
    "Created: 25.1.1997 / 02:59:15 / cg"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1529
    "Modified: 25.1.1997 / 03:02:14 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1530
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1531
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1532
existsOn:aDevice
7239
fc6eccef933b #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
  1533
    "return true, if the receiver is available on aDevice;
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1534
     false otherwise. This is a kludge method; its better to
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1535
     ask a device for its available fonts and use this info ...
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1536
     Notice, that if you simply use a font by name, the system
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1537
     will automatically take a replacement font."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1538
3629
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1539
    ^ ((Font
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1540
        family:family 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1541
        face:face 
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1542
        style:style 
5185
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1543
        size:(sizeUnit == #px ifTrue:[pixelSize] ifFalse:[size]) 
c807ae478014 pixelSize stuff
Claus Gittinger <cg@exept.de>
parents: 5169
diff changeset
  1544
        sizeUnit:sizeUnit
3629
9d06228191a6 Fix obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3623
diff changeset
  1545
        encoding:encoding) onDevice:aDevice ifAbsent:nil) notNil
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1546
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1547
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1548
fullName
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1549
    ^ nil
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1550
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1551
    "Created: 23.2.1996 / 00:45:45 / cg"
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1552
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1553
5644
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1554
hasOverlappingCharacters
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1555
    "answer true, if this is a windows font where characters overlap"
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1556
    
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1557
    ^ flags notNil and:[ flags bitTest:OverlappingCharactersFlag ].
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1558
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1559
    "Created: / 08-11-2010 / 13:16:51 / cg"
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1560
!
664ce01f38f5 +hasOverlappingCharacters
Claus Gittinger <cg@exept.de>
parents: 5560
diff changeset
  1561
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1562
isAntialiasedFont
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1563
    "answer true, if this is an antialiased font (currently Xft only)"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1564
    
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1565
    ^ (flags ? 0) bitTest:AntialiasedFlag
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1566
!
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1567
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1568
isDecorativeFont
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1569
    "answer true, if this is an decorative font (currently Xft only)"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1570
    
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1571
    ^ (flags ? 0) bitTest:DecorativeFlag
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1572
!
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1573
7876
44314d769878 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7875
diff changeset
  1574
isForceNonXFTFont
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1575
    "this flag is set if someone wants to preven an XFT font to be used
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1576
     when the receiver is resolved.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1577
     This is a temporary hack - some functions (drawing into a bitmap) may not work
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1578
     correctly when Xft fonts are used"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1579
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1580
    ^ flags notNil and:[flags bitTest:ForceNonXFTFlag]
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1581
7876
44314d769878 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 7875
diff changeset
  1582
    "Created: / 12-02-2017 / 22:59:25 / cg"
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1583
!
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1584
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1585
isGenericFont
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1586
    "answer true, if this is a pseudo font"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1587
    
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1588
    ^ (flags ? 0) bitTest:GenericFlag
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1589
!
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1590
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1591
isOutlineFont
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1592
    "answer true, if this is an outline font (currently Xft only)"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1593
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1594
    ^ (flags ? 0) bitTest:OutlineFlag 
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1595
!
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1596
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1597
isScaledFont
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1598
    "answer true, if this is a scalable font"
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1599
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1600
    ^ (sizeUnit ~= #px and:[size = 0]) or:[flags notNil and:[flags bitTest:ScalableFlag]] 
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1601
!
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1602
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1603
italic
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1604
    "return true if this is an italic font -
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1605
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1606
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1607
    "/ 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
  1608
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1609
    style = 'italic' ifTrue:[^ true].
3246
213e4771d6fb typo fixed
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
  1610
    style = 'oblique' ifTrue:[^ true].
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1611
    ^ false
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1612
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1613
    "Modified: 11.4.1997 / 21:31:42 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1614
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1615
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1616
serif
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1617
    "return true, if this font has serifs.
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1618
     Added for st-80 compatibility"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1619
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1620
    "/ 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
  1621
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1622
    family = 'Times' ifTrue:[^ true].
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1623
    family = 'times' ifTrue:[^ true].
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1624
    ^ false.
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1625
1585
7892ed31d333 fixed #italic and #bold
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  1626
    "Modified: 11.4.1997 / 21:31:51 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1627
!
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1628
3265
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1629
size
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1630
    "return the size, a number"
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1631
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1632
    ^ size
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1633
!
408fac627dc4 category change
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  1634
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1635
species
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1636
    ^ Font
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1637
!
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1638
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1639
underline
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1640
    "return true if this is an underlined font -
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1641
     Added for st-80 compatibility
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1642
     (always false here)"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1643
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1644
    ^ false
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1645
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1646
    "Created: 25.1.1997 / 02:58:30 / cg"
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1647
    "Modified: 25.1.1997 / 03:01:12 / cg"
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1648
! !
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1649
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1650
!FontDescription methodsFor:'queries-dimensions'!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1651
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1652
ascent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1653
    "return the ascent - the number of pixels above the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1654
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1655
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1656
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1657
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1658
ascentOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1659
    "return the ascent - the number of pixels above the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1660
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1661
    ^ (self onDevice:aDevice) ascent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1662
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1663
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1664
descent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1665
    "return the descent - the number of pixels below the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1666
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1667
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1668
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1669
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1670
descentOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1671
    "return the ascent - the number of pixels above the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1672
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1673
    ^ (self onDevice:aDevice) descent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1674
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1675
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1676
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1677
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1678
height
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1679
    "return the height - the number of pixels above plus below the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1680
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1681
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1682
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1683
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1684
heightOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1685
    "return the height of the given string.
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1686
     Here, assume the characters are of constant height"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1687
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1688
    ^ self height
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1689
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1690
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1691
heightOf:aString on:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1692
    "return the height of the given string on the given device."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1693
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1694
    ^ (self onDevice:aDevice) heightOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1695
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1696
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1697
heightOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1698
    "return the height - the number of pixels above PLUS below the baseLine."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1699
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1700
    ^ (self onDevice:aDevice) height
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1701
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1702
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1703
isFixedWidth
7609
bb3fd768e511 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7607
diff changeset
  1704
    "return true, if this is a fixed pitch font 
bb3fd768e511 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7607
diff changeset
  1705
     (i.e. all characters are of the same width).
bb3fd768e511 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7607
diff changeset
  1706
     Also called monospaced fonts"
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1707
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1708
    self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1709
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1710
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1711
maxAscent
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
  1712
    "return the font's maximum-ascent (i.e. the maximum of all characters);
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1713
     That is the number of units (usually pixels) above the baseline."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1714
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1715
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1716
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1717
6313
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1718
maxCode
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1719
    "return the biggest UCS code in font.
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1720
     Dummy for now"
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1721
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1722
    ^ 16rFFFF
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1723
!
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1724
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1725
maxDescent
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
  1726
    "return the font's maximum-descent (i.e. the maximum of all characters);
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1727
     That is the number of units (usually pixels) below the baseline."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1728
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1729
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1730
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1731
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1732
maxHeight
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
  1733
    "return the font's characters maximum height;
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1734
     That is the number of units (usually pixels)."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1735
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1736
    ^ self maxAscent + self maxDescent
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1737
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1738
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1739
maxWidth
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
  1740
    "return the font's maximum-width character (i.e. the maximum of all characters);
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1741
     That is a number of units (usually pixels)."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1742
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1743
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1744
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1745
6313
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1746
minCode
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1747
    "return the smallest UCS code in font.
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1748
     Dummy for now"
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1749
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1750
    ^ 0
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1751
!
2b9a1e4d6f96 class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 6262
diff changeset
  1752
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1753
width
7343
7ec79c481378 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7239
diff changeset
  1754
    "return the font's characters width;
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1755
     That is a number of units (usually pixels).
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1756
     For variable pitch fonts, the width of the space character is returned.
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1757
     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
  1758
     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
  1759
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1760
    ^ self widthOf:' '
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1761
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1762
    "Modified: 30.4.1996 / 16:43:45 / cg"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1763
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1764
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1765
widthOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1766
    "return the width of a string"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1767
3667
53ebf11c6dd9 widthOf fixed for Text-item
Michael Beyl <mb@exept.de>
parents: 3663
diff changeset
  1768
    ^ self widthOf:aString string from:1 to:aString size
2544
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1769
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1770
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1771
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1772
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1773
widthOf:aString from:start to:stop
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1774
    "return the width of a sub string"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1775
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1776
    ^ self subclassResponsibility
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1777
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1778
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1779
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1780
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1781
widthOf:aString from:start to:stop on:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1782
    "return the width of a sub string.
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1783
     Here, assume that this fonts width is device independent."
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1784
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1785
    ^ (self onDevice:aDevice) widthOf:aString from:start to:stop
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1786
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1787
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1788
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1789
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1790
widthOf:aString on:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1791
    "return the width of a string"
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1792
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1793
    ^ (self onDevice:aDevice) widthOf:aString
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1794
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1795
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1796
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1797
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1798
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1799
!
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1800
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1801
widthOn:aDevice
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1802
    "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
  1803
     (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
  1804
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1805
    ^ (self onDevice:aDevice) width
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1806
! !
8fdf3d873964 code refactoring
Claus Gittinger <cg@exept.de>
parents: 2436
diff changeset
  1807
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1808
!FontDescription methodsFor:'queries-encoding'!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1809
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1810
isASCII
7239
fc6eccef933b #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
  1811
    "return true, if the receiver's encoding is
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1812
     compatible with ascii (i.e. its ascii or iso8859)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1813
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1814
    ^ (encoding == #iso8859) or:[encoding == #ascii]
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1815
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1816
    "Created: 24.2.1996 / 22:47:30 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1817
    "Modified: 20.4.1996 / 23:20:01 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1818
!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1819
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1820
isISO8859
7239
fc6eccef933b #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
  1821
    "return true, if the receiver's encoding is
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1822
     compatible with iso8859 (i.e. iso8859)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1823
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1824
    ^ encoding == #iso8859
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1825
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1826
    "Created: 24.2.1996 / 22:47:12 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1827
    "Modified: 20.4.1996 / 23:20:13 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1828
!
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1829
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1830
isJIS
7239
fc6eccef933b #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
  1831
    "return true, if the receiver's encoding is
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1832
     compatible with jis (i.e. jisXXX)"
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1833
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1834
    ^ (encoding startsWith:'jis')
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1835
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1836
    "Created: 24.2.1996 / 22:47:47 / cg"
576
6a7392220976 commentary
Claus Gittinger <cg@exept.de>
parents: 575
diff changeset
  1837
    "Modified: 20.4.1996 / 23:20:30 / cg"
456
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1838
! !
3ab60f26b5a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1839
6105
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1840
!FontDescription methodsFor:'testing'!
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1841
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1842
isAlienFont
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1843
    "answer true, if this is an alien font which does not have a device representation.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1844
     Alien fonts are eg. Hershey or Bitmap fonts, which are drawn by st/x itself."
6105
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1845
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1846
    ^ true
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1847
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1848
    "Modified (comment): / 12-02-2017 / 22:03:22 / cg"
6320
3205a83288d3 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1849
!
3205a83288d3 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1850
3205a83288d3 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1851
isXftFont
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1852
    "anwer true, if this is an Xft font.
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1853
     return false here; to be redefined in subclass(es)"
6320
3205a83288d3 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1854
3205a83288d3 class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  1855
    ^ false
7872
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1856
eb7e735df7b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 7700
diff changeset
  1857
    "Modified (comment): / 12-02-2017 / 22:04:06 / cg"
6105
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1858
! !
156735f7972f class: FontDescription
Stefan Vogel <sv@exept.de>
parents: 5991
diff changeset
  1859
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1860
!FontDescription class methodsFor:'documentation'!
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1861
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1862
version
6956
96f7888403e5 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 6825
diff changeset
  1863
    ^ '$Header$'
5441
04ebe289a7e0 changed: #sameDeviceFontAs:
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
  1864
!
04ebe289a7e0 changed: #sameDeviceFontAs:
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
  1865
04ebe289a7e0 changed: #sameDeviceFontAs:
Claus Gittinger <cg@exept.de>
parents: 5223
diff changeset
  1866
version_CVS
6956
96f7888403e5 #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 6825
diff changeset
  1867
    ^ '$Header$'
437
a81ce3a8038b return dummy default encoding & fullNames
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
  1868
! !
3785
045a05c6abbe onDevice:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
  1869
5991
c89cdc73a6bb class: FontDescription
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
  1870
1275
9c3461bb0232 more ST-80 mimicri
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
  1871
FontDescription initialize!