[cairo-commit] 2 commits - src/cairo-cff-subset.c src/cairo-pdf-surface.c src/cairo-scaled-font-subsets.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Tue Nov 2 04:28:56 PDT 2010


 src/cairo-cff-subset.c          |   13 -------------
 src/cairo-pdf-surface.c         |   27 +++++++++++++--------------
 src/cairo-scaled-font-subsets.c |    1 +
 3 files changed, 14 insertions(+), 27 deletions(-)

New commits:
commit 84a7fe8a5c5326d77b0954be439799202e947d6b
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Nov 2 21:47:36 2010 +1030

    CFF Subset: Remove debug code

diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index 5954742..f2ec374 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -2165,12 +2165,6 @@ _cairo_cff_subset_init (cairo_cff_subset_t          *cff_subset,
     memcpy (cff_subset->data, data, length);
     cff_subset->data_length = length;
 
-    {
-	FILE *f;
-	f=fopen("font.cff", "wb");
-	fwrite(data, length, 1, f);
-	fclose(f);
-    }
     cairo_cff_font_destroy (font);
 
     return CAIRO_STATUS_SUCCESS;
@@ -2560,13 +2554,6 @@ _cairo_cff_fallback_init (cairo_cff_subset_t          *cff_subset,
     memcpy (cff_subset->data, data, length);
     cff_subset->data_length = length;
 
-    {
-	FILE *f;
-	f=fopen("font.cff", "wb");
-	fwrite(data, length, 1, f);
-	fclose(f);
-    }
-
     _cairo_type2_charstrings_fini (&type2_subset);
     cairo_cff_font_destroy (font);
 
commit 1047dc6b944d802eca441ec4956f7b5e1745fe60
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Nov 2 21:38:06 2010 +1030

    PDF: Use correct bfchar size in toUnicode for latin fonts
    
    poppler was printing warnings about the wrong size

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 549d6dc..4b42f88 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -3785,7 +3785,6 @@ _create_font_subset_tag (cairo_scaled_font_subset_t	*font_subset,
 static cairo_int_status_t
 _cairo_pdf_surface_emit_to_unicode_stream (cairo_pdf_surface_t		*surface,
 					   cairo_scaled_font_subset_t	*font_subset,
-                                           cairo_bool_t                  is_composite,
 					   cairo_pdf_resource_t         *stream)
 {
     unsigned int i, num_bfchar;
@@ -3813,7 +3812,7 @@ _cairo_pdf_surface_emit_to_unicode_stream (cairo_pdf_surface_t		*surface,
                                  "/CMapType 2 def\n"
                                  "1 begincodespacerange\n");
 
-    if (is_composite) {
+    if (font_subset->is_composite) {
         _cairo_output_stream_printf (surface->output,
                                      "<0000> <ffff>\n");
     } else {
@@ -3865,7 +3864,7 @@ _cairo_pdf_surface_emit_to_unicode_stream (cairo_pdf_surface_t		*surface,
 					     "%d beginbfchar\n",
 					     num_bfchar - i > 100 ? 100 : num_bfchar - i);
 	    }
-	    if (is_composite)
+	    if (font_subset->is_composite)
 		_cairo_output_stream_printf (surface->output, "<%04x> ", i + 1);
 	    else
 		_cairo_output_stream_printf (surface->output, "<%02x> ", i + 1);
@@ -3932,7 +3931,7 @@ _cairo_pdf_surface_emit_cff_font (cairo_pdf_surface_t		*surface,
 	return status;
 
     status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
-	                                                font_subset, TRUE,
+	                                                font_subset,
 							&to_unicode_stream);
     if (_cairo_status_is_error (status))
 	return status;
@@ -4167,7 +4166,7 @@ _cairo_pdf_surface_emit_type1_font (cairo_pdf_surface_t		*surface,
 	return status;
 
     status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
-	                                                font_subset, FALSE,
+	                                                font_subset,
 							&to_unicode_stream);
     if (_cairo_status_is_error (status))
 	return status;
@@ -4352,7 +4351,7 @@ _cairo_pdf_surface_emit_truetype_font_subset (cairo_pdf_surface_t		*surface,
     }
 
     status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
-	                                                font_subset, TRUE,
+	                                                font_subset,
 							&to_unicode_stream);
     if (_cairo_status_is_error (status)) {
 	_cairo_truetype_subset_fini (&subset);
@@ -4725,7 +4724,7 @@ _cairo_pdf_surface_emit_type3_font_subset (cairo_pdf_surface_t		*surface,
     free (glyphs);
 
     status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
-	                                                font_subset, FALSE,
+	                                                font_subset,
 							&to_unicode_stream);
     if (_cairo_status_is_error (status)) {
 	free (widths);
@@ -4786,15 +4785,15 @@ _cairo_pdf_surface_emit_unscaled_font_subset (cairo_scaled_font_subset_t *font_s
     cairo_pdf_surface_t *surface = closure;
     cairo_status_t status;
 
-    if (font_subset->is_composite) {
-        status = _cairo_pdf_surface_emit_cff_font_subset (surface, font_subset);
-        if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-            return status;
+    status = _cairo_pdf_surface_emit_cff_font_subset (surface, font_subset);
+    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+	return status;
 
-        status = _cairo_pdf_surface_emit_truetype_font_subset (surface, font_subset);
-        if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-            return status;
+    status = _cairo_pdf_surface_emit_truetype_font_subset (surface, font_subset);
+    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+	return status;
 
+    if (font_subset->is_composite) {
         status = _cairo_pdf_surface_emit_cff_fallback_font (surface, font_subset);
         if (status != CAIRO_INT_STATUS_UNSUPPORTED)
             return status;
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index f5e6dec..aa259d0 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -638,6 +638,7 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t	*sub_font,
 		(latin_character == 0 && sub_font->num_glyphs_in_latin_subset > 0))
 	    {
 		is_latin = TRUE;
+                sub_font->is_composite = FALSE;
 	    }
 	}
 


More information about the cairo-commit mailing list