Subversion Repositories pentevo

Rev

Rev 1054 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1054 Rev 1059
Line 68... Line 68...
68
 
68
 
69
class CharSet:
69
class CharSet:
70
 
70
 
71
        def __init__(self, num_els, first_idx, sz_x, sz_y):
71
        def __init__(self, num_els, first_idx, sz_x, sz_y):
72
               
72
 
-
 
73
                num_els   = int(num_els)
-
 
74
                first_idx = int(first_idx)
-
 
75
                sz_x      = int(sz_x)
-
 
76
                sz_y      = int(sz_y)
-
 
77
 
73
                # check arguments
78
                # check arguments
74
                if( int(num_els)<=0 ):
-
 
75
                        sys.exit('num_els must be positive!')
79
                assert num_els>0, 'num_els must be positive!'
76
                else:
-
 
77
                        self.num_els = int(num_els)
-
 
78
 
-
 
79
                if( int(first_idx)<0 ):
-
 
80
                        sys.exit('first_idx must be non-negative!')
80
                assert first_idx>=0, 'first_idx must be non-negative!'
81
                else:
-
 
82
                        self.first_idx = int(first_idx)
-
 
83
 
-
 
84
                if( int(sz_x)<1 ):
-
 
85
                        sys.exit('sz_x must be positive!')
81
                assert sz_x>0, 'sz_x must be positive!'
86
                else:
-
 
87
                        self.sz_x = int(sz_x)
82
                assert sz_y>0, 'sz_y must be positive!'
88
 
83
 
89
                if( int(sz_y)<1 ):
84
                self.num_els   = num_els
90
                        sys.exit('sz_y must be positive!')
85
                self.first_idx = first_idx
91
                else:
86
                self.sz_x      = sz_x
92
                        self.sz_y = int(sz_y)
87
                self.sz_y      = sz_y
93
 
88
 
94
                # generate empty characters
89
                # generate empty characters
95
                self.charset = [None] * (self.first_idx + self.num_els)
90
                self.charset = [None] * (self.first_idx + self.num_els)
96
 
91
 
97
                for char_idx in range(self.first_idx, self.first_idx + self.num_els):
92
                for char_idx in range(self.first_idx, self.first_idx + self.num_els):
Line 204... Line 199...
204
 
199
 
205
        for i in range(32,256):
200
        for i in range(32,256):
206
                for y in range(6):
201
                for y in range(6):
207
                        for x in range(6):             
202
                        for x in range(6):             
208
                               
203
                       
-
 
204
                                # actual layout of the resulting font is defined here
209
                                offs = ((i>>3)*36 + x + y*6) & 0x3FF
205
                                offs = ((i>>3)*36 + x + y*6) & 0x3FF
210
 
206
                                #
211
                                bit = 1<<(7-(i&7))
207
                                bit = 1<<(7-(i&7))
212
 
208
 
213
                                if font.get_pix(i,y,x):
209
                                if font.get_pix(i,y,x):
214
                                        binary[offs] = binary[offs] | bit
210
                                        binary[offs] = binary[offs] | bit
215
 
211