Rev 5802 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5802 | Rev 5814 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | :struct FONT |
24 | :struct FONT |
25 | { |
25 | { |
26 | __SIZE size; |
26 | __SIZE size; |
27 | byte r,g,b,weight,italic, smooth; |
27 | byte r,g,b,weight,italic, smooth; |
28 | byte width,height; |
28 | byte width,height; |
- | 29 | word left,top; |
|
29 | byte encoding; |
30 | byte encoding; |
30 | dword color; |
31 | dword color; |
31 | dword file_size; |
32 | dword file_size; |
32 | dword buffer; |
33 | dword buffer; |
33 | dword buffer_size; |
34 | dword buffer_size; |
Line 37... | Line 38... | ||
37 | byte load(...); |
38 | byte load(...); |
38 | byte symbol(word x,y;byte s;dword c); |
39 | byte symbol(word x,y;byte s;dword c); |
39 | byte symbol_size(byte s); |
40 | byte symbol_size(byte s); |
40 | dword prepare(word x,y;dword text1); |
41 | dword prepare(word x,y;dword text1); |
41 | void prepare_buf(word x,y,w,h;dword text1); |
42 | void prepare_buf(word x,y,w,h;dword text1); |
42 | void show(word x,y); |
43 | void show(); |
43 | byte textcenter(word x,y,w,h;dword txt); |
44 | byte textcenter(word x,y,w,h;dword txt); |
44 | dword getsize(dword text1); |
45 | dword getsize(dword text1); |
45 | byte changeSIZE(); |
46 | byte changeSIZE(); |
46 | void PixelRGB(word x,y); |
47 | void PixelRGB(word x,y); |
47 | //dword GetPixel(word x,y); |
48 | //dword GetPixel(word x,y); |
Line 90... | Line 91... | ||
90 | getsize(txt); |
91 | getsize(txt); |
91 | EDX = w/2; |
92 | EDX = w/2; |
92 | ECX = size.width/2; |
93 | ECX = size.width/2; |
93 | EDX -= ECX; |
94 | EDX -= ECX; |
94 | x += EDX; |
95 | x += EDX; |
95 | return text(x,y,txt); |
96 | prepare(x,y,txt); |
96 | } |
97 | } |
97 | :dword FONT::getsize(dword text1) |
98 | :dword FONT::getsize(dword text1) |
98 | { |
99 | { |
99 | size.height = size.width = 0; |
100 | size.height = size.width = 0; |
100 | size.offset.x = size.offset.y = -1; |
101 | size.offset.x = size.offset.y = -1; |
Line 176... | Line 177... | ||
176 | { |
177 | { |
177 | signed len=0; |
178 | signed len=0; |
178 | proc_info Form_SELF_FONTS; |
179 | proc_info Form_SELF_FONTS; |
179 | dword c; |
180 | dword c; |
180 | c = color; |
181 | c = color; |
- | 182 | left = x; |
|
181 | IF(!text1)return false; |
183 | IF(!text1)return false; |
182 | IF(size.text)IF(!changeSIZE())return false; |
184 | IF(size.text)IF(!changeSIZE())return false; |
183 | AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL; |
185 | AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL; |
184 | getsize(text1); |
186 | getsize(text1); |
185 | y -= size.offset.y; |
187 | y -= size.offset.y; |
186 | 188 | top = y; |
|
187 | EDX = size.width*size.height*3; |
189 | EDX = size.width*size.height*3; |
188 | IF(!buffer_size) |
190 | IF(!buffer_size) |
189 | { |
191 | { |
190 | buffer_size = EDX; |
192 | buffer_size = EDX; |
191 | buffer = malloc(buffer_size); |
193 | buffer = malloc(buffer_size); |
Line 207... | Line 209... | ||
207 | } |
209 | } |
208 | } |
210 | } |
209 | ELSE |
211 | ELSE |
210 | { |
212 | { |
211 | GetProcessInfo(#Form_SELF_FONTS, SelfInfo); |
213 | GetProcessInfo(#Form_SELF_FONTS, SelfInfo); |
212 | y-=size.offset.y; |
- | |
213 | CopyScreen(buffer,x+Form_SELF_FONTS.left+5,y+Form_SELF_FONTS.top+GetSkinHeight(),size.width,size.height); |
214 | CopyScreen(buffer,x+Form_SELF_FONTS.left+5,y+Form_SELF_FONTS.top+GetSkinHeight(),size.width,size.height); |
214 | } |
215 | } |
215 | len = size.offset.x; |
216 | len = size.offset.x; |
216 | WHILE(DSBYTE[text1]) |
217 | WHILE(DSBYTE[text1]) |
217 | { |
218 | { |
Line 221... | Line 222... | ||
221 | text1++; |
222 | text1++; |
222 | } |
223 | } |
223 | IF (no_bg_copy) && (!color) SmoothFont(buffer, size.width, size.height); |
224 | IF (no_bg_copy) && (!color) SmoothFont(buffer, size.width, size.height); |
224 | return len; |
225 | return len; |
225 | } |
226 | } |
226 | :void FONT::show(word x,y) |
227 | :void FONT::show() |
227 | { |
228 | { |
228 | y-=size.offset.y; |
- | |
229 | _PutImage(x,y,size.width,size.height,buffer); |
229 | _PutImage(left,top,size.width,size.height,buffer); |
230 | } |
230 | } |
231 | inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; } |
231 | inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; } |
232 | :void SmoothFont(dword image, w, h) |
232 | :void SmoothFont(dword image, w, h) |
233 | { |
233 | { |
234 | byte rr,gg,bb; |
234 | byte rr,gg,bb; |
Line 250... | Line 250... | ||
250 | } |
250 | } |
251 | } |
251 | } |
252 | :byte FONT::symbol(signed x,y;byte s) |
252 | :byte FONT::symbol(signed x,y;byte s) |
253 | { |
253 | { |
254 | dword xi,yi; |
254 | dword xi,yi; |
255 | dword _; |
- | |
256 | dword iii; |
255 | dword iii; |
257 | float ital = -size.w_italic; |
256 | float ital = -size.w_italic; |
258 | dword ___x; |
257 | dword ___x; |
259 | byte _TMP_WEIGHT; |
258 | //byte _TMP_WEIGHT; |
260 | byte rw=0; |
259 | byte rw=0; |
- | 260 | //_TMP_WEIGHT=2; |
|
261 | IF(s==32)return width/4; |
261 | IF(s==32)return width/4; |
262 | IF(s==9)return width; |
262 | IF(s==9)return width; |
263 | IF(!encoding) |
263 | IF(!encoding) |
264 | { |
264 | { |
265 | IF(s>=128)&&(s<=175)s+=64; |
265 | IF(s>=128)&&(s<=175)s+=64; |
Line 289... | Line 289... | ||
289 | { |
289 | { |
290 | IF(xi>rw)rw=xi; |
290 | IF(xi>rw)rw=xi; |
291 | ___x = x+xi; |
291 | ___x = x+xi; |
292 | IF(italic)___x+=math.ceil(ital); |
292 | IF(italic)___x+=math.ceil(ital); |
293 | PixelRGB(___x,EDI); |
293 | PixelRGB(___x,EDI); |
- | 294 | //_TMP_WEIGHT = 2; |
|
294 | FOR(_TMP_WEIGHT=size.TMP_WEIGHT; _TMP_WEIGHT; _TMP_WEIGHT--) |
295 | //WHILE(_TMP_WEIGHT) |
295 | { |
296 | //{ |
- | 297 | // _TMP_WEIGHT--; |
|
296 | IF(weight) PixelRGB(___x+_TMP_WEIGHT,EDI); |
298 | IF(weight) PixelRGB(___x+1,EDI); |
297 | } |
299 | //} |
298 | } |
300 | } |
299 | iii++; |
301 | iii++; |
300 | } |
302 | } |
301 | IF(italic) ital-=size.offset_i; |
303 | IF(italic) ital-=size.offset_i; |
302 | $inc yi |
304 | $inc yi |