[cairo-commit] src/cairo-type1-subset.c
Adrian Johnson
ajohnson at kemper.freedesktop.org
Sat Oct 23 18:08:03 PDT 2010
src/cairo-type1-subset.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
New commits:
commit 6dc0b19adb6da690ad5944623081b9cdb42de066
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Sun Oct 24 11:32:41 2010 +1030
Type 1 subset: Fix glyph advance
https://bugs.freedesktop.org/show_bug.cgi?id=31062
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 45e6e47..8042c0a 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -69,8 +69,8 @@ typedef struct _cairo_type1_font_subset {
unsigned int font_id;
char *base_font;
unsigned int num_glyphs;
- long x_min, y_min, x_max, y_max;
- long ascent, descent;
+ double x_min, y_min, x_max, y_max;
+ double ascent, descent;
const char *data;
unsigned long header_size;
@@ -148,12 +148,12 @@ _cairo_type1_font_subset_init (cairo_type1_font_subset_t *font,
font->scaled_font_subset = scaled_font_subset;
font->base.unscaled_font = _cairo_unscaled_font_reference (unscaled_font);
font->base.num_glyphs = face->num_glyphs;
- font->base.x_min = face->bbox.xMin;
- font->base.y_min = face->bbox.yMin;
- font->base.x_max = face->bbox.xMax;
- font->base.y_max = face->bbox.yMax;
- font->base.ascent = face->ascender;
- font->base.descent = face->descender;
+ font->base.x_min = face->bbox.xMin / (double)face->units_per_EM;
+ font->base.y_min = face->bbox.yMin / (double)face->units_per_EM;
+ font->base.x_max = face->bbox.xMax / (double)face->units_per_EM;
+ font->base.y_max = face->bbox.yMax / (double)face->units_per_EM;
+ font->base.ascent = face->ascender / (double)face->units_per_EM;
+ font->base.descent = face->descender / (double)face->units_per_EM;
if (face->family_name) {
font->base.base_font = strdup (face->family_name);
@@ -582,7 +582,7 @@ cairo_type1_font_subset_get_glyph_names_and_widths (cairo_type1_font_subset_t *f
return CAIRO_INT_STATUS_UNSUPPORTED;
}
- font->glyphs[i].width = font->face->glyph->linearHoriAdvance / 65536.0; /* 16.16 format */
+ font->glyphs[i].width = font->face->glyph->metrics.horiAdvance / (double)font->face->units_per_EM;
error = FT_Get_Glyph_Name(font->face, i, buffer, sizeof buffer);
if (error != FT_Err_Ok) {
@@ -1465,12 +1465,12 @@ _cairo_type1_subset_init (cairo_type1_subset_t *type1_subset,
font.glyphs[i].width;
}
- type1_subset->x_min = font.base.x_min/1000.0;
- type1_subset->y_min = font.base.y_min/1000.0;
- type1_subset->x_max = font.base.x_max/1000.0;
- type1_subset->y_max = font.base.y_max/1000.0;
- type1_subset->ascent = font.base.ascent/1000.0;
- type1_subset->descent = font.base.descent/1000.0;
+ type1_subset->x_min = font.base.x_min;
+ type1_subset->y_min = font.base.y_min;
+ type1_subset->x_max = font.base.x_max;
+ type1_subset->y_max = font.base.y_max;
+ type1_subset->ascent = font.base.ascent;
+ type1_subset->descent = font.base.descent;
length = font.base.header_size +
font.base.data_size +
More information about the cairo-commit
mailing list