[cff] Fix Savannah bug #36705.

Handle numbers like 2.001 correctly.

* src/cff/cffparse.c (cff_parse_real): Avoid negative values for
`shift'.
2.6.5
Werner Lemberg 13 years ago
parent 79e36baebb
commit 56751532d3
  1. 9
      ChangeLog
  2. 17
      src/cff/cffparse.c

@ -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.

@ -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,15 +286,20 @@
/* Make `scaling' as small as possible. */
new_fraction_length = FT_MIN( exponent, 5 );
exponent -= new_fraction_length;
shift = new_fraction_length - fraction_length;
number *= power_tens[shift];
if ( number > 0x7FFFL )
if ( shift > 0 )
{
number /= 10;
exponent += 1;
exponent -= new_fraction_length;
number *= power_tens[shift];
if ( number > 0x7FFFL )
{
number /= 10;
exponent += 1;
}
}
else
exponent -= fraction_length;
}
else
exponent -= fraction_length;

Loading…
Cancel
Save