[cairo-commit] src/cairo-atsui-font.c

Brian Ewins brianewins at kemper.freedesktop.org
Thu Feb 15 15:08:49 PST 2007


 src/cairo-atsui-font.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletion(-)

New commits:
diff-tree 9bae496a0a057bb0de70b078ee5cde265663dc86 (from 16e20568a502b86d96c3087515e663bb7996f167)
Author: Brian Ewins <Brian.Ewins at gmail.com>
Date:   Thu Feb 15 23:08:40 2007 +0000

    [ATSUI] implement load_truetype_table
    
    Implements load truetype table, allowing selection of
    text and searching in pdfs generated using the atsui
    font backend.

diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index cdfb5c0..f6eb3a9 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -1076,6 +1076,30 @@ _cairo_atsui_scaled_font_get_atsu_font_i
     return afont->fontID;
 }
 
+static cairo_int_status_t
+_cairo_atsui_load_truetype_table (void	           *abstract_font,
+				  unsigned long     tag,
+				  long              offset,
+				  unsigned char    *buffer,
+				  unsigned long    *length)
+{
+    cairo_atsui_font_t *scaled_font = abstract_font;
+    ATSFontRef atsFont;
+    OSStatus err;
+	
+    atsFont = FMGetATSFontRefFromFont (scaled_font->fontID);
+    err = ATSFontGetTable ( atsFont, tag,
+			    (ByteOffset) offset,
+			    (ByteCount) *length,
+			    buffer,
+			    length);
+    if (err != noErr) {
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+    }
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
 const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend = {
     CAIRO_FONT_TYPE_ATSUI,
     _cairo_atsui_font_create_toy,
@@ -1084,7 +1108,7 @@ const cairo_scaled_font_backend_t cairo_
     _cairo_atsui_font_text_to_glyphs,
     NULL, /* ucs4_to_index */
     _cairo_atsui_font_old_show_glyphs,
-    NULL, /* load_truetype_table */
+    _cairo_atsui_load_truetype_table,
     NULL, /* map_glyphs_to_unicode */
 };
 


More information about the cairo-commit mailing list