freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] [PATCH] Fix FT_Get_PFR_Advance()


From: Jon Foster
Subject: [ft-devel] [PATCH] Fix FT_Get_PFR_Advance()
Date: Wed, 16 Jul 2008 16:33:24 +0100

Hi,

FT_Get_PFR_Advance() seems to expect a 0-based glyph index, but the rest
of
Freetype deals with 1-based glyph indexes.  As a result, calling this
function with the highest legal glyph index will fail.  Calling it with
other values will presumably give the wrong result.

The following patch fixes the problem.  This is against Freetype 2.3.5,
but
the code appears to be unchanged in today's CVS.  I have verified that
with
this change, FT_Get_PFR_Advance() produces the same result as our old
proprietary method of extracting this data.

Kind regards,

Jon Foster

diff -u -p -r1.2 pfrdrivr.c
--- src/pfr/pfrdrivr.c  13 May 2008 16:09:27 -0000      1.2
+++ src/pfr/pfrdrivr.c  16 Jul 2008 15:08:25 -0000
@@ -75,9 +75,9 @@
       PFR_PhyFont  phys = &face->phy_font;


-      if ( gindex < phys->num_chars )
+      if ( gindex != 0 && gindex <= phys->num_chars )
       {
-        *anadvance = phys->chars[gindex].advance;
+        *anadvance = phys->chars[gindex - 1].advance;
         error = 0;
       }
     }



**********************************************************************
This email and its attachments may be confidential and are intended solely for 
the use of the individual to whom it is addressed. Any views or opinions 
expressed are solely those of the author and do not necessarily represent those 
of Cabot Communications Ltd.

If you are not the intended recipient of this email and its attachments, you 
must take no action based upon them, nor must you copy or show them to anyone.

Cabot Communications Limited
Verona House, Filwood Road, Bristol BS16 3RY, UK
+44 (0) 1179584232

Co. Registered in England number 02817269

Please contact the sender if you believe you have received this email in error.

**********************************************************************


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________




reply via email to

[Prev in Thread] Current Thread [Next in Thread]