[cairo-commit] 3 commits - src/cairo-truetype-subset.c
Adrian Johnson
ajohnson at kemper.freedesktop.org
Sat Feb 3 22:06:58 PST 2007
src/cairo-truetype-subset.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
New commits:
diff-tree 7d05b9bdd328c7ec0422f45893fa0e0d6e9bb135 (from 8b3176158351e62185294d512030c7af1ec4fabc)
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date: Sun Feb 4 16:26:18 2007 +1030
TrueType Subsetting: Sort table directory
The TrueType specification requires the table directory
to be sorted by tag.
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 03fb346..fa1b178 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -647,6 +647,7 @@ typedef struct table table_t;
struct table {
unsigned long tag;
int (*write) (cairo_truetype_font_t *font, unsigned long tag);
+ int pos; /* position in the font directory */
};
static const table_t truetype_tables[] = {
@@ -654,17 +655,17 @@ static const table_t truetype_tables[] =
* Remapping composite glyphs will reference the sub glyphs the
* composite glyph is made up of. That needs to be done first so
* we have all the glyphs in the subset before going further. */
- { TT_TAG_glyf, cairo_truetype_font_write_glyf_table },
- { TT_TAG_cmap, cairo_truetype_font_write_cmap_table },
- { TT_TAG_cvt, cairo_truetype_font_write_generic_table },
- { TT_TAG_fpgm, cairo_truetype_font_write_generic_table },
- { TT_TAG_head, cairo_truetype_font_write_head_table },
- { TT_TAG_hhea, cairo_truetype_font_write_hhea_table },
- { TT_TAG_hmtx, cairo_truetype_font_write_hmtx_table },
- { TT_TAG_loca, cairo_truetype_font_write_loca_table },
- { TT_TAG_maxp, cairo_truetype_font_write_maxp_table },
- { TT_TAG_name, cairo_truetype_font_write_generic_table },
- { TT_TAG_prep, cairo_truetype_font_write_generic_table },
+ { TT_TAG_glyf, cairo_truetype_font_write_glyf_table, 3 },
+ { TT_TAG_cmap, cairo_truetype_font_write_cmap_table, 0 },
+ { TT_TAG_cvt, cairo_truetype_font_write_generic_table, 1 },
+ { TT_TAG_fpgm, cairo_truetype_font_write_generic_table, 2 },
+ { TT_TAG_head, cairo_truetype_font_write_head_table, 4 },
+ { TT_TAG_hhea, cairo_truetype_font_write_hhea_table, 5 },
+ { TT_TAG_hmtx, cairo_truetype_font_write_hmtx_table, 6 },
+ { TT_TAG_loca, cairo_truetype_font_write_loca_table, 7 },
+ { TT_TAG_maxp, cairo_truetype_font_write_maxp_table, 8 },
+ { TT_TAG_name, cairo_truetype_font_write_generic_table, 9 },
+ { TT_TAG_prep, cairo_truetype_font_write_generic_table, 10 },
};
static cairo_status_t
@@ -764,7 +765,7 @@ cairo_truetype_font_generate (cairo_true
end = _cairo_array_num_elements (&font->output);
next = cairo_truetype_font_align_output (font);
- cairo_truetype_font_update_entry (font, i, truetype_tables[i].tag,
+ cairo_truetype_font_update_entry (font, truetype_tables[i].pos, truetype_tables[i].tag,
start, end);
cairo_truetype_font_check_boundary (font, next);
start = next;
diff-tree 8b3176158351e62185294d512030c7af1ec4fabc (from 0bf5e18b14f2bbaf3be3b31c4eb54ea3183f488a)
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date: Sun Feb 4 16:22:12 2007 +1030
TrueType Subsetting: Correct the checksum calculation of 'head' table
Checksum field should be zero before calculating checksum.
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 8e38f2f..03fb346 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -532,6 +532,9 @@ cairo_truetype_font_write_head_table (ca
font->status = cairo_truetype_font_allocate_write_buffer (font, size, &buffer);
font->backend->load_truetype_table( font->scaled_font_subset->scaled_font,
tag, 0, buffer, &size);
+ /* set checkSumAdjustment to 0 for table checksum calcualtion */
+ *(uint32_t *)(buffer + 8) = 0;
+
return font->status;
}
diff-tree 0bf5e18b14f2bbaf3be3b31c4eb54ea3183f488a (from 2bd590b64987b7f0eb7310666ac20a8309e32842)
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date: Sun Feb 4 16:19:05 2007 +1030
TrueType Subsetting : Correct the checksum calculation
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 86509df..8e38f2f 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -716,7 +716,7 @@ cairo_truetype_font_calculate_checksum (
p = (uint32_t *) (data + start);
padded_end = (uint32_t *) (data + ((end + 3) & ~3));
while (p < padded_end)
- checksum += *p++;
+ checksum += be32_to_cpu(*p++);
return checksum;
}
More information about the cairo-commit
mailing list