summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-09-28 10:37:40 +0000
committerTor Lillqvist <tml@novell.com>2005-09-28 10:37:40 +0000
commit9b27a73020354cc40f829dd6f83769979c640a36 (patch)
tree54a9bfd96f2a425a3b6f9379debb48efdcb1855c
parent0cb8ee21b55cb2b935905c9bf05e076ff84b8522 (diff)
Use _cairo_utf8_to_utf16 for character conversion.
-rw-r--r--ChangeLog5
-rw-r--r--src/cairo-atsui-font.c24
2 files changed, 11 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b5dc26f5..876ceaa19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2005-09-28 T Rowley <tim.rowley@gmail.com>
+ * src/cairo-atsui-font.c (_cairo_atsui_font_text_to_glyphs):
+ Use _cairo_utf8_to_utf16 for character conversion.
+
+2005-09-28 T Rowley <tim.rowley@gmail.com>
+
Bug #4612, reviewed by cworth.
* src/cairo-win32-font.c (_cairo_win32_scaled_font_glyph_bbox):
diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index 84b7ea19a..5eebae647 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -38,9 +38,6 @@
#include "cairo-atsui.h"
#include "cairoint.h"
#include "cairo.h"
-#if 0
-#include <iconv.h>
-#endif
/*
* FixedToFloat/FloatToFixed are 10.3+ SDK items - include definitions
@@ -245,8 +242,10 @@ _cairo_atsui_font_text_to_glyphs(void *abstract_font,
OSStatus err;
ATSUTextLayout textLayout;
ATSLayoutRecord *layoutRecords;
- ItemCount glyphCount, charCount;
+ ItemCount glyphCount;
+ int charCount;
UniChar *theText;
+ cairo_status_t status;
// liberal estimate of size
charCount = strlen(utf8);
@@ -257,20 +256,9 @@ _cairo_atsui_font_text_to_glyphs(void *abstract_font,
return CAIRO_STATUS_SUCCESS;
}
- // Set the text in the text layout object, so we can measure it
- theText = (UniChar *) malloc(charCount * sizeof(UniChar));
-
-#if 1
- for (i = 0; i < charCount; i++) {
- theText[i] = utf8[i];
- }
-#endif
-
-#if 0
- size_t inBytes = charCount, outBytes = charCount;
- iconv_t converter = iconv_open("UTF-8", "UTF-16");
- charCount = iconv(converter, utf8, &inBytes, theText, &outBytes);
-#endif
+ status = _cairo_utf8_to_utf16 (utf8, -1, &theText, &charCount);
+ if (status)
+ return status;
err = ATSUCreateTextLayout(&textLayout);