[gs-commits] mupdf/master - 0_7-148-g4df3543 - Stretch glyphs for substituted fonts when stroking the same as when filling.

Tor Andersson tor at ghostscript.com
Wed Mar 2 15:14:50 UTC 2011


commit 4df354398c16b02c5da2cef5b18eec8a5c152b0b
Author: Tor Andersson <tor at ghostscript.com>
Date:   Thu Feb 17 16:22:26 2011 +0000

    Stretch glyphs for substituted fonts when stroking the same as when filling.
    
    Ignore-this: feb3b9c8decadb717331fc38be201a5e
    
    darcs-hash:20110217162226-f546f-6c2e6c3722e4155a511180ad1151f90f9fc642e7.gz

 1 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/fitz/res_font.c b/fitz/res_font.c
index a30bbf8..1df8b2e 100644
--- a/fitz/res_font.c
+++ b/fitz/res_font.c
@@ -221,25 +221,19 @@ fz_newfontfrombuffer(fz_font **fontp, unsigned char *data, int len, int index)
 	return fz_okay;
 }
 
-fz_pixmap *
-fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
+static fz_matrix
+fz_adjustftglyphwidth(fz_font *font, int gid, fz_matrix trm)
 {
-	FT_Face face = font->ftface;
-	FT_Matrix m;
-	FT_Vector v;
-	FT_Error fterr;
-	fz_pixmap *glyph;
-	int y;
-
 	/* Fudge the font matrix to stretch the glyph if we've substituted the font. */
 	if (font->ftsubstitute && gid < font->widthcount)
 	{
+		FT_Error fterr;
 		int subw;
 		int realw;
 		float scale;
 
 		/* TODO: use FT_Get_Advance */
-		fterr = FT_Set_Char_Size(face, 1000, 1000, 72, 72);
+		fterr = FT_Set_Char_Size(font->ftface, 1000, 1000, 72, 72);
 		if (fterr)
 			fz_warn("freetype setting character size: %s", ft_errorstring(fterr));
 
@@ -255,9 +249,24 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
 		else
 			scale = 1;
 
-		trm = fz_concat(fz_scale(scale, 1), trm);
+		return fz_concat(fz_scale(scale, 1), trm);
 	}
 
+	return trm;
+}
+
+fz_pixmap *
+fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
+{
+	FT_Face face = font->ftface;
+	FT_Matrix m;
+	FT_Vector v;
+	FT_Error fterr;
+	fz_pixmap *glyph;
+	int y;
+
+	trm = fz_adjustftglyphwidth(font, gid, trm);
+
 	/*
 	Freetype mutilates complex glyphs if they are loaded
 	with FT_Set_Char_Size 1.0. it rounds the coordinates
@@ -354,6 +363,8 @@ fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz
 	fz_pixmap *pix;
 	int y;
 
+	trm = fz_adjustftglyphwidth(font, gid, trm);
+
 	m.xx = trm.a * 64; /* should be 65536 */
 	m.yx = trm.b * 64;
 	m.xy = trm.c * 64;

--
git/hooks/post-receive


More information about the gs-commits mailing list