diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 56fd47d7ca..ba2bf3b76d 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -117,7 +117,6 @@ void main() WB1.list.SetFont(8, 14, 10111000b); WB1.list.no_selection = true; //font init - font.no_bg_copy = true; font.bg_color = 0xFFFFFF; font.load(DEFAULT_FONT); if (!font.data) { @@ -286,16 +285,16 @@ void Draw_Window() list__w = 200; font.buffer_size = 0; font.size.height = 200; - font.color = 0; + font.color = 0x000000; font.size.text = 11; - font.prepare_buf(10,10,list__w,font.size.height, "Hello World!"); + font.write_buf(10,10,list__w,font.size.height, "Hello World!"); font.color = 0xFF00FF; font.size.text = 12; - font.prepare_buf(10,23,list__w,font.size.height, "How are you?"); + font.write_buf(10,23,list__w,font.size.height, "How are you?"); font.color = 0x2E74BB; font.size.text = 15; - font.prepare_buf(11,40,list__w,font.size.height, "Fine"); - SmoothFont(font.buffer, font.size.width, font.size.height); + font.write_buf(11,40,list__w,font.size.height, "Fine"); + font.apply_smooth(); _PutImage(0,0,list__w,font.size.height,font.buffer); */ } diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 0a9eb618f2..0eacc3447d 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -719,8 +719,7 @@ void Line_ReDraw(dword bgcol, filenum){ { font.bg_color = bgcol; font.smooth = smooth_font; - font.prepare(files.x + 23, files.item_h - font.height / 2 + y, file_name_off); - font.show(); + font.write(files.x + 23, files.item_h - font.height / 2 + y, file_name_off); } DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1 DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2 diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 3c618164a3..45830f9718 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -118,7 +118,6 @@ void LoadIniSettings() ini_get_int stdcall (eolite_ini_path, #config_section, "WinH", 500); WinH = EAX; ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1/"); - font.no_bg_copy = true; ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,"/sys/FONTS/Tahoma.kf"); font.load(#temp); ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on"); diff --git a/programs/cmm/kolibri font viewer/kolibri font viewer.c b/programs/cmm/kolibri font viewer/kolibri font viewer.c index abe6e2711e..600ad32a13 100644 --- a/programs/cmm/kolibri font viewer/kolibri font viewer.c +++ b/programs/cmm/kolibri font viewer/kolibri font viewer.c @@ -10,7 +10,6 @@ void main() proc_info Form; word i, y, btn; char line[256], title[4196]; - font.no_bg_copy = true; font.color = 0; font.bg_color = 0xFFFFFF; if (!param) strcpy(#param, DEFAULT_FONT); @@ -46,12 +45,10 @@ void main() { font.size.text = i; sprintf(#line,"Размер шрифта/size font %d пикселей.",i); - font.prepare_buf(10,y,Form.cwidth,Form.cheight-PANELH, #line); + font.write_buf(10,y,Form.cwidth,Form.cheight-PANELH, #line); } - if (font.smooth) SmoothFont(font.buffer, font.size.width, font.size.height); - font.left = 0; - font.top = PANELH; - font.show(); + if (font.smooth) font.apply_smooth(); + font.show_buf(0, PANELH); } } } diff --git a/programs/cmm/lib/font.h b/programs/cmm/lib/font.h index 772c4f3102..e4f04638f8 100644 --- a/programs/cmm/lib/font.h +++ b/programs/cmm/lib/font.h @@ -28,7 +28,6 @@ __SIZE size; int left,top,width,height; byte bold,italic,smooth; - byte no_bg_copy; dword bg_color; dword color; dword file_size; @@ -38,23 +37,18 @@ dword data; dword begin; byte load(...); - byte symbol(word x,y;byte s;dword c); - byte symbol_size(byte s); - dword prepare(word x,y;dword text1); - void prepare_buf(dword x,y,w,h, text1); - void show(); - byte textcenter(word x,y,w,h;dword txt); - dword getsize(dword text1); byte changeSIZE(); - void PixelRGB(dword x,y); + byte symbol(signed x,y;byte s;dword c); + byte symbol_size(byte s); + dword getsize(dword text1); + void apply_smooth(); + int write_center(dword x,y,w,h;dword txt); + int write(int x,y;dword text1); + void write_buf(int x,y,w,h, text1); + void show_buf(); }; FONT font = 0; -:void FONT::PixelRGB(dword x,y) -{ - dword offs = y*size.width+x*3 + buffer; - DSDWORD[offs] = DSDWORD[offs] & 0xFF000000 | color; -} :byte FONT::changeSIZE() { dword TMP_DATA; @@ -73,15 +67,6 @@ FONT font = 0; block = math.ceil(height*width/32); return true; } -:byte FONT::textcenter(word x,y,w,h;dword txt) -{ - getsize(txt); - EDX = w/2; - ECX = size.width/2; - EDX -= ECX; - x += EDX; - prepare(x,y,txt); -} :dword FONT::getsize(dword text1) { size.height = size.width = 0; @@ -109,7 +94,7 @@ FONT font = 0; { dword xi,yi; dword tmp,_; - dword iii; + dword iii = 0; byte rw=0; byte X; size.TMP_WEIGHT = math.ceil(size.text/17); @@ -126,7 +111,6 @@ FONT font = 0; return; } s = AnsiToCp866(s); - iii = 0; tmp = 4*block*s + data; for(yi=0; yirw)rw=xi; ___x = x+xi; IF(italic)___x+=math.ceil(ital); - PixelRGB(___x,EDI); - IF(bold) PixelRGB(___x+1,EDI); + offs = ___x*3 + EDI; + DSDWORD[offs] = DSDWORD[offs] & 0xFF000000 | color; + IF(bold) DSDWORD[offs+3] = DSDWORD[offs+3] & 0xFF000000 | color; } iii++; } @@ -193,10 +178,6 @@ FONT font = 0; return rw; } -:void FONT::show(){ - _PutImage(left,top,size.width,size.height,buffer); -} - byte AnsiToCp866(byte s) { IF(s>=128)&&(s<=175)s+=64; ELSE IF(s>=224)&&(s<=239)s+=16; @@ -206,22 +187,23 @@ byte AnsiToCp866(byte s) { } inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; } -:void SmoothFont(dword image, w, h) +:void FONT::apply_smooth() { dword i,line_w,to; - line_w = w * 3; - to = w*h*3 + image - line_w - 3; - for(i = image; i < to; i+=3) { - IF(i-image%line_w +3 == line_w) continue; + line_w = font.size.width * 3; + to = font.size.height - 1 * line_w + font.buffer - 3; + for(i=font.buffer; i < to; i+=3) + { + IF(i-font.buffer%line_w +3 == line_w) continue; IF(b24(i)==0x000000) && (b24(i+3)!=0x000000) && (b24(i+line_w)!=0x000000) && (b24(i+3+line_w)==0x000000) { - ShadowImage(i+3, 1, 1, 2); - ShadowImage(i+line_w, 1, 1, 2); + ShadowPixel(i+3, 2); + ShadowPixel(i+line_w, 2); } ELSE IF(b24(i)!=0x000000) && (b24(i+3)==0x000000) && (b24(i+line_w)==0x000000) && (b24(i+3+line_w)!=0x000000) { - ShadowImage(i, 1, 1, 2); - ShadowImage(i+3+line_w, 1, 1, 2); + ShadowPixel(i, 2); + ShadowPixel(i+3+line_w, 2); } } } @@ -240,11 +222,15 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; } return true; } -:dword FONT::prepare(int x,y;dword text1) +:int FONT::write_center(dword x,y,w,h;dword txt) +{ + getsize(txt); + return write(w-size.width/2+x,y,txt); +} + +:int FONT::write(int x,y; dword text1) { signed len=0; - proc_info Form_SELF_FONTS; - dword c; IF(!text1)return false; IF(size.text)IF(!changeSIZE())return false; left = x; @@ -262,17 +248,11 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; } buffer_size = EDX; buffer = realloc(buffer,buffer_size); } - IF (no_bg_copy) - { - EBX = bg_color; - EAX = buffer_size+buffer; - for (EDI=buffer; EDI