[poppler] poppler/CairoFontEngine.cc
Adrian Johnson
ajohnson at kemper.freedesktop.org
Sun Apr 8 03:19:15 PDT 2012
poppler/CairoFontEngine.cc | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
New commits:
commit f1e621adbbb74ec709022b2a31195331651c83fa
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Sun Apr 8 19:42:05 2012 +0930
cairo: use correct userfont font bbox
cairo 1.12 started clipping text to the font bbox
Bug 48399
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 7d15024..5f35d2f 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -570,6 +570,29 @@ _free_type3_font_info(void *closure)
}
static cairo_status_t
+_init_type3_glyph (cairo_scaled_font_t *scaled_font,
+ cairo_t *cr,
+ cairo_font_extents_t *extents)
+{
+ type3_font_info_t *info;
+ GfxFont *font;
+ double *mat;
+
+ info = (type3_font_info_t *)
+ cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font),
+ &type3_font_key);
+ font = info->font;
+ mat = font->getFontBBox();
+ extents->ascent = mat[3]; /* y2 */
+ extents->descent = -mat[3]; /* -y1 */
+ extents->height = extents->ascent + extents->descent;
+ extents->max_x_advance = mat[2] - mat[1]; /* x2 - x1 */
+ extents->max_y_advance = 0;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
_render_type3_glyph (cairo_scaled_font_t *scaled_font,
unsigned long glyph,
cairo_t *cr,
@@ -667,6 +690,7 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc,
info = (type3_font_info_t *) malloc(sizeof(*info));
ref = *gfxFont->getID();
font_face = cairo_user_font_face_create();
+ cairo_user_font_face_set_init_func (font_face, _init_type3_glyph);
cairo_user_font_face_set_render_glyph_func (font_face, _render_type3_glyph);
gfxFont->incRefCnt();
info->font = gfxFont;
More information about the poppler
mailing list