From 9516fbc07da4b972e519fdb7ffeec848111e0d0a Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 10 Aug 2015 15:38:08 +0000 Subject: [PATCH] WebView 1.2: bigger fonts by default git-svn-id: svn://kolibrios.org@5712 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 10 ++++----- programs/cmm/browser/WebView.c | 10 ++++----- .../cmm/browser/html/page_not_found_ru.htm | 20 +++++++++--------- programs/cmm/lib/strings.h | 21 +++++++++++++++++++ 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index d677d88a33..e4a0320e8f 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -76,7 +76,7 @@ void TWebBrowser::DrawPage() { start_x = stolbec * list.font_w + magrin_left * DrawBuf.zoom + list.x; start_y = stroka * list.line_h + magrin_left + list.y; - stolbec_len = strlen(#line); + stolbec_len = utf8_strlen(#line); line_length = stolbec_len * list.font_w * DrawBuf.zoom; WriteBufText(start_x, 0, list.font_type, text_colors[text_color_index], #line, buf_data); @@ -214,7 +214,7 @@ void TWebBrowser::Parse(){ if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/ if (tagparam) GetNextParam(); - if (stolbec + strlen(#line) > list.column_max) Perenos(); + if (stolbec + utf8_strlen(#line) > list.column_max) Perenos(); DrawPage(); line = NULL; if (tag) SetTextStyle(WB1.DrawBuf.zoom * 5 + list.x, stroka * list.line_h + list.y + 5); // @@ -223,7 +223,7 @@ void TWebBrowser::Parse(){ default: DEFAULT_MARK: if (bukva<=15) bukva=' '; - line_len = strlen(#line); + line_len = utf8_strlen(#line); if (!pre_text) && (bukva == ' ') { if (line[line_len-1]==' ') break; //no double spaces @@ -252,7 +252,7 @@ void TWebBrowser::Perenos() int perenos_num; char new_line_text[4096]; perenos_num = strrchr(#line, ' '); - if (!perenos_num) && (strlen(#line)>list.column_max) perenos_num=list.column_max; + if (!perenos_num) && (utf8_strlen(#line)>list.column_max) perenos_num=list.column_max; strcpy(#new_line_text, #line + perenos_num); line[perenos_num] = 0x00; if (stroka-1 > list.visible) && (list.first <>0) end_parsing=true; @@ -585,7 +585,7 @@ void BufEncode(int set_new_encoding) { strcpy(bufpointer, o_bufpointer); } - bufpointer = ChangeCharset(charsets[set_new_encoding], "CP866", bufpointer); + //bufpointer = ChangeCharset(charsets[set_new_encoding], "CP866", bufpointer); } diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 11d258a34e..1fbdcf370e 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -30,14 +30,14 @@ char homepage[] = FROM "html\\homepage.htm"; #ifdef LANG_RUS - char version[]=" ⮢ 㧥 1.16"; + char version[]=" ⮢ 㧥 1.2"; ?define IMAGES_CACHE_CLEARED " ⨭ 饭" ?define T_LAST_SLIDE " ᫥ ᫠" char loading[] = "㧪 ࠭...
"; char page_not_found[] = FROM "html\page_not_found_ru.htm"; char accept_language[]= "Accept-Language: ru\n"; #else - char version[]=" Text-based Browser 1.16"; + char version[]=" Text-based Browser 1.2"; ?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define T_LAST_SLIDE "This slide is the last" char loading[] = "Loading...
"; @@ -133,7 +133,7 @@ void main() SetSkinColors(); WB1.DrawBuf.zoom = 1; - WB1.list.SetFont(6, 9, 10001000b); + WB1.list.SetFont(8, 14, 10111000b); Form.width=WIN_W; Form.height=WIN_H; SetElementSizes(); @@ -383,12 +383,12 @@ void Scan(dword id__) if (WB1.DrawBuf.zoom==2) { WB1.DrawBuf.zoom=1; - WB1.list.SetFont(6, 9, 10001000b); + WB1.list.SetFont(8, 14, 10111000b); } else { WB1.DrawBuf.zoom=2; - WB1.list.SetFont(6, 9, 10001001b); + WB1.list.SetFont(8, 14, 10111001b); } Draw_Window(); return; diff --git a/programs/cmm/browser/html/page_not_found_ru.htm b/programs/cmm/browser/html/page_not_found_ru.htm index 4b905dfa8e..db7fbab919 100644 --- a/programs/cmm/browser/html/page_not_found_ru.htm +++ b/programs/cmm/browser/html/page_not_found_ru.htm @@ -2,26 +2,26 @@ - +Страница не найдена -

 -࠭ 㯭

-

  ᤥ:

+

 Веб-страница недоступна

+

 Что можно сделать:

diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index edb4b36cbf..d55d74d513 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -916,6 +916,27 @@ inline void debugi(dword d_int) } +inline fastcall unsigned int utf8_strlen( ESI) +{ + $xor ecx, ecx + _loop: + $lodsb + $test al, al + $jz _done + $test al, 0x80 + $jz _1 + $and al, 0xc0 + $cmp al, 0x80 + $jz _loop + _1: + $inc ecx + $jmp _loop + + _done: + return ECX; +} + + #define strnmov strmovn #define stricmp strcmpi #define strcmpn strncmp