Rev 7286 | Rev 7798 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7286 | Rev 7769 | ||
---|---|---|---|
Line 101... | Line 101... | ||
101 | kfont_char_width[i] = symbol_size((byte) i); |
101 | kfont_char_width[i] = symbol_size((byte) i); |
102 | } |
102 | } |
103 | return true; |
103 | return true; |
104 | } |
104 | } |
Line 105... | Line 105... | ||
105 | 105 | ||
106 | :dword KFONT::getsize(byte fontSizePoints, dword text1) |
106 | :dword KFONT::getsize(byte font_size, dword text1) |
107 | { |
107 | { |
108 | size.height = size.width = 0; |
108 | size.height = size.width = 0; |
109 | size.offset_x = size.offset_y = -1; |
109 | size.offset_x = size.offset_y = -1; |
110 | if (size.pt != fontSizePoints) { |
110 | if (size.pt != font_size) { |
111 | size.pt = fontSizePoints; |
111 | size.pt = font_size; |
112 | if(!changeSIZE())return 0; |
112 | if(!changeSIZE())return 0; |
113 | } |
113 | } |
114 | WHILE(DSBYTE[text1]) |
114 | WHILE(DSBYTE[text1]) |
115 | { |
115 | { |
Line 121... | Line 121... | ||
121 | size.height += size.offset_y+1; |
121 | size.height += size.offset_y+1; |
122 | size.width += size.offset_x+1; |
122 | size.width += size.offset_x+1; |
123 | return size.width; |
123 | return size.width; |
124 | } |
124 | } |
Line 125... | Line 125... | ||
125 | 125 | ||
126 | //WILL NOT WORK if requested fontSizePoints |
126 | //WILL NOT WORK if requested font_size |
127 | //is differ from precalculated kfont_char_width[] |
127 | //is differ from precalculated kfont_char_width[] |
128 | :int KFONT::get_label_width(dword _label) |
128 | :int KFONT::get_label_width(dword _label) |
129 | { |
129 | { |
130 | int len=0; |
130 | int len=0; |
Line 240... | Line 240... | ||
240 | DSDWORD[i+KFONT_BPP+line_w] = dark_background; |
240 | DSDWORD[i+KFONT_BPP+line_w] = dark_background; |
241 | } |
241 | } |
242 | } |
242 | } |
243 | } |
243 | } |
Line 244... | Line 244... | ||
244 | 244 | ||
245 | :void KFONT::WriteIntoBuffer(int x,y,w,h; dword _background, _color; byte fontSizePoints; dword text1) |
245 | :void KFONT::WriteIntoBuffer(int x,y,w,h; dword _background, _color; byte font_size; dword text1) |
246 | { |
246 | { |
247 | dword new_raw_size; |
247 | dword new_raw_size; |
Line 248... | Line 248... | ||
248 | if(!text1)return; |
248 | if(!text1)return; |
249 | 249 | ||
250 | if (size.pt != fontSizePoints) { |
250 | if (size.pt != font_size) { |
251 | getsize(fontSizePoints, text1); |
251 | getsize(font_size, text1); |
252 | y -= size.offset_y; |
252 | y -= size.offset_y; |
253 | } |
253 | } |
Line 275... | Line 275... | ||
275 | text1++; |
275 | text1++; |
276 | } |
276 | } |
277 | return; |
277 | return; |
278 | } |
278 | } |
Line 279... | Line 279... | ||
279 | 279 | ||
280 | :int KFONT::WriteIntoWindow(int x,y; dword _background, _color; byte fontSizePoints; dword text1) |
280 | :int KFONT::WriteIntoWindow(int x,y; dword _background, _color; byte font_size; dword text1) |
281 | { |
281 | { |
282 | if(!text1)return 0; |
282 | if(!text1)return 0; |
283 | getsize(fontSizePoints, text1); |
283 | getsize(font_size, text1); |
284 | raw_size = NULL; |
284 | raw_size = NULL; |
285 | WriteIntoBuffer(0, -size.offset_y, size.width-size.offset_x, |
285 | WriteIntoBuffer(0, -size.offset_y, size.width-size.offset_x, |
286 | size.height-size.offset_y, _background, _color, fontSizePoints, text1); |
286 | size.height-size.offset_y, _background, _color, font_size, text1); |
287 | if (smooth) ApplySmooth(); |
287 | if (smooth) ApplySmooth(); |
288 | ShowBuffer(x,y); |
288 | ShowBuffer(x,y); |
289 | return size.offset_x + size.width; |
289 | return size.offset_x + size.width; |
Line 290... | Line 290... | ||
290 | } |
290 | } |
291 | 291 | ||
292 | :int KFONT::WriteIntoWindowCenter(dword x,y,w,h; dword _background, _color; byte fontSizePoints; dword text1) |
292 | :int KFONT::WriteIntoWindowCenter(dword x, _y,w,h, _background, _color; byte font_size; dword text1) |
293 | { |
293 | { |
294 | getsize(fontSizePoints, text1); |
294 | getsize(font_size, text1); |
Line 295... | Line 295... | ||
295 | return WriteIntoWindow(w-size.width/2+x-1,y, _background, _color, fontSizePoints, text1); |
295 | return WriteIntoWindow(w-size.width/2+x-1, _y, _background, _color, font_size, text1); |
296 | } |
296 | } |
297 | 297 |