BitmapFont.st
author Claus Gittinger <cg@exept.de>
Sat, 04 Jan 1997 13:43:25 +0100
changeset 1154 07bc33341696
parent 1088 136b1b7996a0
child 2545 829790f194cc
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 This is a demo example:
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
 THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
 ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
 SUCH DAMAGE.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
FontDescription subclass:#BitmapFont
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
	instanceVariableNames:'characterBitmaps ascent descent width'
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
	classVariableNames:''
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
	poolDictionaries:''
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	category:'Graphics-Support'
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!BitmapFont class methodsFor:'documentation'!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
copyright
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 COPYRIGHT (c) 1994 by Claus Gittinger
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
	      All Rights Reserved
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
 This software is furnished under a license and may be used
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
 only in accordance with the terms of that license and with the
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
 be provided or otherwise made available to, or used by, any
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
 other person.  No title to or ownership of the software is
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
 hereby transferred.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
 This is a demo example:
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
 THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
 ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
 SUCH DAMAGE.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
documentation
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    This class demonstrates, that it is possible to define your own
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    renderers for fonts - you could even write a class which reads 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    a truetype font from a ttf file and display those 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    (maybe someone finds the time to do this 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
     and provides the code to the public domain ?)
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    Here is a simple & sample implementation of private bitmap fonts;
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    Glyphs for each character are stored in the instance variable
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    'characterBitmaps'.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    Some sample glyphs can be created with the class' sampleGlyphs method.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    The required protocol is found in drawing and accessing.
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    77
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    78
    [author:]
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    79
        Claus Gittinger
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    80
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    81
    [see also:]
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    82
        Font GraphicsContext
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
examples
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
  a label showing characters in this new bitmap font:
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    89
                                                                [exBegin]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    |font l|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    font := (BitmapFont new glyphs:(BitmapFont sampleGlyhps)).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    font setAscent:13; setDescent:3.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
    l := Label new.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    l font:font.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    l label:'aazzazaz'.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    l open.
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
    99
                                                                [exEnd]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
  a label showing characters in a new smily font:
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   103
                                                                [exBegin]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    |font l|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    font := (BitmapFont new glyphs:(BitmapFont smilyGlyhps)).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    font setAscent:16; setDescent:0.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    l := Label new.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    l font:font.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    l label:'aabbaaa'.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    l open.
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   113
                                                                [exEnd]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
  demonstrate, that this font can be used in textViews just as any other font:
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
  (well, missing character glyphs are blanked)
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   118
                                                                [exBegin]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    |font top list|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    font := (BitmapFont new glyphs:(BitmapFont sampleGlyhps)).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    font setAscent:13; setDescent:3.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    top := ScrollableView forView:(list := SelectionInListView new).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    list font:font.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    list list:#('a' 'z' 'aaa' 'zzz' 'azaz' 'zaza' 'aa' 'az' 'za' 'hello' 'abcdef' 'xyz').
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    top extent:200@200.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    top open.
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   129
                                                                [exEnd]
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   130
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
  demonstrate, that this font can be used in textViews just as any other font:
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
  (well, missing character glyphs are blanked)
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   134
                                                                [exBegin]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    |font top list|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    font := (BitmapFont new glyphs:(BitmapFont sampleGlyhps)).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    font setAscent:13; setDescent:3.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    top := ScrollableView forView:(list := EditTextView new).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    list font:font.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    list list:#('a' 'z' 'aaa' 'zzz' 'azaz' 'zaza' 'aa' 'az' 'za' 'hello' 'abcdef' 'xyz').
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    top extent:200@200.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    top open.
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   145
                                                                [exEnd]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
