Use _cairo_utf8_to_utf16 for character conversion.

This commit is contained in:
Tor Lillqvist 2005-09-28 10:35:55 +00:00
parent dc711cd88d
commit 303e3e9748
2 changed files with 11 additions and 18 deletions

View file

@ -1,3 +1,8 @@
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>
* ROADMAP: Note that Bug #4612 (Text not being drawn if first

View file

@ -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);