diff --git a/ChangeLog b/ChangeLog index 714132ad3..ce976ea6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-12-17 Werner Lemberg + + * include/freetype/ftsynth.h, src/basae/ftsynth.c: Move + FT_GlyphSlot_Own_Bitmap to... + * include/freetype/ftbitmap.h, src/base/ftbitmap.c: These files. + + * docs/CHANGES: Document it. + 2008-12-10 Werner Lemberg Generalize the concept of `tricky' fonts by introducing diff --git a/docs/CHANGES b/docs/CHANGES index 4e45e5c3b..86092eb8d 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -51,6 +51,11 @@ CHANGES BETWEEN 2.3.8 and 2.3.7 . Tricky TrueType fonts always use the bytecode interpreter, either the patented or unpatented version. + - The function `FT_GlyphSlot_Own_Bitmap' has been moved from + FT_SYNTHESIS_H to FT_BITMAP_H; it is now part of the `official' + API. (The functions in FT_SYNTHESIS_H are still subject to + change, however.) + ====================================================================== diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h index 982b6aed2..92742369b 100644 --- a/include/freetype/ftbitmap.h +++ b/include/freetype/ftbitmap.h @@ -2,10 +2,9 @@ /* */ /* ftbitmap.h */ /* */ -/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */ -/* bitmaps into 8bpp format (specification). */ +/* FreeType utility functions for bitmaps (specification). */ /* */ -/* Copyright 2004, 2005, 2006 by */ +/* Copyright 2004, 2005, 2006, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -121,7 +120,7 @@ FT_BEGIN_HEADER /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */ /* */ /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */ - /* you should call `FT_GlyphSlot_Own_Bitmap' on the slot first. */ + /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */ /* */ FT_EXPORT( FT_Error ) FT_Bitmap_Embolden( FT_Library library, @@ -170,6 +169,28 @@ FT_BEGIN_HEADER FT_Int alignment ); + /*************************************************************************/ + /* */ + /* */ + /* FT_GlyphSlot_Own_Bitmap */ + /* */ + /* */ + /* Make sure that a glyph slot owns `slot->bitmap'. */ + /* */ + /* */ + /* slot :: The glyph slot. */ + /* */ + /* */ + /* FreeType error code. 0~means success. */ + /* */ + /* */ + /* This function is to be used in combination with */ + /* @FT_Bitmap_Embolden. */ + /* */ + FT_EXPORT( FT_Error ) + FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ); + + /*************************************************************************/ /* */ /* */ diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h index 36984bf1a..a068b7928 100644 --- a/include/freetype/ftsynth.h +++ b/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2006 by */ +/* Copyright 2000-2001, 2003, 2006, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,7 +23,7 @@ /*************************************************************************/ /*************************************************************************/ /********* *********/ - /********* WARNING, THIS IS ALPHA CODE, THIS API *********/ + /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ /********* FREETYPE DEVELOPMENT TEAM *********/ /********* *********/ @@ -34,6 +34,13 @@ /*************************************************************************/ + /* Main reason for not lifting the functions in this module to a */ + /* `standard' API is that the used parameters for emboldening and */ + /* slanting are not configurable. Consider the functions as a */ + /* code resource which should be copied into the application and */ + /* adapted to the particular needs. */ + + #ifndef __FTSYNTH_H__ #define __FTSYNTH_H__ @@ -50,20 +57,20 @@ FT_BEGIN_HEADER - /* Make sure slot owns slot->bitmap. */ - FT_EXPORT( FT_Error ) - FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ); - - /* Do not use this function directly! Copy the code to */ - /* your application and modify it to suit your need. */ + /* Embolden a glyph by a `reasonable' value (which is highly a matter of */ + /* taste). This function is actually a convenience function, providing */ + /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ + /* */ + /* For emboldened outlines the metrics are estimates only; if you need */ + /* precise values you should call @FT_Outline_Get_CBox. */ FT_EXPORT( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); - + /* Slant an outline glyph to the right by about 12 degrees. */ FT_EXPORT( void ) FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); - /* */ + /* */ FT_END_HEADER diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c index 4c1cdf218..202448a9c 100644 --- a/src/base/ftbitmap.c +++ b/src/base/ftbitmap.c @@ -2,10 +2,9 @@ /* */ /* ftbitmap.c */ /* */ -/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */ -/* bitmaps into 8bpp format (body). */ +/* FreeType utility functions for bitmaps (body). */ /* */ -/* Copyright 2004, 2005, 2006, 2007 by */ +/* Copyright 2004, 2005, 2006, 2007, 2008 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,6 +18,7 @@ #include #include FT_BITMAP_H +#include FT_IMAGE_H #include FT_INTERNAL_OBJECTS_H @@ -603,6 +603,31 @@ } + /* documentation is in ftbitmap.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ) + { + if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP && + !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) + { + FT_Bitmap bitmap; + FT_Error error; + + + FT_Bitmap_New( &bitmap ); + error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap ); + if ( error ) + return error; + + slot->bitmap = bitmap; + slot->internal->flags |= FT_GLYPH_OWN_BITMAP; + } + + return FT_Err_Ok; + } + + /* documentation is in ftbitmap.h */ FT_EXPORT_DEF( FT_Error ) diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c index ff88ce96c..24e820c7c 100644 --- a/src/base/ftsynth.c +++ b/src/base/ftsynth.c @@ -68,29 +68,6 @@ /*************************************************************************/ - FT_EXPORT_DEF( FT_Error ) - FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ) - { - if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP && - !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) - { - FT_Bitmap bitmap; - FT_Error error; - - - FT_Bitmap_New( &bitmap ); - error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap ); - if ( error ) - return error; - - slot->bitmap = bitmap; - slot->internal->flags |= FT_GLYPH_OWN_BITMAP; - } - - return FT_Err_Ok; - } - - /* documentation is in ftsynth.h */ FT_EXPORT_DEF( void )