Rev 5784 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5784 | Rev 5884 | ||
---|---|---|---|
Line 6... | Line 6... | ||
6 | #define PANELH 30 |
6 | #define PANELH 30 |
Line 7... | Line 7... | ||
7 | 7 | ||
8 | void main() |
8 | void main() |
9 | { |
9 | { |
- | 10 | proc_info Form; |
|
- | 11 | FONT font_title = 0; |
|
10 | proc_info Form; |
12 | FONT font_option = 0; |
11 | word i, y, btn; |
13 | word i, y, btn; |
12 | char line[256], title[4196]; |
14 | char line[256], title[4196]; |
13 | font.no_bg_copy = true; |
15 | font.no_bg_copy = true; |
14 | font.color = 0; |
16 | font.color = 0; |
- | 17 | font.bg_color = 0xFFFFFF; |
|
- | 18 | font.left = 5; |
|
15 | font.bg_color = 0xFFFFFF; |
19 | font.top = SKIN.height+PANELH; |
16 | if (!param) strcpy(#param, "/sys/fonts/Tahoma.kf"); |
20 | if (!param) strcpy(#param, "/sys/fonts/Tahoma.kf"); |
- | 21 | font.load(#param); |
|
- | 22 | ||
- | 23 | font_title.no_bg_copy = true; |
|
- | 24 | font_title.load("/sys/fonts/Tahoma.kf"); |
|
- | 25 | font_title.size.text = 12; |
|
- | 26 | font_title.color = 0x444444; |
|
- | 27 | font_title.weight = 1; |
|
- | 28 | font_title.use_smooth = 1; |
|
- | 29 | font_title.bg_color = 0xE1E1E1; |
|
- | 30 | ||
- | 31 | font_option.no_bg_copy = true; |
|
- | 32 | font_option.load("/sys/fonts/Tahoma.kf"); |
|
- | 33 | font_option.size.text = 13; |
|
- | 34 | font_option.color = 0x222222; |
|
- | 35 | font_option.use_smooth = 1; |
|
- | 36 | font_option.bg_color = 0xDADADA; |
|
17 | font.load(#param); |
37 | |
18 | strcpy(#title, "Kolibri font preview: "); |
38 | strcpy(#title, "Kolibri font preview: "); |
- | 39 | strcat(#title, #param); |
|
19 | strcat(#title, #param); |
40 | font_title.prepare(5, 4, #title); |
20 | loop() |
41 | loop() |
21 | { |
42 | { |
22 | switch(WaitEvent()) |
43 | switch(WaitEvent()) |
23 | { |
44 | { |
Line 27... | Line 48... | ||
27 | if (btn==2) font.weight ^=1; |
48 | if (btn==2) font.weight ^=1; |
28 | if (btn==3) font.italic ^=1; |
49 | if (btn==3) font.italic ^=1; |
29 | if (btn==4) font.smooth ^=1; |
50 | if (btn==4) font.smooth ^=1; |
30 | goto _DRAW_WINDOW_CONTENT; |
51 | goto _DRAW_WINDOW_CONTENT; |
31 | case evReDraw: |
52 | case evReDraw: |
32 | DefineAndDrawWindow(215,100,500,320,0x74,0xFFFFFF,#title); |
53 | DefineAndDrawWindow(215,100,500,320,0x04,0xFFFFFF,""); |
- | 54 | font_title.show(); |
|
33 | GetProcessInfo(#Form, SelfInfo); |
55 | GetProcessInfo(#Form, SelfInfo); |
34 | _DRAW_WINDOW_CONTENT: |
56 | _DRAW_WINDOW_CONTENT: |
35 | DrawBar(0, 0, Form.cwidth, PANELH, 0xCCCccc); |
57 | DrawBar(5, SKIN.height, Form.cwidth, PANELH, 0xDADADA); |
- | 58 | ||
- | 59 | font_option.italic = font_option.smooth = 0; |
|
- | 60 | font_option.weight = 1; |
|
- | 61 | font_option.prepare(30, SKIN.height+7, "Bold"); |
|
36 | CheckBox2(10, 8, 2, "Bold", font.weight); |
62 | CheckBox2(10, SKIN.height+8, 2, "", font.weight); |
- | 63 | font_option.show(); |
|
- | 64 | ||
- | 65 | font_option.weight = font_option.smooth = 0; |
|
- | 66 | font_option.italic = 1; |
|
- | 67 | font_option.prepare(90, SKIN.height+7, "Italic"); |
|
37 | CheckBox2(70, 8, 3, "Italic", font.italic); |
68 | CheckBox2(70, SKIN.height+8, 3, "", font.italic); |
- | 69 | font_option.show(); |
|
- | 70 | ||
- | 71 | font_option.weight = font_option.italic = 0; |
|
- | 72 | font_option.smooth = 1; |
|
- | 73 | font_option.prepare(160, SKIN.height+7, "Smooth"); |
|
38 | CheckBox2(140, 8, 4, "Smooth", font.smooth); |
74 | CheckBox2(140, SKIN.height+8, 4, "Smooth", font.smooth); |
- | 75 | font_option.show(); |
|
- | 76 | ||
39 | font.buffer_size = free(font.buffer); |
77 | IF(font.buffer)font.buffer_size = 0; |
- | 78 | ||
40 | if (!font.data) |
79 | if (!font.data) |
41 | { |
80 | { |
42 | DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff); |
81 | DrawBar(5, SKIN.height+PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff); |
43 | WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); |
82 | WriteText(15, 50, 0x82, 0xFF00FF, "Font is not loaded."); |
44 | } |
83 | } |
45 | else for (i=10, y=5; i<22; i++, y+=font.height;) //not flexible, need to calculate font count and max line length |
84 | else for (i=10, y=5; i<22; i++, y+=font.height;) //not flexible, need to calculate font count and max line length |
46 | { |
85 | { |
47 | font.size.text = i; |
86 | font.size.text = i; |
48 | sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i); |
87 | sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i); |
49 | font.prepare_buf(10,y,Form.cwidth,Form.cheight-PANELH, #line); |
88 | font.prepare_buf(15,SKIN.height+y,Form.cwidth,Form.cheight-PANELH, #line); |
50 | } |
89 | } |
51 | if (font.smooth) SmoothFont(font.buffer, font.size.width, font.size.height); |
90 | if (font.smooth) SmoothFont(font.buffer, font.size.width, font.size.height); |
52 | font.show(0, PANELH); |
91 | font.show(); |
53 | } |
92 | } |
54 | } |
93 | } |
55 | } |
94 | } |
Line 56... | Line 95... | ||
56 | 95 |