[cairo-commit] src/cairo-scaled-font-subsets.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Mon Sep 19 07:34:57 PDT 2011


 src/cairo-scaled-font-subsets.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit a810b012cf68ea56defd76556a7780c6d6aaaf08
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Sep 20 00:02:18 2011 +0930

    subsets: latin char map needs to belong to the font, not the subset

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index 16e51f2..355245a 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -79,6 +79,7 @@ typedef struct _cairo_sub_font {
     int num_glyphs_in_current_subset;
     int num_glyphs_in_latin_subset;
     int max_glyphs_per_subset;
+    char latin_char_map[256];
 
     cairo_hash_table_t *sub_font_glyphs;
     struct _cairo_sub_font *next;
@@ -87,7 +88,6 @@ typedef struct _cairo_sub_font {
 struct _cairo_scaled_font_subsets {
     cairo_subsets_type_t type;
     cairo_bool_t use_latin_subset;
-    char latin_char_map[256];
 
     int max_glyphs_per_unscaled_subset_used;
     cairo_hash_table_t *unscaled_sub_fonts;
@@ -274,6 +274,7 @@ _cairo_sub_font_create (cairo_scaled_font_subsets_t	*parent,
 			cairo_sub_font_t               **sub_font_out)
 {
     cairo_sub_font_t *sub_font;
+    int i;
 
     sub_font = malloc (sizeof (cairo_sub_font_t));
     if (unlikely (sub_font == NULL))
@@ -305,6 +306,8 @@ _cairo_sub_font_create (cairo_scaled_font_subsets_t	*parent,
     sub_font->num_glyphs_in_current_subset = 0;
     sub_font->num_glyphs_in_latin_subset = 0;
     sub_font->max_glyphs_per_subset = max_glyphs_per_subset;
+    for (i = 0; i < 256; i++)
+	sub_font->latin_char_map[i] = FALSE;
 
     sub_font->sub_font_glyphs = _cairo_hash_table_create (NULL);
     if (unlikely (sub_font->sub_font_glyphs == NULL)) {
@@ -654,8 +657,8 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t	*sub_font,
 	    if (latin_character > 0 ||
 		(latin_character == 0 && sub_font->num_glyphs_in_latin_subset > 0))
 	    {
-		if (!sub_font->parent->latin_char_map[latin_character]) {
-		    sub_font->parent->latin_char_map[latin_character] = TRUE;
+		if (!sub_font->latin_char_map[latin_character]) {
+		    sub_font->latin_char_map[latin_character] = TRUE;
 		    is_latin = TRUE;
 		}
 	    }
@@ -763,7 +766,6 @@ static cairo_scaled_font_subsets_t *
 _cairo_scaled_font_subsets_create_internal (cairo_subsets_type_t type)
 {
     cairo_scaled_font_subsets_t *subsets;
-    int i;
 
     subsets = malloc (sizeof (cairo_scaled_font_subsets_t));
     if (unlikely (subsets == NULL)) {
@@ -776,8 +778,6 @@ _cairo_scaled_font_subsets_create_internal (cairo_subsets_type_t type)
     subsets->max_glyphs_per_unscaled_subset_used = 0;
     subsets->max_glyphs_per_scaled_subset_used = 0;
     subsets->num_sub_fonts = 0;
-    for (i = 0; i < 256; i++)
-	subsets->latin_char_map[i] = FALSE;
 
     subsets->unscaled_sub_fonts = _cairo_hash_table_create (_cairo_sub_fonts_equal);
     if (! subsets->unscaled_sub_fonts) {


More information about the cairo-commit mailing list