summaryrefslogtreecommitdiff
path: root/src/cairo-type1-fallback.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2010-05-12 23:12:55 +0930
committerAdrian Johnson <ajohnson@redneon.com>2010-05-16 20:52:31 +0930
commitedcefa87ed0a8ff59b54ef9251182ce68f9158ba (patch)
treebefb80cd0997e00854726a78b89c0db3b675f093 /src/cairo-type1-fallback.c
parent34fd094b3be54138c20ea5c4aab1d9597d056f35 (diff)
type1: Use correct glyph advance when subsetting type 1 fonts
Previously the glyph advance in font units was used for the widths in the PDF font dictionary. This only works for Type 1 fonts that use a [0.001 0 0 0.001 0 0] font matrix. https://bugs.freedesktop.org/show_bug.cgi?id=28061
Diffstat (limited to 'src/cairo-type1-fallback.c')
-rw-r--r--src/cairo-type1-fallback.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
index 7894f7ed8..b93c42348 100644
--- a/src/cairo-type1-fallback.c
+++ b/src/cairo-type1-fallback.c
@@ -727,20 +727,20 @@ _cairo_type1_fallback_init_internal (cairo_type1_subset_t *type1_subset,
goto fail1;
}
- type1_subset->widths = calloc (sizeof (int), font->scaled_font_subset->num_glyphs);
+ type1_subset->widths = calloc (sizeof (double), font->scaled_font_subset->num_glyphs);
if (unlikely (type1_subset->widths == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail2;
}
for (i = 0; i < font->scaled_font_subset->num_glyphs; i++)
- type1_subset->widths[i] = font->widths[i];
-
- type1_subset->x_min = (int) font->x_min;
- type1_subset->y_min = (int) font->y_min;
- type1_subset->x_max = (int) font->x_max;
- type1_subset->y_max = (int) font->y_max;
- type1_subset->ascent = (int) font->y_max;
- type1_subset->descent = (int) font->y_min;
+ type1_subset->widths[i] = (double)font->widths[i]/1000;
+
+ type1_subset->x_min = (double)font->x_min/1000;
+ type1_subset->y_min = (double)font->y_min/1000;
+ type1_subset->x_max = (double)font->x_max/1000;
+ type1_subset->y_max = (double)font->y_max/1000;
+ type1_subset->ascent = (double)font->y_max/1000;
+ type1_subset->descent = (double)font->y_min/1000;
length = font->header_size + font->data_size +
font->trailer_size;