mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 12:37:37 +00:00
58 lines
1.8 KiB
Diff
58 lines
1.8 KiB
Diff
Index: cairo/src/cairo-atsui-font.c
|
|
===================================================================
|
|
RCS file: /cvsroot/mozilla/gfx/cairo/cairo/src/cairo-atsui-font.c,v
|
|
retrieving revision 1.5
|
|
diff -u -8 -p -r1.5 cairo-atsui-font.c
|
|
--- cairo/src/cairo-atsui-font.c 4 Jun 2005 12:19:44 -0000 1.5
|
|
+++ cairo/src/cairo-atsui-font.c 28 Jun 2005 18:53:10 -0000
|
|
@@ -248,39 +248,42 @@ _cairo_atsui_font_text_to_glyphs(void *
|
|
cairo_atsui_font_t *font = abstract_font;
|
|
size_t i;
|
|
OSStatus err;
|
|
ATSUTextLayout textLayout;
|
|
ATSLayoutRecord *layoutRecords;
|
|
ItemCount glyphCount, charCount;
|
|
UniChar *theText;
|
|
|
|
- err = ATSUCreateTextLayout(&textLayout);
|
|
-
|
|
-#if 1
|
|
+ // liberal estimate of size
|
|
charCount = strlen(utf8);
|
|
|
|
+ if (charCount == 0) {
|
|
+ *glyphs = NULL;
|
|
+ *num_glyphs = 0;
|
|
+ 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
|
|
- // Set the text in the text layout object, so we can measure it
|
|
- charCount = strlen(utf8);
|
|
- theText = (UniChar *) malloc(charCount * sizeof(UniChar));
|
|
-
|
|
size_t inBytes = charCount, outBytes = charCount;
|
|
iconv_t converter = iconv_open("UTF-8", "UTF-16");
|
|
charCount = iconv(converter, utf8, &inBytes, theText, &outBytes);
|
|
#endif
|
|
|
|
+ err = ATSUCreateTextLayout(&textLayout);
|
|
+
|
|
err = ATSUSetTextPointerLocation(textLayout,
|
|
theText, 0, charCount, charCount);
|
|
|
|
|
|
// Set the style for all of the text
|
|
err = ATSUSetRunStyle(textLayout,
|
|
font->unscaled_style, kATSUFromTextBeginning, kATSUToTextEnd);
|
|
|