* 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.
This commit is contained in:
Werner Lemberg 2003-06-18 06:59:57 +00:00
parent d726e41c33
commit 7a0241049a
13 changed files with 107 additions and 87 deletions

View File

@ -1,3 +1,24 @@
2003-06-16 Werner Lemberg <wl@gnu.org>
* 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 <wl@gnu.org> 2003-06-15 Werner Lemberg <wl@gnu.org>
* builds/compiler/gcc.mk, builds/compiler/gcc-dev.mk (CFLAGS): * 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 interface is hidden in an internal part of the face record, and all
the definitions are in ftincrem.h. the definitions are in ftincrem.h.
* include/freetype/freeetype.h [FT_CONFIG_OPTION_INCREMENTAL]: * include/freetype/freetype.h [FT_CONFIG_OPTION_INCREMENTAL]:
Removed. Removed.
* include/freetype/internal/ftobjs.h [FT_CONFIG_OPTION_INCREMENTAL]: * include/freetype/internal/ftobjs.h [FT_CONFIG_OPTION_INCREMENTAL]:
Include FT_INCREMENTAL_H. Include FT_INCREMENTAL_H.

View File

@ -113,7 +113,6 @@ FT_BEGIN_HEADER
/* FT_New_Memory_Face */ /* FT_New_Memory_Face */
/* FT_Open_Face */ /* FT_Open_Face */
/* FT_Open_Args */ /* FT_Open_Args */
/* FT_Open_Flags */
/* FT_Parameter */ /* FT_Parameter */
/* FT_Attach_File */ /* FT_Attach_File */
/* FT_Attach_Stream */ /* FT_Attach_Stream */
@ -126,6 +125,12 @@ FT_BEGIN_HEADER
/* FT_Get_Name_Index */ /* FT_Get_Name_Index */
/* FT_Load_Char */ /* FT_Load_Char */
/* */ /* */
/* FT_OPEN_MEMORY */
/* FT_OPEN_STREAM */
/* FT_OPEN_PATHNAME */
/* FT_OPEN_DRIVER */
/* FT_OPEN_PARAMS */
/* */
/* FT_LOAD_DEFAULT */ /* FT_LOAD_DEFAULT */
/* FT_LOAD_RENDER */ /* FT_LOAD_RENDER */
/* FT_LOAD_MONOCHROME */ /* FT_LOAD_MONOCHROME */
@ -1360,7 +1365,6 @@ FT_BEGIN_HEADER
FT_Library library; FT_Library library;
FT_Face face; FT_Face face;
FT_GlyphSlot next; FT_GlyphSlot next;
FT_UInt flags;
FT_Generic generic; FT_Generic generic;
FT_Glyph_Metrics metrics; FT_Glyph_Metrics metrics;
@ -1475,13 +1479,13 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Enum> */ /* <Enum> */
/* FT_Open_Flags */ /* FT_OPEN_XXX */
/* */ /* */
/* <Description> */ /* <Description> */
/* An enumeration used to list the bit flags used within the */ /* A list of bit-field constants used within the `flags' field of the */
/* `flags' field of the @FT_Open_Args structure. */ /* @FT_Open_Args structure. */
/* */ /* */
/* <Fields> */ /* <Values> */
/* FT_OPEN_MEMORY :: This is a memory-based stream. */ /* FT_OPEN_MEMORY :: This is a memory-based stream. */
/* */ /* */
/* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ /* 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' */ /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
/* flags are mutually exclusive. */ /* flags are mutually exclusive. */
/* */ /* */
typedef enum #define FT_OPEN_MEMORY 0x1
{ #define FT_OPEN_STREAM 0x2
FT_OPEN_MEMORY = 1, #define FT_OPEN_PATHNAME 0x4
FT_OPEN_STREAM = 2, #define FT_OPEN_DRIVER 0x8
FT_OPEN_PATHNAME = 4, #define FT_OPEN_PARAMS 0x10
FT_OPEN_DRIVER = 8,
FT_OPEN_PARAMS = 16
} FT_Open_Flags;
#define ft_open_memory FT_OPEN_MEMORY /* deprecated */ #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
#define ft_open_stream FT_OPEN_STREAM /* deprecated */ #define ft_open_stream FT_OPEN_STREAM /* deprecated */
@ -1603,14 +1603,14 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct FT_Open_Args_ typedef struct FT_Open_Args_
{ {
FT_Open_Flags flags; FT_UInt flags;
const FT_Byte* memory_base; const FT_Byte* memory_base;
FT_Long memory_size; FT_Long memory_size;
FT_String* pathname; FT_String* pathname;
FT_Stream stream; FT_Stream stream;
FT_Module driver; FT_Module driver;
FT_Int num_params; FT_Int num_params;
FT_Parameter* params; FT_Parameter* params;
} FT_Open_Args; } FT_Open_Args;

