* src/base/ftobjs.c (FT_Get_Kerning): Make kerning amount dependent on ppem by scaling down for ppem < 25, then do normal rounding. This gives slightly better results than rounding towards zero.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/ChangeLog b/ChangeLog
index a247f87..5274c64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-12-11 Robert Clark <freetype@ratty.org.uk>
+
+ * src/base/ftobjs.c (FT_Get_Kerning): Make kerning amount
+ dependent on ppem by scaling down for ppem < 25, then do normal
+ rounding. This gives slightly better results than rounding towards
+ zero.
+
2004-12-09 Werner Lemberg <wl@gnu.org>
* src/base/ftobjs.c (FT_Get_Kerning): Always round towards zero
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 31a7bff..58b0711 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2137,10 +2137,18 @@
if ( kern_mode != FT_KERNING_UNFITTED )
{
- akerning->x = akerning->x > 0 ? FT_PIX_FLOOR( akerning->x )
- : FT_PIX_CEIL( akerning->x );
- akerning->y = akerning->y > 0 ? FT_PIX_FLOOR( akerning->y )
- : FT_PIX_CEIL( akerning->y );
+ /* we scale down kerning values for small ppem values */
+ /* to avoid that rounding makes them too big. */
+ /* `25' has been determined heuristically. */
+ if ( face->size->metrics.x_ppem < 25 )
+ akerning->x = FT_MulDiv( akerning->x,
+ face->size->metrics.x_ppem, 25 );
+ if ( face->size->metrics.y_ppem < 25 )
+ akerning->y = FT_MulDiv( akerning->y,
+ face->size->metrics.y_ppem, 25 );
+
+ akerning->x = FT_PIX_ROUND( akerning->x );
+ akerning->y = FT_PIX_ROUND( akerning->y );
}
}
}
diff --git a/src/otvalid/otvcommn.h b/src/otvalid/otvcommn.h
index fa93e5a..4c78d3f 100644
--- a/src/otvalid/otvcommn.h
+++ b/src/otvalid/otvcommn.h
@@ -67,7 +67,7 @@ FT_BEGIN_HEADER
#undef FT_INVALID_
-#define FT_INVALID_( _prefix, _error ) \
+#define FT_INVALID_( _prefix, _error ) \
ft_validator_error( valid->root, _prefix ## _error )
#define OTV_OPTIONAL_TABLE( _table ) FT_UInt _table; \
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index cff40e5..ea48bde 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -1436,7 +1436,7 @@
error = face->goto_table( face, TTAG_EBDT, stream, 0 );
if ( error )
error = face->goto_table( face, TTAG_bdat, stream, 0 );
- if (error)
+ if ( error )
goto Exit;
ebdt_pos = FT_STREAM_POS();