diff options
author | kazer_ <kazer_@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2007-02-20 10:53:15 +0000 |
---|---|---|
committer | kazer_ <kazer_@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2007-02-20 10:53:15 +0000 |
commit | 407a9568a3e5c5bff98afd100afcecccd7db003c (patch) | |
tree | 15804415fe227234cccf168b7414f82bb3eeeff7 /src | |
parent | 23b0159ee21e00cfcb09bc50f1716f49b4df44a0 (diff) | |
download | navit-407a9568a3e5c5bff98afd100afcecccd7db003c.tar.gz |
First try to handle UTF-8 maps.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@115 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'src')
-rw-r--r-- | src/display.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/display.c b/src/display.c index 75cb39926..6b5c21893 100644 --- a/src/display.c +++ b/src/display.c @@ -242,9 +242,13 @@ label_line(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, #if 0 printf("display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l); #endif - utf8=g_convert(label, -1, "utf8", "iso8859-1", NULL, NULL, NULL); - gr->draw_text(gr, fg, bg, font, utf8, &p_t, dx*0x10000/l, dy*0x10000/l); - g_free(utf8); + if(!g_utf8_validate(label,-1,NULL)){ + gr->draw_text(gr, fg, bg, font, label, &p_t, dx*0x10000/l, dy*0x10000/l); + } else { + utf8=g_convert(label, -1, "utf8", "iso8859-1", NULL, NULL, NULL); + gr->draw_text(gr, fg, bg, font, utf8, &p_t, dx*0x10000/l, dy*0x10000/l); + g_free(utf8); + } } } } @@ -264,9 +268,14 @@ display_labels(struct display_list *list, struct graphics *gr, struct graphics_g case 3: p.x=list->p[0].x+3; p.y=list->p[0].y+10; - utf8=g_convert(list->label, -1, "utf8", "iso8859-1", NULL, NULL, NULL); - gr->draw_text(gr, fg, bg, font, utf8, &p, 0x10000, 0); - g_free(utf8); + + if(g_utf8_validate(list->label,-1, NULL)){ + utf8=g_convert(list->label, -1, "utf8", "iso8859-1", NULL, NULL, NULL); + gr->draw_text(gr, fg, bg, font, utf8, &p, 0x10000, 0); + g_free(utf8); + } else { + gr->draw_text(gr, fg, bg, font, list->label, &p, 0x10000, 0); + } break; } } |