[cff] Fix Savannah bug #36705.

Handle numbers like 2.001 correctly.

* src/cff/cffparse.c (cff_parse_real): Avoid negative values for
`shift'.
This commit is contained in:
Werner Lemberg 2012-06-25 10:58:20 +02:00
parent 79e36baebb
commit 56751532d3
2 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,12 @@
2012-06-25 Werner Lemberg <wl@gnu.org>
[cff] Fix Savannah bug #36705.
Handle numbers like 2.001 correctly.
* src/cff/cffparse.c (cff_parse_real): Avoid negative values for
`shift'.
2012-06-18 Infinality <infinality@infinality.net>
[truetype] Support subpixel hinting.

View File

@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (body) */
/* */
/* Copyright 1996-2004, 2007-2011 by */
/* Copyright 1996-2004, 2007-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -286,9 +286,11 @@
/* Make `scaling' as small as possible. */
new_fraction_length = FT_MIN( exponent, 5 );
exponent -= new_fraction_length;
shift = new_fraction_length - fraction_length;
if ( shift > 0 )
{
exponent -= new_fraction_length;
number *= power_tens[shift];
if ( number > 0x7FFFL )
{
@ -298,6 +300,9 @@
}
else
exponent -= fraction_length;
}
else
exponent -= fraction_length;
result = number << 16;
*scaling = exponent;