* src/pfr/pfrdrivr.c (pfr_get_advance): Fix off-by-one error.

* src/base/ftcalc.c (FT_MulFix): Fix portability issue.

* src/sfnt/ttpost.c (MAC_NAME) [!FT_CONFIG_OPTION_POSTSCRIPT_NAMES]:
Fix compiler warning.
This commit is contained in:
Werner Lemberg 2008-07-16 21:03:40 +00:00
parent bd48d35bf8
commit 50997cd742
4 changed files with 45 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2008-07-16 Jon Foster <Jon.Foster@cabot.co.uk>
* src/pfr/pfrdrivr.c (pfr_get_advance): Fix off-by-one error.
* src/base/ftcalc.c (FT_MulFix): Fix portability issue.
* src/sfnt/ttpost.c (MAC_NAME) [!FT_CONFIG_OPTION_POSTSCRIPT_NAMES]:
Fix compiler warning.
2008-07-16 Werner Lemberg <wl@gnu.org>
Handle CID-keyed fonts wrapped in a SFNT (with cmaps) correctly.

View File

@ -437,7 +437,14 @@
);
return result;
#elif 1
#elif 0
/*
* This code is nonportable. See comment below.
*
* However, on a platform where right-shift of a signed quantity fills
* the leftmost bits by copying the sign bit, it might be faster.
*/
FT_Long sa, sb;
FT_ULong ua, ub;
@ -446,6 +453,24 @@
if ( a == 0 || b == 0x10000L )
return a;
/*
* This is a clever way of converting a signed number `a' into its
* absolute value (stored back into `a') and its sign. The sign is
* stored in `sa'; 0 means `a' was positive or zero, and -1 means `a'
* was negative. (Similarly for `b' and `sb').
*
* Unfortunately, it doesn't work (at least not portably).
*
* It makes the assumption that right-shift on a negative signed value
* fills the leftmost bits by copying the sign bit. This is wrong.
* According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206,
* the result of right-shift of a negative signed value is
* implementation-defined. At least one implementation fills the
* leftmost bits with 0s (i.e., it is exactly the same as an unsigned
* right shift). This means that when `a' is negative, `sa' ends up
* with the value 1 rather than -1. After that, everything else goes
* wrong.
*/
sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
a = ( a ^ sa ) - sa;
sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );

View File

@ -4,7 +4,7 @@
/* */
/* FreeType PFR driver interface (body). */
/* */
/* Copyright 2002, 2003, 2004, 2006 by */
/* Copyright 2002, 2003, 2004, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -70,6 +70,12 @@
*anadvance = 0;
if ( !gindex )
goto Exit;
gindex--;
if ( face )
{
PFR_PhyFont phys = &face->phy_font;
@ -82,6 +88,7 @@
}
}
Exit:
return error;
}

View File

@ -5,7 +5,7 @@
/* Postcript name table processing for TrueType and OpenType fonts */
/* (body). */
/* */
/* Copyright 1996-2001, 2002, 2003, 2006, 2007 by */
/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -62,7 +62,7 @@
/* table of Mac names. Thus, it is possible to build a version of */
/* FreeType without the Type 1 driver & PSNames module. */
#define MAC_NAME( x ) tt_post_default_names[x]
#define MAC_NAME( x ) ( (FT_String*)tt_post_default_names[x] )
/* the 258 default Mac PS glyph names */