From deadbb53d26f9a9e0a24a66bf1b74a5370f629b4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 13 Apr 2004 21:08:17 +0000 Subject: [PATCH] * include/freetype/config/ftconfig.h: Use CHAR_BIT to define size of FT_SIZEOF_xxx. * include/freetype/internal/sfnt.h (TT_Find_SBit_Image_Func, TT_Load_SBit_Metrics_Func): New typedefs. (SFNT_Interface): Add find_sbit_image and load_sbit_metrics. * src/sfnt/sfdriver.c (sfnt_interface): Updated. * src/sfnt/ttsbit.h (tt_find_sbit_image, tt_load_sbit_metrics): New declarations. * src/sfnt/ttsbit.c (find_sbit_image): Renamed to... (tt_find_sbit_image): This. Updated all callers. (load_sbit_metrics): Renamed to... (tt_load_sbit_metrics): This. Updated all callers. --- ChangeLog | 21 +++++++++ include/freetype/config/ftconfig.h | 28 +++++++---- include/freetype/freetype.h | 2 +- include/freetype/ftimage.h | 4 +- include/freetype/internal/sfnt.h | 74 +++++++++++++++++++++++++++++- src/sfnt/sfdriver.c | 8 +++- src/sfnt/ttsbit.c | 32 ++++++------- src/sfnt/ttsbit.h | 15 +++++- 8 files changed, 151 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12654d66b..b4f5ab70b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2004-04-13 Werner Lemberg + + * include/freetype/config/ftconfig.h: Use CHAR_BIT to define + size of FT_SIZEOF_xxx. + +2004-04-12 Chisato Yamauchi + + * include/freetype/internal/sfnt.h (TT_Find_SBit_Image_Func, + TT_Load_SBit_Metrics_Func): New typedefs. + (SFNT_Interface): Add find_sbit_image and load_sbit_metrics. + + * src/sfnt/sfdriver.c (sfnt_interface): Updated. + * src/sfnt/ttsbit.h (tt_find_sbit_image, tt_load_sbit_metrics): New + declarations. + * src/sfnt/ttsbit.c (find_sbit_image): Renamed to... + (tt_find_sbit_image): This. + Updated all callers. + (load_sbit_metrics): Renamed to... + (tt_load_sbit_metrics): This. + Updated all callers. + 2004-04-12 Werner Lemberg * configure: Accept makepp also. diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index d23b73e39..e7a4a22e6 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -58,24 +58,32 @@ FT_BEGIN_HEADER /*************************************************************************/ - /* The number of bytes in an `int' type. */ + /* There are systems (like the Texas Instruments 'C54x) where a `char' */ + /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ + /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ + /* is probably unexpected. */ + /* */ + /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ + /* `char' type. */ + + /* The size of an `int' type. */ #if FT_UINT_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_INT 4 +#define FT_SIZEOF_INT (32 / CHAR_BIT) #elif FT_UINT_MAX == 0xFFFFU -#define FT_SIZEOF_INT 2 +#define FT_SIZEOF_INT (16 / CHAR_BIT) #elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU -#define FT_SIZEOF_INT 8 +#define FT_SIZEOF_INT (64 / CHAR_BIT) #else -#error "Unsupported number of bytes in `int' type!" +#error "Unsupported size of `int' type!" #endif - /* The number of bytes in a `long' type. */ + /* The size of a `long' type. */ #if FT_ULONG_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_LONG 4 +#define FT_SIZEOF_LONG (32 / CHAR_BIT) #elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU -#define FT_SIZEOF_LONG 8 +#define FT_SIZEOF_LONG (64 / CHAR_BIT) #else -#error "Unsupported number of bytes in `long' type!" +#error "Unsupported size of `long' type!" #endif diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 483763738..6acf16611 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -469,7 +469,7 @@ FT_BEGIN_HEADER /* should redefine this macro in case of problems to something like */ /* this: */ /* */ - /* #define FT_ENC_TAG( value, a, b, c, d ) (value) */ + /* #define FT_ENC_TAG( value, a, b, c, d ) value */ /* */ /* to get a simple enumeration without assigning special numbers. */ /* */ diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 287596507..4682a4cad 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -5,7 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -657,7 +657,7 @@ FT_BEGIN_HEADER /* should redefine this macro in case of problems to something like */ /* this: */ /* */ - /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) (value) */ + /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ /* */ /* to get a simple enumeration without assigning special numbers. */ /* */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index 2a9a645db..9a23b1f82 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -240,6 +240,76 @@ FT_BEGIN_HEADER FT_ULong* length ); + /*************************************************************************/ + /* */ + /* */ + /* TT_Find_SBit_Image_Func */ + /* */ + /* */ + /* Checks whether an embedded bitmap (an `sbit') exists for a given */ + /* glyph, at a given strike. */ + /* */ + /* */ + /* face :: The target face object. */ + /* */ + /* glyph_index :: The glyph index. */ + /* */ + /* strike_index :: The current strike index. */ + /* */ + /* */ + /* arange :: The SBit range containing the glyph index. */ + /* */ + /* astrike :: The SBit strike containing the glyph index. */ + /* */ + /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ + /* */ + /* */ + /* FreeType error code. 0 means success. Returns */ + /* SFNT_Err_Invalid_Argument if no sbit exists for the requested */ + /* glyph. */ + /* */ + typedef FT_Error + (*TT_Find_SBit_Image_Func)( TT_Face face, + FT_UInt glyph_index, + FT_ULong strike_index, + TT_SBit_Range *arange, + TT_SBit_Strike *astrike, + FT_ULong *aglyph_offset ); + + + /*************************************************************************/ + /* */ + /* */ + /* TT_Load_SBit_Metrics_Func */ + /* */ + /* */ + /* Gets the big metrics for a given embedded bitmap. */ + /* */ + /* */ + /* stream :: The input stream. */ + /* */ + /* range :: The SBit range containing the glyph. */ + /* */ + /* */ + /* big_metrics :: A big SBit metrics structure for the glyph. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + /* */ + /* The stream cursor must be positioned at the glyph's offset within */ + /* the `EBDT' table before the call. */ + /* */ + /* If the image format uses variable metrics, the stream cursor is */ + /* positioned just after the metrics header in the `EBDT' table on */ + /* function exit. */ + /* */ + typedef FT_Error + (*TT_Load_SBit_Metrics_Func)( FT_Stream stream, + TT_SBit_Range range, + TT_SBit_Metrics metrics ); + + /*************************************************************************/ /* */ /* */ @@ -459,6 +529,8 @@ FT_BEGIN_HEADER /* see `ttsbit.h' */ TT_Set_SBit_Strike_Func set_sbit_strike; TT_Load_Table_Func load_sbits; + TT_Find_SBit_Image_Func find_sbit_image; + TT_Load_SBit_Metrics_Func load_sbit_metrics; TT_Load_SBit_Image_Func load_sbit_image; TT_Free_Table_Func free_sbits; diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index c2bf948c7..7da53d2f1 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -343,9 +343,11 @@ /* see `ttload.h' */ tt_face_load_bitmap_header, - /* see `ttsbit.h' */ + /* see `ttsbit.h' and `sfnt.h' */ tt_face_set_sbit_strike, tt_face_load_sbit_strikes, + tt_find_sbit_image, + tt_load_sbit_metrics, tt_face_load_sbit_image, tt_face_free_sbit_strikes, @@ -354,6 +356,8 @@ 0, 0, 0, + 0, + 0, 0, 0, diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index bb6f227a7..444c27acc 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -754,7 +754,7 @@ /*************************************************************************/ /* */ /* */ - /* find_sbit_image */ + /* tt_find_sbit_image */ /* */ /* */ /* Checks whether an embedded bitmap (an `sbit') exists for a given */ @@ -779,13 +779,13 @@ /* SFNT_Err_Invalid_Argument if no sbit exists for the requested */ /* glyph. */ /* */ - static FT_Error - find_sbit_image( TT_Face face, - FT_UInt glyph_index, - FT_ULong strike_index, - TT_SBit_Range *arange, - TT_SBit_Strike *astrike, - FT_ULong *aglyph_offset ) + FT_LOCAL( FT_Error ) + tt_find_sbit_image( TT_Face face, + FT_UInt glyph_index, + FT_ULong strike_index, + TT_SBit_Range *arange, + TT_SBit_Strike *astrike, + FT_ULong *aglyph_offset ) { FT_Error error; TT_SBit_Strike strike; @@ -819,7 +819,7 @@ /*************************************************************************/ /* */ /* */ - /* load_sbit_metrics */ + /* tt_load_sbit_metrics */ /* */ /* */ /* Gets the big metrics for a given SBit. */ @@ -843,10 +843,10 @@ /* positioned just after the metrics header in the `EBDT' table on */ /* function exit. */ /* */ - static FT_Error - load_sbit_metrics( FT_Stream stream, - TT_SBit_Range range, - TT_SBit_Metrics metrics ) + FT_LOCAL( FT_Error ) + tt_load_sbit_metrics( FT_Stream stream, + TT_SBit_Range range, + TT_SBit_Metrics metrics ) { FT_Error error = SFNT_Err_Ok; @@ -1228,7 +1228,7 @@ if ( FT_STREAM_SEEK( ebdt_pos + glyph_offset ) ) goto Exit; - error = load_sbit_metrics( stream, range, metrics ); + error = tt_load_sbit_metrics( stream, range, metrics ); if ( error ) goto Exit; @@ -1419,8 +1419,8 @@ /* Check whether there is a glyph sbit for the current index */ - error = find_sbit_image( face, glyph_index, strike_index, - &range, &strike, &glyph_offset ); + error = tt_find_sbit_image( face, glyph_index, strike_index, + &range, &strike, &glyph_offset ); if ( error ) goto Exit; diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h index 89499bbb8..f1b63b7ec 100644 --- a/src/sfnt/ttsbit.h +++ b/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -41,6 +41,19 @@ FT_BEGIN_HEADER FT_UInt y_ppem, FT_ULong *astrike_index ); + FT_LOCAL( FT_Error ) + tt_find_sbit_image( TT_Face face, + FT_UInt glyph_index, + FT_ULong strike_index, + TT_SBit_Range *arange, + TT_SBit_Strike *astrike, + FT_ULong *aglyph_offset ); + + FT_LOCAL( FT_Error ) + tt_load_sbit_metrics( FT_Stream stream, + TT_SBit_Range range, + TT_SBit_Metrics metrics ); + FT_LOCAL( FT_Error ) tt_face_load_sbit_image( TT_Face face, FT_ULong strike_index,