Hi, 2009/1/22 Hofmann Johannes <Johannes.Hofmann@gmx.de>:
On Thu, Jan 22, 2009 at 09:18:00PM +0900, furaisanjin wrote: However looking at japanese pages, it seems that word wrapping is still an issue, see: http://lists.auriga.wearlab.de/pipermail/dillo-dev/2008-November/005427.html
Do you have an idea about a possible solution?
No, I don't think there is good solution but I added these code in html.cc. --- a/src/html.cc Thu Jan 22 08:31:44 2009 -0300 +++ b/src/html.cc Thu Jan 22 21:33:56 2009 +0900 @@ -58,6 +58,8 @@ #define TAB_SIZE 8 +#define UTF8_NONE_1WORD(x) ((x)&0x80) + /*----------------------------------------------------------------------------- * Name spaces *---------------------------------------------------------------------------*/ @@ -111,6 +113,7 @@ DilloImage *image); static void Html_callback(int Op, CacheClient_t *Client); static void Html_tag_cleanup_at_close(DilloHtml *html, int TagIdx); +static int Html_utf8_size (char c); /*----------------------------------------------------------------------------- * Local Data @@ -1117,6 +1120,7 @@ { int i, j, start; char *Pword, ch; + int utf8size; DilloHtmlParseMode parse_mode = S_TOP(html)->parse_mode; if (parse_mode == DILLO_HTML_PARSE_MODE_STASH || @@ -1159,7 +1163,20 @@ } else { if (!memchr(word,'&', size)) { /* No entities */ - DW2TB(html->dw)->addText(word, html->styleEngine->wordStyle ()); + for (start = 0; start < (int) strlen (word); ) { + if (UTF8_NONE_1WORD(word[start])) { + utf8size = Html_utf8_size (word[start]); + DW2TB(html->dw)->addText(dStrndup(&word[start],utf8size), html->styleEngine->wordStyle()); + start += utf8size; + } else { + for (i=0; i < (int) strlen (word)-start; i++) { + if (UTF8_NONE_1WORD(word[start+i])) + break; + } + DW2TB(html->dw)->addText(dStrndup(&word[start],i), html->styleEngine->wordStyle()); + start += i; + } + } } else { /* Collapse white-space entities inside the word (except ) */ Pword = a_Html_parse_entities(html, word, size); @@ -1167,7 +1184,20 @@ if (strchr("\t\f\n\r", Pword[i])) for (j = i; (Pword[j] = Pword[j+1]); ++j) ; - DW2TB(html->dw)->addText(Pword, html->styleEngine->wordStyle ()); + for (start = 0; start < (int) strlen (Pword); ) { + if (UTF8_NONE_1WORD(Pword[start])) { + utf8size = Html_utf8_size (Pword[start]); + DW2TB(html->dw)->addText(dStrndup(&Pword[start],utf8size), html->styleEngine->wordStyle()); + start += utf8size; + } else { + for (i=0; i < (int) strlen (Pword)-start; i++) { + if (UTF8_NONE_1WORD(Pword[start+i])) + break; + } + DW2TB(html->dw)->addText(dStrndup(&Pword[start],i), html->styleEngine->wordStyle()); + start += i; + } + } dFree(Pword); } } @@ -3700,4 +3730,20 @@ return token_start; } +static int Html_utf8_size (char c) +{ + if ((c&0xfc) == 0xfc) + return 6; + if ((c&0xf8) == 0xf8) + return 5; + if ((c&0xf0) == 0xf0) + return 4; + if ((c&0xe0) == 0xe0) + return 3; + if ((c&0xc0) == 0xc0) + return 2; + return 1; +} + Then dillo appearance is something I mentioned here. http://lists.auriga.wearlab.de/pipermail/dillo-dev/2008-November/005430.html By the way I notice bookmark (ctrl-b) doesn't work. Does anybody has this problem? Regards, furaisanjin