View File

@ -64,7 +64,7 @@ FT_BEGIN_HEADER
* BDF_PROPERTY_TYPE_CARDINAL :: * BDF_PROPERTY_TYPE_CARDINAL ::
* Property is a 32-bit unsigned integer. * Property is a 32-bit unsigned integer.
*/ */
typedef enum typedef enum BDF_PropertyType_
{ {
BDF_PROPERTY_TYPE_NONE = 0, BDF_PROPERTY_TYPE_NONE = 0,
BDF_PROPERTY_TYPE_ATOM = 1, BDF_PROPERTY_TYPE_ATOM = 1,

View File

@ -5,7 +5,7 @@
/* FreeType glyph image formats and default raster interface */ /* FreeType glyph image formats and default raster interface */
/* (specification). */ /* (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002 by */ /* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -357,10 +357,10 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Enum> */ /* <Enum> */
/* FT_Outline_Flags */ /* FT_OUTLINE_XXX */
/* */ /* */
/* <Description> */ /* <Description> */
/* 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. */ /* `outline_flags' field. */
/* */ /* */
/* <Values> */ /* <Values> */
@ -414,17 +414,14 @@ FT_BEGIN_HEADER
/* completely ignored by a given */ /* completely ignored by a given */
/* scan-converter. */ /* scan-converter. */
/* */ /* */
typedef enum FT_Outline_Flags_ #define FT_OUTLINE_NONE 0x0
{ #define FT_OUTLINE_OWNER 0x1
FT_OUTLINE_NONE = 0, #define FT_OUTLINE_EVEN_ODD_FILL 0x2
FT_OUTLINE_OWNER = 1, #define FT_OUTLINE_REVERSE_FILL 0x4
FT_OUTLINE_EVEN_ODD_FILL = 2, #define FT_OUTLINE_IGNORE_DROPOUTS 0x8
FT_OUTLINE_REVERSE_FILL = 4,
FT_OUTLINE_IGNORE_DROPOUTS = 8,
FT_OUTLINE_HIGH_PRECISION = 256,
FT_OUTLINE_SINGLE_PASS = 512
} FT_Outline_Flags; #define FT_OUTLINE_HIGH_PRECISION 0x100
#define FT_OUTLINE_SINGLE_PASS 0x200
/************************************************************************* /*************************************************************************
@ -937,11 +934,11 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Enum> */ /* <Enum> */
/* FT_Raster_Flag */ /* FT_RASTER_FLAG_XXX */
/* */ /* */
/* <Description> */ /* <Description> */
/* An enumeration to list the bit flags as used in the `flags' field */ /* A list of bit flag constants as used in the `flags' field of a */
/* of a FT_Raster_Params structure. */ /* @FT_Raster_Params structure. */
/* */ /* */
/* <Values> */ /* <Values> */
/* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ /* 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 */ /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */
/* anti-aliased glyph image should be */ /* anti-aliased glyph image should be */
/* generated. Otherwise, it will be */ /* generated. Otherwise, it will be */
/* monochrome (1-bit) */ /* monochrome (1-bit). */
/* */ /* */
/* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */
/* rendering. In this mode, client */ /* rendering. In this mode, client */
@ -974,15 +971,12 @@ FT_BEGIN_HEADER
/* in direct rendering mode where all spans */ /* in direct rendering mode where all spans */
/* are generated if no clipping box is set. */ /* are generated if no clipping box is set. */
/* */ /* */
typedef enum #define FT_RASTER_FLAG_DEFAULT 0x0
{ #define FT_RASTER_FLAG_AA 0x1
FT_RASTER_FLAG_DEFAULT = 0, #define FT_RASTER_FLAG_DIRECT 0x2
FT_RASTER_FLAG_AA = 1, #define FT_RASTER_FLAG_CLIP 0x4
FT_RASTER_FLAG_DIRECT = 2,
FT_RASTER_FLAG_CLIP = 4
} FT_Raster_Flag;
/* deprecated */
#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT #define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT
#define ft_raster_flag_aa FT_RASTER_FLAG_AA #define ft_raster_flag_aa FT_RASTER_FLAG_AA
#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT #define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT

View File

@ -246,8 +246,7 @@ FT_BEGIN_HEADER
* parameter.data = &inc_int; * parameter.data = &inc_int;
* *
* // set up FT_Open_Args structure * // set up FT_Open_Args structure
* open_args.flags = (FT_Open_Flags)( FT_OPEN_PATHNAME | * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;
* FT_OPEN_PARAMS );
* open_args.pathname = my_font_pathname; * open_args.pathname = my_font_pathname;
* open_args.num_params = 1; * open_args.num_params = 1;
* open_args.params = &parameter; // we use one optional argument * open_args.params = &parameter; // we use one optional argument

View File

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType glyph loader (specification). */ /* The FreeType glyph loader (specification). */
/* */ /* */
/* Copyright 2002 by */ /* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */ /* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* 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 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
enum
{
FT_GLYPH_OWN_BITMAP = 1
};
typedef struct FT_SubGlyphRec_ typedef struct FT_SubGlyphRec_
{ {
FT_Int index; FT_Int index;

View File

@ -338,6 +338,11 @@ FT_BEGIN_HEADER
/* loader :: The glyph loader object used to load outlines */ /* loader :: The glyph loader object used to load outlines */
/* into the glyph slot. */ /* 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 */ /* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */
/* must be transformed through a specific */ /* must be transformed through a specific */
/* font transformation. This is _not_ the same */ /* font transformation. This is _not_ the same */
@ -352,9 +357,13 @@ FT_BEGIN_HEADER
/* */ /* */
/* glyph_hints :: Format-specific glyph hints management. */ /* glyph_hints :: Format-specific glyph hints management. */
/* */ /* */
#define FT_GLYPH_OWN_BITMAP 0x1
typedef struct FT_Slot_InternalRec_ typedef struct FT_Slot_InternalRec_
{ {
FT_GlyphLoader loader; FT_GlyphLoader loader;
FT_UInt flags;
FT_Bool glyph_transformed; FT_Bool glyph_transformed;
FT_Matrix glyph_matrix; FT_Matrix glyph_matrix;
FT_Vector glyph_delta; FT_Vector glyph_delta;

View File

@ -158,8 +158,8 @@
glyph->left = slot->bitmap_left; glyph->left = slot->bitmap_left;
glyph->top = slot->bitmap_top; glyph->top = slot->bitmap_top;
if ( slot->flags & FT_GLYPH_OWN_BITMAP ) if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
slot->flags &= ~FT_GLYPH_OWN_BITMAP; slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
else else
{ {
/* copy the bitmap into a new buffer */ /* copy the bitmap into a new buffer */
@ -573,12 +573,13 @@
FT_Vector* origin, FT_Vector* origin,
FT_Bool destroy ) FT_Bool destroy )
{ {
FT_GlyphSlotRec dummy; FT_GlyphSlotRec dummy;
FT_Error error = FT_Err_Ok; FT_GlyphSlot_InternalRec dummy_internal;
FT_Glyph glyph; FT_Error error = FT_Err_Ok;
FT_BitmapGlyph bitmap = NULL; FT_Glyph glyph;
FT_BitmapGlyph bitmap = NULL;
const FT_Glyph_Class* clazz; const FT_Glyph_Class* clazz;
/* check argument */ /* check argument */
@ -602,8 +603,10 @@
goto Bad; goto Bad;
FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); FT_MEM_ZERO( &dummy, sizeof ( dummy ) );
dummy.library = glyph->library; FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) );
dummy.format = clazz->glyph_format; dummy.internal = &dummy_internal;
dummy.library = glyph->library;
dummy.format = clazz->glyph_format;
/* create result bitmap glyph */ /* create result bitmap glyph */
error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class, error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class,

View File

@ -202,13 +202,13 @@
FT_BASE_DEF( void ) FT_BASE_DEF( void )
ft_glyphslot_free_bitmap( FT_GlyphSlot slot ) 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_Memory memory = FT_FACE_MEMORY( slot->face );
FT_FREE( slot->bitmap.buffer ); FT_FREE( slot->bitmap.buffer );
slot->flags &= ~FT_GLYPH_OWN_BITMAP; slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
} }
else else
{ {
@ -227,7 +227,7 @@
slot->bitmap.buffer = buffer; 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 ); 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 ); FT_FREE( slot->bitmap.buffer );
else else
slot->flags |= FT_GLYPH_OWN_BITMAP; slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
return FT_MEM_ALLOC( slot->bitmap.buffer, size ); return FT_MEM_ALLOC( slot->bitmap.buffer, size );
} }
@ -1074,7 +1074,7 @@
args.stream = stream; args.stream = stream;
if ( driver_name ) 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 ); args.driver = FT_Get_Module( library, driver_name );
} }

