[cairo-commit] cairo/src cairo-atsui-font.c,1.20.4.1,1.20.4.2
Tim Rowley
commit at pdx.freedesktop.org
Wed Sep 28 10:37:42 PDT 2005
Committed by: tor
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv21588/src
Modified Files:
Tag: BRANCH_1_0
cairo-atsui-font.c
Log Message:
* src/cairo-atsui-font.c (_cairo_atsui_font_text_to_glyphs):
Use _cairo_utf8_to_utf16 for character conversion.
Index: cairo-atsui-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-atsui-font.c,v
retrieving revision 1.20.4.1
retrieving revision 1.20.4.2
diff -u -d -r1.20.4.1 -r1.20.4.2
--- cairo-atsui-font.c 20 Sep 2005 15:23:20 -0000 1.20.4.1
+++ cairo-atsui-font.c 28 Sep 2005 17:37:40 -0000 1.20.4.2
@@ -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 @@
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 @@
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);
More information about the cairo-commit
mailing list