summaryrefslogtreecommitdiff
path: root/src/gdk
diff options
context:
space:
mode:
authorscuri <scuri>2010-01-05 13:43:07 +0000
committerscuri <scuri>2010-01-05 13:43:07 +0000
commitee94ff97d89c35170ec1b02e1b78085f05aa1f44 (patch)
treedd018e0d94f18e8e5d48737f0b9bef857496e370 /src/gdk
parent446e67d214829ecdcc953e1abba4c7953589c3eb (diff)
*** empty log message ***
Diffstat (limited to 'src/gdk')
-rw-r--r--src/gdk/cdgdk.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gdk/cdgdk.c b/src/gdk/cdgdk.c
index f355fe9..510df62 100644
--- a/src/gdk/cdgdk.c
+++ b/src/gdk/cdgdk.c
@@ -1191,10 +1191,13 @@ static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *s, int len)
int w, h, desc, dir = -1;
int ox = x, oy = y;
- utf8_text = g_locale_to_utf8(s, len, NULL, 0, NULL);
- pango_layout_set_text(ctxcanvas->fontlayout, utf8_text, -1);
+ utf8_text = g_locale_to_utf8(s, len, NULL, NULL, NULL);
+ if(!utf8_text)
+ utf8_text = g_convert (s, len, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
- pango_layout_get_pixel_size(ctxcanvas->fontlayout, &w, &h);
+ pango_layout_set_text(ctxcanvas->fontlayout, utf8_text, -1);
+
+ pango_layout_get_pixel_size(ctxcanvas->fontlayout, &w, &h);
metrics = pango_context_get_metrics(ctxcanvas->fontcontext, ctxcanvas->fontdesc, pango_context_get_language(ctxcanvas->fontcontext));
desc = (((pango_font_metrics_get_descent(metrics)) + PANGO_SCALE/2) / PANGO_SCALE);
@@ -1303,11 +1306,16 @@ static void cdtext(cdCtxCanvas *ctxcanvas, int x, int y, const char *s, int len)
static void cdgettextsize(cdCtxCanvas *ctxcanvas, const char *s, int len, int *width, int *height)
{
+ const char *utf8_text;
+
if (!ctxcanvas->fontlayout)
return;
- pango_layout_set_text(ctxcanvas->fontlayout, g_locale_to_utf8(s, len, NULL, 0, NULL), -1);
+ utf8_text = g_locale_to_utf8(s, len, NULL, NULL, NULL);
+ if(!utf8_text)
+ utf8_text = g_convert (s, len, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
+ pango_layout_set_text(ctxcanvas->fontlayout, utf8_text, -1);
pango_layout_get_pixel_size(ctxcanvas->fontlayout, width, height);
}