diff --git a/ChangeLog b/ChangeLog index 0da6e75fb..eb9ca94b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2003-06-16 Werner Lemberg + + * include/freetype/freetype.h (FT_Open_Flags): Replaced with + #defines for the constants. + (FT_Open_Args): Change type of `flags' to FT_UInt. + (FT_GlyphSlot): Move `flags' to FT_Slot_Internal. + + * include/freetype/ftimage.h (FT_Outline_Flags, FT_Raster_Flag): + Replaced with #defines for the constants. + + * include/freetype/internal/ftobjs.h (FT_Slot_Internal): New + field `flags' (from FT_GlyphSlot). + Updated all affected source files. + (FT_GLYPH_OWN_BITMAP): New macro (from ftgloadr.h). + + * include/freetype/internal/ftgloadr.h (FT_GLYPH_OWN_BITMAP): Moved + to ftobjs.h. + + * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Use dummy + FT_GlyphSlot_Internal object. + 2003-06-15 Werner Lemberg * builds/compiler/gcc.mk, builds/compiler/gcc-dev.mk (CFLAGS): @@ -2339,7 +2360,7 @@ interface is hidden in an internal part of the face record, and all the definitions are in ftincrem.h. - * include/freetype/freeetype.h [FT_CONFIG_OPTION_INCREMENTAL]: + * include/freetype/freetype.h [FT_CONFIG_OPTION_INCREMENTAL]: Removed. * include/freetype/internal/ftobjs.h [FT_CONFIG_OPTION_INCREMENTAL]: Include FT_INCREMENTAL_H. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index b13adb78d..52faf1707 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -113,7 +113,6 @@ FT_BEGIN_HEADER /* FT_New_Memory_Face */ /* FT_Open_Face */ /* FT_Open_Args */ - /* FT_Open_Flags */ /* FT_Parameter */ /* FT_Attach_File */ /* FT_Attach_Stream */ @@ -126,6 +125,12 @@ FT_BEGIN_HEADER /* FT_Get_Name_Index */ /* FT_Load_Char */ /* */ + /* FT_OPEN_MEMORY */ + /* FT_OPEN_STREAM */ + /* FT_OPEN_PATHNAME */ + /* FT_OPEN_DRIVER */ + /* FT_OPEN_PARAMS */ + /* */ /* FT_LOAD_DEFAULT */ /* FT_LOAD_RENDER */ /* FT_LOAD_MONOCHROME */ @@ -1360,7 +1365,6 @@ FT_BEGIN_HEADER FT_Library library; FT_Face face; FT_GlyphSlot next; - FT_UInt flags; FT_Generic generic; FT_Glyph_Metrics metrics; @@ -1475,13 +1479,13 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* */ - /* FT_Open_Flags */ + /* FT_OPEN_XXX */ /* */ /* */ - /* An enumeration used to list the bit flags used within the */ - /* `flags' field of the @FT_Open_Args structure. */ + /* A list of bit-field constants used within the `flags' field of the */ + /* @FT_Open_Args structure. */ /* */ - /* */ + /* */ /* FT_OPEN_MEMORY :: This is a memory-based stream. */ /* */ /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ @@ -1507,15 +1511,11 @@ FT_BEGIN_HEADER /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ /* flags are mutually exclusive. */ /* */ - typedef enum - { - FT_OPEN_MEMORY = 1, - FT_OPEN_STREAM = 2, - FT_OPEN_PATHNAME = 4, - FT_OPEN_DRIVER = 8, - FT_OPEN_PARAMS = 16 - - } FT_Open_Flags; +#define FT_OPEN_MEMORY 0x1 +#define FT_OPEN_STREAM 0x2 +#define FT_OPEN_PATHNAME 0x4 +#define FT_OPEN_DRIVER 0x8 +#define FT_OPEN_PARAMS 0x10 #define ft_open_memory FT_OPEN_MEMORY /* deprecated */ #define ft_open_stream FT_OPEN_STREAM /* deprecated */ @@ -1603,14 +1603,14 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Open_Args_ { - FT_Open_Flags flags; - const FT_Byte* memory_base; - FT_Long memory_size; - FT_String* pathname; - FT_Stream stream; - FT_Module driver; - FT_Int num_params; - FT_Parameter* params; + FT_UInt flags; + const FT_Byte* memory_base; + FT_Long memory_size; + FT_String* pathname; + FT_Stream stream; + FT_Module driver; + FT_Int num_params; + FT_Parameter* params; } FT_Open_Args; diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h index b3bfcb50e..f16c0750f 100644 --- a/include/freetype/ftbdf.h +++ b/include/freetype/ftbdf.h @@ -64,7 +64,7 @@ FT_BEGIN_HEADER * BDF_PROPERTY_TYPE_CARDINAL :: * Property is a 32-bit unsigned integer. */ - typedef enum + typedef enum BDF_PropertyType_ { BDF_PROPERTY_TYPE_NONE = 0, BDF_PROPERTY_TYPE_ATOM = 1, diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index fe46bf529..7115a0643 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 by */ +/* Copyright 1996-2001, 2002, 2003 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -357,10 +357,10 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* */ - /* FT_Outline_Flags */ + /* FT_OUTLINE_XXX */ /* */ /* */ - /* A simple type used to enumerates the flags in an outline's */ + /* A list of bit-field constants use for the flags in an outline's */ /* `outline_flags' field. */ /* */ /* */ @@ -414,17 +414,14 @@ FT_BEGIN_HEADER /* completely ignored by a given */ /* scan-converter. */ /* */ - typedef enum FT_Outline_Flags_ - { - FT_OUTLINE_NONE = 0, - FT_OUTLINE_OWNER = 1, - FT_OUTLINE_EVEN_ODD_FILL = 2, - FT_OUTLINE_REVERSE_FILL = 4, - FT_OUTLINE_IGNORE_DROPOUTS = 8, - FT_OUTLINE_HIGH_PRECISION = 256, - FT_OUTLINE_SINGLE_PASS = 512 +#define FT_OUTLINE_NONE 0x0 +#define FT_OUTLINE_OWNER 0x1 +#define FT_OUTLINE_EVEN_ODD_FILL 0x2 +#define FT_OUTLINE_REVERSE_FILL 0x4 +#define FT_OUTLINE_IGNORE_DROPOUTS 0x8 - } FT_Outline_Flags; +#define FT_OUTLINE_HIGH_PRECISION 0x100 +#define FT_OUTLINE_SINGLE_PASS 0x200 /************************************************************************* @@ -937,11 +934,11 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* */ - /* FT_Raster_Flag */ + /* FT_RASTER_FLAG_XXX */ /* */ /* */ - /* An enumeration to list the bit flags as used in the `flags' field */ - /* of a FT_Raster_Params structure. */ + /* A list of bit flag constants as used in the `flags' field of a */ + /* @FT_Raster_Params structure. */ /* */ /* */ /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ @@ -949,7 +946,7 @@ FT_BEGIN_HEADER /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ /* anti-aliased glyph image should be */ /* generated. Otherwise, it will be */ - /* monochrome (1-bit) */ + /* monochrome (1-bit). */ /* */ /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ /* rendering. In this mode, client */ @@ -974,15 +971,12 @@ FT_BEGIN_HEADER /* in direct rendering mode where all spans */ /* are generated if no clipping box is set. */ /* */ - typedef enum - { - FT_RASTER_FLAG_DEFAULT = 0, - FT_RASTER_FLAG_AA = 1, - FT_RASTER_FLAG_DIRECT = 2, - FT_RASTER_FLAG_CLIP = 4 - - } FT_Raster_Flag; +#define FT_RASTER_FLAG_DEFAULT 0x0 +#define FT_RASTER_FLAG_AA 0x1 +#define FT_RASTER_FLAG_DIRECT 0x2 +#define FT_RASTER_FLAG_CLIP 0x4 + /* deprecated */ #define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT #define ft_raster_flag_aa FT_RASTER_FLAG_AA #define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT diff --git a/include/freetype/ftincrem.h b/include/freetype/ftincrem.h index 53909871a..782846a4e 100644 --- a/include/freetype/ftincrem.h +++ b/include/freetype/ftincrem.h @@ -246,8 +246,7 @@ FT_BEGIN_HEADER * parameter.data = &inc_int; * * // set up FT_Open_Args structure - * open_args.flags = (FT_Open_Flags)( FT_OPEN_PATHNAME | - * FT_OPEN_PARAMS ); + * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; * open_args.pathname = my_font_pathname; * open_args.num_params = 1; * open_args.params = ¶meter; // we use one optional argument diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h index d66d10b19..284f4e3b6 100644 --- a/include/freetype/internal/ftgloadr.h +++ b/include/freetype/internal/ftgloadr.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (specification). */ /* */ -/* Copyright 2002 by */ +/* Copyright 2002, 2003 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -52,12 +52,6 @@ FT_BEGIN_HEADER #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 - enum - { - FT_GLYPH_OWN_BITMAP = 1 - }; - - typedef struct FT_SubGlyphRec_ { FT_Int index; diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 3a22ac391..ac3edfa06 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -338,6 +338,11 @@ FT_BEGIN_HEADER /* loader :: The glyph loader object used to load outlines */ /* into the glyph slot. */ /* */ + /* flags :: Possible values are zero or */ + /* FT_GLYPH_OWN_BITMAP. The latter indicates */ + /* that the FT_GlyphSlot structure owns the */ + /* bitmap buffer. */ + /* */ /* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */ /* must be transformed through a specific */ /* font transformation. This is _not_ the same */ @@ -352,9 +357,13 @@ FT_BEGIN_HEADER /* */ /* glyph_hints :: Format-specific glyph hints management. */ /* */ + +#define FT_GLYPH_OWN_BITMAP 0x1 + typedef struct FT_Slot_InternalRec_ { FT_GlyphLoader loader; + FT_UInt flags; FT_Bool glyph_transformed; FT_Matrix glyph_matrix; FT_Vector glyph_delta; diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 8d7e831e6..fad5a620d 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -158,8 +158,8 @@ glyph->left = slot->bitmap_left; glyph->top = slot->bitmap_top; - if ( slot->flags & FT_GLYPH_OWN_BITMAP ) - slot->flags &= ~FT_GLYPH_OWN_BITMAP; + if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; else { /* copy the bitmap into a new buffer */ @@ -573,12 +573,13 @@ FT_Vector* origin, FT_Bool destroy ) { - FT_GlyphSlotRec dummy; - FT_Error error = FT_Err_Ok; - FT_Glyph glyph; - FT_BitmapGlyph bitmap = NULL; + FT_GlyphSlotRec dummy; + FT_GlyphSlot_InternalRec dummy_internal; + FT_Error error = FT_Err_Ok; + FT_Glyph glyph; + FT_BitmapGlyph bitmap = NULL; - const FT_Glyph_Class* clazz; + const FT_Glyph_Class* clazz; /* check argument */ @@ -602,8 +603,10 @@ goto Bad; FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); - dummy.library = glyph->library; - dummy.format = clazz->glyph_format; + FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) ); + dummy.internal = &dummy_internal; + dummy.library = glyph->library; + dummy.format = clazz->glyph_format; /* create result bitmap glyph */ error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class, diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index fe078835e..feac5ee83 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -202,13 +202,13 @@ FT_BASE_DEF( void ) ft_glyphslot_free_bitmap( FT_GlyphSlot slot ) { - if ( slot->flags & FT_GLYPH_OWN_BITMAP ) + if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_Memory memory = FT_FACE_MEMORY( slot->face ); FT_FREE( slot->bitmap.buffer ); - slot->flags &= ~FT_GLYPH_OWN_BITMAP; + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } else { @@ -227,7 +227,7 @@ slot->bitmap.buffer = buffer; - FT_ASSERT( (slot->flags & FT_GLYPH_OWN_BITMAP) == 0 ); + FT_ASSERT( (slot->internal->flags & FT_GLYPH_OWN_BITMAP) == 0 ); } @@ -238,10 +238,10 @@ FT_Memory memory = FT_FACE_MEMORY( slot->face ); - if ( slot->flags & FT_GLYPH_OWN_BITMAP ) + if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) FT_FREE( slot->bitmap.buffer ); else - slot->flags |= FT_GLYPH_OWN_BITMAP; + slot->internal->flags |= FT_GLYPH_OWN_BITMAP; return FT_MEM_ALLOC( slot->bitmap.buffer, size ); } @@ -1074,7 +1074,7 @@ args.stream = stream; if ( driver_name ) { - args.flags = (FT_Open_Flags)( args.flags | FT_OPEN_DRIVER ); + args.flags = args.flags | FT_OPEN_DRIVER; args.driver = FT_Get_Module( library, driver_name ); } diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 594c92a62..5e37f2c2f 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -192,10 +192,10 @@ #if 0 /* this doesn't work well with embedded bitmaps */ /* grab the bitmap when possible - this is a hack! */ - if ( slot->flags & FT_GLYPH_OWN_BITMAP ) + if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { - slot->flags &= ~FT_GLYPH_OWN_BITMAP; - sbit->buffer = bitmap->buffer; + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + sbit->buffer = bitmap->buffer; } else #endif diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index bfb274b2f..b6c0f0282 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -151,10 +151,10 @@ memory = render->root.memory; /* release old bitmap buffer */ - if ( slot->flags & FT_GLYPH_OWN_BITMAP ) + if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); - slot->flags &= ~FT_GLYPH_OWN_BITMAP; + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } /* allocate new one, depends on pixel format */ @@ -178,7 +178,7 @@ if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) goto Exit; - slot->flags |= FT_GLYPH_OWN_BITMAP; + slot->internal->flags |= FT_GLYPH_OWN_BITMAP; /* translate outline to render it into the bitmap */ FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index c06a4e648..cc84acd04 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -143,10 +143,10 @@ memory = render->root.memory; /* release old bitmap buffer */ - if ( slot->flags & FT_GLYPH_OWN_BITMAP ) + if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { FT_FREE( bitmap->buffer ); - slot->flags &= ~FT_GLYPH_OWN_BITMAP; + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } /* allocate new one, depends on pixel format */ @@ -169,7 +169,7 @@ if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) goto Exit; - slot->flags |= FT_GLYPH_OWN_BITMAP; + slot->internal->flags |= FT_GLYPH_OWN_BITMAP; /* translate outline to render it into the bitmap */ FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 4bf56192b..320d5c2d5 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -645,10 +645,10 @@ } } - slot->flags = FT_GLYPH_OWN_BITMAP; - slot->bitmap_left = 0; - slot->bitmap_top = font->header.ascent; - slot->format = FT_GLYPH_FORMAT_BITMAP; + slot->internal->flags = FT_GLYPH_OWN_BITMAP; + slot->bitmap_left = 0; + slot->bitmap_top = font->header.ascent; + slot->format = FT_GLYPH_FORMAT_BITMAP; /* now set up metrics */ slot->metrics.horiAdvance = bitmap->width << 6;