Commit c8c4cc837cd917ee6963e206760669377ceb124d

Werner Lemberg 2008-12-17T10:50:31

* 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.

diff --git a/ChangeLog b/ChangeLog
index 714132a..ce976ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-12-17  Werner Lemberg  <wl@gnu.org>
+
+	* 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  <wl@gnu.org>
 
 	Generalize the concept of `tricky' fonts by introducing
diff --git a/docs/CHANGES b/docs/CHANGES
index 4e45e5c..86092eb 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 982b6ae..9274236 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,
@@ -173,6 +172,28 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
+  /*    FT_GlyphSlot_Own_Bitmap                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Make sure that a glyph slot owns `slot->bitmap'.                   */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    slot :: The glyph slot.                                            */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    FreeType error code.  0~means success.                             */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This function is to be used in combination with                    */
+  /*    @FT_Bitmap_Embolden.                                               */
+  /*                                                                       */
+  FT_EXPORT( FT_Error )
+  FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
   /*    FT_Bitmap_Done                                                     */
   /*                                                                       */
   /* <Description>                                                         */
diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h
index 36984bf..a068b79 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 4c1cdf2..202448a 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 <ft2build.h>
 #include FT_BITMAP_H
+#include FT_IMAGE_H
 #include FT_INTERNAL_OBJECTS_H
 
 
@@ -606,6 +606,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 )
   FT_Bitmap_Done( FT_Library  library,
                   FT_Bitmap  *bitmap )
   {
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index ff88ce9..24e820c 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 )