Package: hex-a-hop Version: 0.0.20070315-2 Severity: wishlist Tags: l10n patch X-Debbugs-CC: Helge Kreutzmann <[EMAIL PROTECTED]>
Hi, as I already wrote in #437338 it's not yet documented that " " breaks a line and " " starts a new paragraph. Even if this is known it is very difficult and needs a lot of time (add " ", test, change it, test again, ... now the next line, ...) to add proper linebreaks. I wrote a small patch which wraps text automatically on spaces. " " are not ignored and my patch only has effect on lines which are too long so it should be save to apply it. I tested it only short time but it should work. I know that it will probably fail with non 8bit encodings and that Japanese people probably want to specify linebreaks explicitely. Nevertheless it is a start. Later I also suggest to replace all these " " and " " by \n and \n\n which is well known for each translator. This would of course require an (automatic) update of all translations. Would you accept this? Maybe we should also discuss how to proceed. Adding another patch to a patch pile makes it (at least for me) more difficult. Also patching of patches is not easy. I would like to see all these patches integrated into the upstream version. What's your relation to upstream? Once you apply this little patch you could also activate the German messages.de.po translation. I now try to find a solution for #436469 (missing 8bit support) ... Thanks, Jens
--- ../Deb-Source/hex-a-hop-0.0.20070315.unchanged/hex_puzzzle.cpp 2007-08-11 23:55:41.000000000 +0200 +++ hex_puzzzle.cpp 2007-08-12 03:10:20.000000000 +0200 @@ -451,7 +457,26 @@ char* scan = tmp; while (1) { - char * end = split ? strstr(scan," ") : 0; + char * end = split ? strstr(scan," ") : 0; // TODO: should be \n! + if (split && !end) { // linebreaks allowed but not found + if (FontWidth(scan) >= screen->w) { + // string too long!, try to wrap on spaces + char *pos = scan, *last_possible_break = 0; + unsigned int text_width = 0; + while (*pos != 0) { + if (*pos == ' ') + last_possible_break = pos; + text_width += font[*pos].w + FONT_X_SPACING; + if (text_width >= screen->w) { + if (last_possible_break == 0) // strange, we have to break in the middle of a word + last_possible_break = pos; + break; + } + ++pos; + } + end = last_possible_break; + } + } if (!end) { PrintRaw(x - FontWidth(scan)/2, y, scan); @@ -459,9 +484,16 @@ } else { + const char split_at = *end; *end = '\0'; PrintRaw(x - FontWidth(scan)/2, y, scan); - scan = end+2; + if (split_at != ' ') { // wrap in middle of word + *end = split_at; + scan = end; + } else if (*(end+1) != ' ') + scan = end+1; + else + scan = end+2; y += FONT_SPACING; } }