[cairo-commit] cairo/src cairo-atsui-font.c,1.22,1.23

Tim Rowley commit at pdx.freedesktop.org
Wed Sep 28 10:35:58 PDT 2005


Committed by: tor

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv21155/src

Modified Files:
	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.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- cairo-atsui-font.c	7 Sep 2005 16:07:13 -0000	1.22
+++ cairo-atsui-font.c	28 Sep 2005 17:35:56 -0000	1.23
@@ -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