[cairo-commit] cairo/src cairo-font-subset.c, 1.1, 1.2 cairo-ft-font.c, 1.69, 1.70 cairo-ft-private.h, 1.3, 1.4 cairo-pdf-surface.c, 1.49, 1.50 cairo-ps-surface.c, 1.40, 1.41

Carl Worth commit at pdx.freedesktop.org
Wed Jul 13 11:01:27 PDT 2005


Committed by: cworth

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

Modified Files:
	cairo-font-subset.c cairo-ft-font.c cairo-ft-private.h 
	cairo-pdf-surface.c cairo-ps-surface.c 
Log Message:

        * src/cairo-ft-private.h:
        * src/cairo-ft-font.c: (_cairo_unscaled_font_is_ft),
        (_cairo_scaled_font_is_ft): New predicates to allow checking for
        cairo_ft derivates of generic font type.

        * src/cairo-ps-surface.c: (_cairo_ps_surface_get_font),
        (_cairo_ps_surface_show_glyphs), (_ps_output_show_glyphs):
        * src/cairo-pdf-surface.c: (_cairo_pdf_document_get_font),
        (_cairo_pdf_surface_show_glyphs):
        * src/cairo-font-subset.c: (_cairo_font_subset_create):
        Add explicit checks for cairo_ft derivatives of generic fonts
        rather than just blindly assuming that's what we get.


Index: cairo-font-subset.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font-subset.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-font-subset.c	21 Jun 2005 22:38:51 -0000	1.1
+++ cairo-font-subset.c	13 Jul 2005 18:01:25 -0000	1.2
@@ -139,6 +139,10 @@
     unsigned long size;
     int i, j;
 
+    /* XXX: Need to fix this to work with a general cairo_unscaled_font_t. */
+    if (! _cairo_unscaled_font_is_ft (unscaled_font))
+	return NULL;
+
     face = _cairo_ft_unscaled_font_lock_face (unscaled_font);
 
     /* We currently only support freetype truetype fonts. */

Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- cairo-ft-font.c	26 Jun 2005 06:24:19 -0000	1.69
+++ cairo-ft-font.c	13 Jul 2005 18:01:25 -0000	1.70
@@ -129,6 +129,12 @@
     return unscaled;
 }
 
+cairo_bool_t
+_cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font)
+{
+    return unscaled_font->backend == &cairo_ft_unscaled_font_backend;
+}
+
 static ft_unscaled_font_t *
 _ft_unscaled_font_create_from_filename (const char *filename,
 					int         id)
@@ -1018,6 +1024,12 @@
     return (cairo_scaled_font_t *)f;
 }
 
+cairo_bool_t
+_cairo_scaled_font_is_ft (cairo_scaled_font_t *scaled_font)
+{
+    return scaled_font->backend == &cairo_ft_scaled_font_backend;
+}
+
 static cairo_status_t
 _cairo_ft_scaled_font_create (const char	   *family, 
 			      cairo_font_slant_t    slant, 

Index: cairo-ft-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-ft-private.h	7 May 2005 04:33:22 -0000	1.3
+++ cairo-ft-private.h	13 Jul 2005 18:01:25 -0000	1.4
@@ -44,6 +44,12 @@
 
 CAIRO_BEGIN_DECLS
 
+cairo_bool_t
+_cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font);
+
+cairo_bool_t
+_cairo_scaled_font_is_ft (cairo_scaled_font_t *scaled_font);
+
 /* These functions are needed by the PDF backend, which needs to keep track of the
  * the different fonts-on-disk used by a document, so it can embed them
  */

Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- cairo-pdf-surface.c	8 Jul 2005 17:12:29 -0000	1.49
+++ cairo-pdf-surface.c	13 Jul 2005 18:01:25 -0000	1.50
@@ -1233,6 +1233,10 @@
     cairo_font_subset_t *pdf_font;
     unsigned int num_fonts, i;
 
+    /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */
+    if (! _cairo_scaled_font_is_ft (scaled_font))
+	return NULL;
+
     /* XXX Why is this an ft specific function? */
     unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font);
 
@@ -1279,6 +1283,10 @@
     cairo_font_subset_t *pdf_font;
     int i, index;
 
+    /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */
+    if (! _cairo_scaled_font_is_ft (scaled_font))
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     pdf_font = _cairo_pdf_document_get_font (document, scaled_font);
     if (pdf_font == NULL)
 	return CAIRO_STATUS_NO_MEMORY;

Index: cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- cairo-ps-surface.c	8 Jul 2005 17:12:29 -0000	1.40
+++ cairo-ps-surface.c	13 Jul 2005 18:01:25 -0000	1.41
@@ -368,6 +368,10 @@
     cairo_font_subset_t *subset;
     unsigned int num_fonts, i;
 
+    /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */
+    if (! _cairo_scaled_font_is_ft (scaled_font))
+	return NULL;
+
     /* XXX Why is this an ft specific function? */
     unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font);
 
@@ -409,6 +413,10 @@
     cairo_font_subset_t *subset;
     int i;
 
+    /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */
+    if (! _cairo_scaled_font_is_ft (scaled_font))
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     /* Collect font subset info as we go. */
     subset = _cairo_ps_surface_get_font (surface, scaled_font);
     if (subset == NULL)
@@ -1039,6 +1047,10 @@
     cairo_font_subset_t *subset;
     int i, subset_index;
 
+    /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */
+    if (! _cairo_scaled_font_is_ft (scaled_font))
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     _cairo_output_stream_printf (stream,
 				 "%% _ps_output_show_glyphs\n");
 




More information about the cairo-commit mailing list