[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] [Devel][Bug?] PFR fontmetrics; ascender, descender, height fix
From: |
Harri Smått |
Subject: |
[Devel] [Devel][Bug?] PFR fontmetrics; ascender, descender, height fix |
Date: |
Wed, 4 Aug 2004 12:27:50 +0300 |
Hello,
Found few possible minor bugs in PFR loading and fontmetrics calculations. Not
sure if my previous post about this got to mailing list, but here's patch I've
come up with.
Index: ./src/pfr/pfrobjs.c
===================================================================
RCS file: /cvs/freetype/freetype2/src/pfr/pfrobjs.c,v
retrieving revision 1.25
diff -u -r1.25 pfrobjs.c
--- pfrobjs.c 2004/05/08 07:00:23 1.25
+++ pfrobjs.c 2004/08/04 09:07:25
@@ -163,10 +163,10 @@
pfrface->bbox = phy_font->bbox;
pfrface->units_per_EM = (FT_UShort)phy_font->outline_resolution;
- pfrface->ascender = (FT_Short) phy_font->bbox.yMax;
- pfrface->descender = (FT_Short) phy_font->bbox.yMin;
+ pfrface->ascender = (FT_Short) phy_font->ascent;
+ pfrface->descender = (FT_Short) phy_font->descent;
pfrface->height = (FT_Short)(
- ( ( pfrface->ascender - pfrface->descender ) * 12 ) / 10 );
+ ( phy_font->ascent - phy_font->descent + phy_font->leading ) );
if ( phy_font->num_strikes > 0 )
{
Index: ./src/pfr/pfrload.c
===================================================================
RCS file: /cvs/freetype/freetype2/src/pfr/pfrload.c,v
retrieving revision 1.17
diff -u -r1.17 pfrload.c
--- pfrload.c 2003/12/24 01:10:45 1.17
+++ pfrload.c 2004/08/04 09:07:25
@@ -883,6 +883,9 @@
phy_font->bbox.yMax = PFR_NEXT_SHORT( p );
phy_font->flags = flags = PFR_NEXT_BYTE( p );
+ phy_font->ascent = phy_font->bbox.yMax;
+ phy_font->descent = phy_font->bbox.yMin;
+
/* get the standard advance for non-proprotional fonts */
if ( !(flags & PFR_PHY_PROPORTIONAL) )
{
@@ -943,14 +946,25 @@
break;
case 2:
+ /* http://www.mhp.org/documents//mhp_Ts101812.V1.3.1.pdf.zip
+ * (7.4 Downloadable fonts)
+ * at least ascent and descent seem to be in metrics resolution ->
+ * convert them to outline resolution
+ */
if ( q + 32 > q2 )
break;
q += 10;
- phy_font->ascent = PFR_NEXT_SHORT( q );
- phy_font->descent = PFR_NEXT_SHORT( q );
- phy_font->leading = PFR_NEXT_SHORT( q );
- q += 16;
+ phy_font->ascent = ( PFR_NEXT_SHORT( q )
+ * phy_font->outline_resolution
+ / phy_font->metrics_resolution );
+ phy_font->descent = -( PFR_NEXT_SHORT( q )
+ * phy_font->outline_resolution
+ / phy_font->metrics_resolution );
+ q += 4;
+ phy_font->leading = ( PFR_NEXT_SHORT( q )
+ * phy_font->outline_resolution
+ / phy_font->metrics_resolution );
break;
case 3:
--
harri
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Devel] [Devel][Bug?] PFR fontmetrics; ascender, descender, height fix,
Harri Smått <=