! !
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
!BitmapFont class methodsFor:'instance creation'!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
new
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    |newFont|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    newFont := super new 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
		  family:'private' 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
		  face:nil
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
		  style:nil
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
		  size:nil
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
		  encoding:nil. 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    ^ newFont
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    "
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
     BitmapFont new glyphs:(self sampleGlyhps).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    "
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
! !
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
!BitmapFont class methodsFor:'private'!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
sampleGlyhps
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    "return the bitmap array for a sample font
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
     (only contains glyphs for $a and $z)"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    |characters|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    characters := Array new:256.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    characters 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
	at:(Character space asciiValue + 1) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
	put:(Form 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
		width:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
		height:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
		fromArray:#[2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
			    2r00000000 2r00000000]).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    characters 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
	at:($a asciiValue + 1) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
	put:(Form 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
		width:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
		height:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
		fromArray:#[2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
			    2r00011111 2r11111110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
			    2r00011111 2r11111110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
			    2r00000000 2r00000000]).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    characters 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
	at:($z asciiValue + 1) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
	put:(Form 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
		width:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
		height:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
		fromArray:#[2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
			    2r00000000 2r00110000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
			    2r00000000 2r01100000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
			    2r00000110 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
			    2r00001100 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
			    2r00011111 2r11111000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
			    2r00000000 2r00000000]).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    ^ characters
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
smilyGlyhps
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    "return the bitmap array for a smily font
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
     (only contains glyphs for $a and $b)"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    |characters|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    characters := Array new:256.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
    characters 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
	at:(Character space asciiValue + 1) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
	put:(Form 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
		width:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
		height:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
		fromArray:#[2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
			    2r00000000 2r00000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
			    2r00000000 2r00000000]).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    characters 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
	at:($a asciiValue + 1) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
	put:(Form 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
		width:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
		height:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
		fromArray:#[2r00000001 2r10000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
			    2r00001110 2r01110000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
			    2r00100000 2r00000100
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
			    2r01100110 2r01100110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
			    2r01000110 2r01100010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
			    2r01000000 2r00000010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
			    2r10000001 2r00000001
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
			    2r10000001 2r00000001
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
			    2r01001000 2r00010010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
			    2r01001100 2r00110010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
			    2r01100111 2r11100110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
			    2r00100001 2r10000100
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
			    2r00001110 2r01110000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
			    2r00000001 2r10000000]).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
    characters 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
	at:($b asciiValue + 1) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
	put:(Form 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
		width:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
		height:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
		fromArray:#[2r00000001 2r10000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
			    2r00001110 2r01110000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
			    2r00100000 2r00000100
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
			    2r01100110 2r01100110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
			    2r01000110 2r01100010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
			    2r01000000 2r00000010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
			    2r10000001 2r00000001
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
			    2r10000001 2r00000001
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
			    2r01000000 2r00000010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
			    2r01000001 2r10000010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
			    2r01100010 2r01000110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
			    2r00100010 2r01000100
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
			    2r00001110 2r01110000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
			    2r00000001 2r10000000]).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    characters 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
	at:($c asciiValue + 1) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
	put:(Form 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
		width:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
		height:16 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
		fromArray:#[2r00000001 2r10000000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
			    2r00001110 2r01110000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
			    2r00011000 2r00011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
			    2r00100000 2r00000100
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
			    2r01100110 2r01100110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
			    2r01000110 2r01100010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
			    2r01000000 2r00000010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
			    2r10000001 2r00000001
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
			    2r10000001 2r00000001
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
			    2r01000000 2r00000010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
			    2r01000001 2r10000010
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
			    2r01100011 2r11000110
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
			    2r00100011 2r11000100
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
			    2r00011001 2r10011000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
			    2r00001110 2r01110000
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
			    2r00000001 2r10000000]).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
    ^ characters
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
! !
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
!BitmapFont methodsFor:'accessing'!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
glyphs:aGlyphArray
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   347
    "set the glyphs array; that is the collection of
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   348
     bitmaps - one for each character"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   349
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
    characterBitmaps := aGlyphArray.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
    width isNil ifTrue:[
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   352
        width := aGlyphArray 
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   353
                        inject:0 
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   354
                        into:[:max :glyph | glyph isNil ifTrue:[
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   355
                                                max
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   356
                                            ] ifFalse:[
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   357
                                                max max:glyph width
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   358
                                            ]
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   359
                             ]
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    ].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
setAscent:aNumber
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   364
    "set the fonts ascent; that is the number of pixels
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   365
     above the fonts baseline"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   366
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
    ascent := aNumber.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
setDescent:aNumber
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   371
    "set the fonts ascent; that is the number of pixels
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   372
     below the fonts baseline"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   373
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
    descent := aNumber.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
! !
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
!BitmapFont methodsFor:'drawing'!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
displayOpaqueString:aString from:index1 to:index2 x:x0 y:y in:aGC
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   380
    "required protocol for new fonts:
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   381
     - display part of a string, drawing both fore- and background pixels"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   382
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
    |x|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
    x := x0.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
    index1 to:index2 do:[:index |
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   387
        self drawCharacter:(aString at:index) asciiValue in:aGC x:x y:y opaque:true.
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   388
        x := x + (self widthOfCharacter:(aString at:index) asciiValue)
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
    ]
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
displayOpaqueString:aString x:x0 y:y in:aGC
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   393
    "required protocol for new fonts:
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   394
     - display a string, drawing both fore- and background pixels"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   395
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
    |x|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
    x := x0.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
    aString do:[:character |
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   400
        self drawCharacter:character asciiValue in:aGC x:x y:y opaque:true.
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   401
        x := x + (self widthOfCharacter:character asciiValue)
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
    ]
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
displayString:aString from:index1 to:index2 x:x0 y:y in:aGC
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   406
    "required protocol for new fonts:
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   407
     - display part of a string, drawing foreground pixels only"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   408
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
    |x|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
    x := x0.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
    index1 to:index2 do:[:index |
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   413
        self drawCharacter:(aString at:index) asciiValue in:aGC x:x y:y opaque:false.
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   414
        x := x + (self widthOfCharacter:(aString at:index) asciiValue)
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
    ]
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
displayString:aString x:x0 y:y in:aGC
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   419
    "required protocol for new fonts:
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   420
     - display a string, drawing foreground pixels only"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   421
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
    |x|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
    x := x0.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
    aString do:[:character |
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   426
        self drawCharacter:character asciiValue in:aGC x:x y:y opaque:false.
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   427
        x := x + (self widthOfCharacter:character asciiValue)
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
    ]
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   429
! !
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   430
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   431
!BitmapFont methodsFor:'private - drawing'!
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
drawCharacter:ascii in:aGC x:x y:y
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
    |glyph|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
    (ascii between:0 and:255) ifFalse:[^ self].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
    glyph := characterBitmaps at:(ascii + 1).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
    glyph isNil ifTrue:[^ self].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
    aGC displayForm:glyph x:x y:y-ascent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