View File

@ -192,10 +192,10 @@
#if 0 /* this doesn't work well with embedded bitmaps */ #if 0 /* this doesn't work well with embedded bitmaps */
/* grab the bitmap when possible - this is a hack! */ /* 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; slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
sbit->buffer = bitmap->buffer; sbit->buffer = bitmap->buffer;
} }
else else
#endif #endif

View File

@ -151,10 +151,10 @@
memory = render->root.memory; memory = render->root.memory;
/* release old bitmap buffer */ /* release old bitmap buffer */
if ( slot->flags & FT_GLYPH_OWN_BITMAP ) if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{ {
FT_FREE( bitmap->buffer ); FT_FREE( bitmap->buffer );
slot->flags &= ~FT_GLYPH_OWN_BITMAP; slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
} }
/* allocate new one, depends on pixel format */ /* allocate new one, depends on pixel format */
@ -178,7 +178,7 @@
if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit; goto Exit;
slot->flags |= FT_GLYPH_OWN_BITMAP; slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
/* translate outline to render it into the bitmap */ /* translate outline to render it into the bitmap */
FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );

View File

@ -143,10 +143,10 @@
memory = render->root.memory; memory = render->root.memory;
/* release old bitmap buffer */ /* release old bitmap buffer */
if ( slot->flags & FT_GLYPH_OWN_BITMAP ) if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{ {
FT_FREE( bitmap->buffer ); FT_FREE( bitmap->buffer );
slot->flags &= ~FT_GLYPH_OWN_BITMAP; slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
} }
/* allocate new one, depends on pixel format */ /* allocate new one, depends on pixel format */
@ -169,7 +169,7 @@
if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit; goto Exit;
slot->flags |= FT_GLYPH_OWN_BITMAP; slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
/* translate outline to render it into the bitmap */ /* translate outline to render it into the bitmap */
FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );

View File

@ -645,10 +645,10 @@
} }
} }
slot->flags = FT_GLYPH_OWN_BITMAP; slot->internal->flags = FT_GLYPH_OWN_BITMAP;
slot->bitmap_left = 0; slot->bitmap_left = 0;
slot->bitmap_top = font->header.ascent; slot->bitmap_top = font->header.ascent;
slot->format = FT_GLYPH_FORMAT_BITMAP; slot->format = FT_GLYPH_FORMAT_BITMAP;
/* now set up metrics */ /* now set up metrics */
slot->metrics.horiAdvance = bitmap->width << 6; slot->metrics.horiAdvance = bitmap->width << 6;