From 183ee0af2fc16499a2114a0645938483a87f3690 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 11 Mar 2001 11:28:39 +0000 Subject: [PATCH] * TODO: Updated. * src/cid/cidload.c (parse_font_matrix): Added units_per_EM * src/type1/t1load.c (parse_font_bbox): Changed to use FT_Fixed --- ChangeLog | 16 ++++++++-------- TODO | 14 ++++++++------ include/freetype/freetype.h | 18 +++++++++--------- src/base/ftcalc.c | 7 ++++--- src/cid/cidload.c | 10 ++++++---- 5 files changed, 35 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba3599e82..528b6174b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,29 +1,29 @@ +2001-03-11 Werner Lemberg + + * TODO: Updated. + 2001-03-10 Tom Kacvinsky * TODO: New file. - + * include/freetype/freetype.h: Added prototypes and notes for three new functions: FT_RoundFix, FT_CeilFix, and FT_FloorFix. - * src/base/ftcalc.c (FT_RoundFix, FT_CeilFix, FT_FloorFix): Added implementation code. * src/cid/cidobjs.c (CID_Init_Face): Use calculated units_per_EM, and if that is not available, default to 1000 units per EM. Changed assignment code for ascender and descender values. - - * src/cid/cidload.c (parse_font_matrix): Added units_per_EM + * src/cid/cidload.c (parse_font_matrix): Added units_per_EM processing. - (parse_font_bbox): Changed to use FT_Fixed number handling. * src/type1/t1objs.c (T1_Init_Face): Changed the assignment code for ascender, descender, and max_advance_width. - - * src/type1/t1load.c (parse_font_bbox): Changed to use FT_Fixed + * src/type1/t1load.c (parse_font_bbox): Changed to use FT_Fixed number handling. -2001-03-10 Henrik Grubbström +2001-03-10 Henrik Grubbström * src/*/*.c: Added many casts to make code more 64bit-safe. diff --git a/TODO b/TODO index cfb599d2b..8849e6c13 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,12 @@ Here is a list of items that need to be addressed in FreeType 2: -* Add synthesized Unicode charmap processing to the CFF driver. +* Add synthesized Unicode charmap processing to the CFF driver. -* Investigate usage of casts and bit width of integer types used. The idea is -to typedef FT_Fixed, FT_Long, FT_Int, etc... to use the appropriate built in -integer types. This is so that we may avoid unnecessary explict typecasts and -side affects inherent in implict casts. This is mostly an issue on platforms -where long integers are 64 bits wide (instead of 32 bits wide). +* Investigate usage of casts and bit width of integer types used. The idea is + to typedef FT_Fixed, FT_Long, FT_Int, etc. to use the appropriate built in + integer types. This is so that we may avoid unnecessary explict typecasts + and side affects inherent in implict casts. This is mostly an issue on + platforms where long integers are 64 bits wide (instead of 32 bits wide). +* Fix exact bbox calculation. The current code uses an iterative algorithm + which can fail miserably. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 1d075907e..0e72a1a05 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2331,7 +2331,7 @@ FT_BEGIN_HEADER /* FT_RoundFix */ /* */ /* */ - /* A very simple function used to round a 16.16 fixed number */ + /* A very simple function used to round a 16.16 fixed number. */ /* */ /* */ /* a :: The number to be rounded. */ @@ -2340,10 +2340,10 @@ FT_BEGIN_HEADER /* The result of `(a + 0x8000) & -0x10000'. */ /* */ /* */ - /* This function assumes that the target platform supports 32 bit */ + /* This function assumes that the target platform supports 32-bit */ /* signed integers. */ /* */ - FT_EXPORT( FT_Fixed ) FT_RoundFix( FT_Fixed a ); + FT_EXPORT( FT_Fixed ) FT_RoundFix( FT_Fixed a ); /*************************************************************************/ @@ -2353,7 +2353,7 @@ FT_BEGIN_HEADER /* */ /* */ /* A very simple function used to compute the ceiling function of a */ - /* 16.16 fixed number */ + /* 16.16 fixed number. */ /* */ /* */ /* a :: The number for which the ceiling function is to be computed. */ @@ -2362,10 +2362,10 @@ FT_BEGIN_HEADER /* The result of `(a + 0x10000 - 1) & -0x10000'. */ /* */ /* */ - /* This function assumes that the target platform supports 32 bit */ + /* This function assumes that the target platform supports 32-bit */ /* signed integers. */ /* */ - FT_EXPORT( FT_Fixed ) FT_CeilFix( FT_Fixed a ); + FT_EXPORT( FT_Fixed ) FT_CeilFix( FT_Fixed a ); /*************************************************************************/ @@ -2375,7 +2375,7 @@ FT_BEGIN_HEADER /* */ /* */ /* A very simple function used to compute the floor function of a */ - /* 16.16 fixed number */ + /* 16.16 fixed number. */ /* */ /* */ /* a :: The number for which the floor function is to be computed. */ @@ -2384,10 +2384,10 @@ FT_BEGIN_HEADER /* The result of `a & -0x10000'. */ /* */ /* */ - /* This function assumes that the target platform supports 32 bit */ + /* This function assumes that the target platform supports 32-bit */ /* signed integers. */ /* */ - FT_EXPORT( FT_Fixed ) FT_FloorFix( FT_Fixed a ); + FT_EXPORT( FT_Fixed ) FT_FloorFix( FT_Fixed a ); /*************************************************************************/ diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index d67a96aa7..ec7202ad0 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -47,12 +47,13 @@ #undef FT_COMPONENT #define FT_COMPONENT trace_calc + /* The following three functions are available regardless of whether */ /* FT_LONG64 or FT_CONFIG_OPTION_OLD_CALCS is defined. */ /* documentation is in freetype.h */ - FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) + FT_EXPORT_DEF( FT_Fixed ) FT_RoundFix( FT_Fixed a ) { return( ( a + 0x8000L ) & -0x10000L ); } @@ -60,7 +61,7 @@ /* documentation is in freetype.h */ - FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) + FT_EXPORT_DEF( FT_Fixed ) FT_CeilFix( FT_Fixed a ) { return( ( a + 0x10000L - 1 ) & -0x10000L ); } @@ -68,7 +69,7 @@ /* documentation is in freetype.h */ - FT_EXPORT_DEF( FT_Fixed ) FT_FloorFix( FT_Fixed a ) + FT_EXPORT_DEF( FT_Fixed ) FT_FloorFix( FT_Fixed a ) { return( a & -0x10000L ); } diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 5fa4c6114..a372a99b9 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -186,6 +186,7 @@ FT_Fixed temp[6]; FT_Fixed temp_scale; + if ( parser->num_dict >= 0 ) { dict = face->cid.font_dicts + parser->num_dict; @@ -196,10 +197,11 @@ temp_scale = ABS( temp[3] ); - /* Set Units per EM based on FontMatrix values. We set the value to */ - /* 1000 / temp_scale, because temp_scale was already multiplied by */ - /* 1000 (in t1_tofixed, from psobjs.c). */ - root->units_per_EM = FT_DivFix( 0x10000L, FT_DivFix( temp_scale, 1000 ) ); + /* Set Units per EM based on FontMatrix values. We set the value to */ + /* `1000/temp_scale', because temp_scale was already multiplied by */ + /* 1000 (in t1_tofixed(), from psobjs.c). */ + root->units_per_EM = FT_DivFix( 0x10000L, + FT_DivFix( temp_scale, 1000 ) ); /* we need to scale the values by 1.0/temp[3] */ if ( temp_scale != 0x10000L )