drawCharacter:ascii in:aGC x:x y:y opaque:opaque
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
    |glyph|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
    (ascii between:0 and:255) ifFalse:[^ self].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
    glyph := characterBitmaps at:(ascii + 1).
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
    glyph isNil ifTrue:[^ self].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
    aGC displayForm:glyph x:x y:y-ascent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
! !
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   451
!BitmapFont methodsFor:'private - queries'!
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   452
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   453
heightOfCharacter:ascii
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   454
    "return the height of a specific character"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   455
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   456
    |glyph|
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   457
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   458
    (ascii between:0 and:255) ifFalse:[^ 0].
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   459
    glyph := characterBitmaps at:(ascii + 1).
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   460
    glyph isNil ifTrue:[
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   461
	glyph := characterBitmaps at:(Character space asciiValue + 1).
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   462
    ].
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   463
    glyph isNil ifTrue:[^ 0].
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   464
    ^ glyph height
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   465
!
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   466
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   467
widthOfCharacter:ascii
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   468
    "return the width of a specific character"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   469
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   470
    |glyph|
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   471
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   472
    (ascii between:0 and:255) ifFalse:[^ 0].
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   473
    glyph := characterBitmaps at:(ascii + 1).
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   474
    glyph isNil ifTrue:[
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   475
	glyph := characterBitmaps at:(Character space asciiValue + 1).
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   476
    ].
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   477
    glyph isNil ifTrue:[^ 0].
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   478
    ^ glyph width
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   479
! !
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   480
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
!BitmapFont methodsFor:'queries'!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
ascent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
    "return the ascent - the number of pixels above the baseLine"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    ^ ascent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
ascentOn:aDevice
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
    "return the ascent - the number of pixels above the baseLine"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
    ^ ascent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
descent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    "return the descent - the number of pixels below the baseLine"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
    ^ descent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
descentOn:aDevice
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    "return the descent - the number of pixels below the baseLine"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
    ^ descent
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
fontId
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
    "return the fonts device ID - here, there is none"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
    ^ nil
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
height
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
    "return the height - the height in pixels of the highest character"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
    ^ descent + ascent.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
heightOf:aString
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
    "return the height - the height in pixels of the highest character"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
    ^ descent + ascent.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
heightOn:aDevice
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
    "return the height - the height in pixels of the highest character"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    ^ descent + ascent.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
isFixedWidth
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
    "return true if all of the fonts characters are equal in
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
     width."
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
    ^ true
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
maxAscent
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   539
    "return the maximum ascent; thats the ascent of the highest
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   540
     character"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   541
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
    ^ ascent.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   545
maxDescent
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   546
    "return the maximum descent; thats the descent of the highest
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   547
     character"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   548
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   549
    ^ descent.
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   550
!
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   551
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
maxHeight
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   553
    "return the maximum height; thats the height of the highest
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   554
     character"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   555
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
    ^ descent + ascent.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   559
maxWidth 
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   560
    "return the maximum width - the width of the widest character in pixels"
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   561
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   562
    ^ width
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   563
!
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   564
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
on:aDevice
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
    "return a device representation of the receiver"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
    ^ self
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
width 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
    "return the width - the average width in pixels"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
    ^ width
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
widthOf:aString
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
    "return the width of a string"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
    |sumW|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
    sumW := 0.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
    aString do:[:character |
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
	sumW := sumW + (self widthOfCharacter:character asciiValue) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
    ].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
    ^ sumW
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
widthOf:aString from:start to:stop
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    "return the width of a substring"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
    |sumW|
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
    (stop < start) ifTrue:[^ 0].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
    sumW := 0.
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
    start to:stop do:[:index |
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
	sumW := sumW + (self widthOfCharacter:(aString at:index) asciiValue) 
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
    ].
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
    ^ sumW
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   602
widthOf:aString from:startIndex to:endIndex on:aDevice
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   603
    "return the width of a substring"
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   605
    ^ self widthOf:aString from:startIndex to:endIndex
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
widthOn:aDevice
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
    "return the width - the average width in pixels"
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
    ^ width
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
! !
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
!BitmapFont class methodsFor:'documentation'!
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
version
1154
07bc33341696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1088
diff changeset
   617
    ^ '$Header: /cvs/stx/stx/libview/BitmapFont.st,v 1.2 1997-01-04 12:43:25 cg Exp $'
1088
136b1b7996a0 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
! !