Commit 6d8c18214efac66ca60bc9bd63845a0fc676ad8e

Werner Lemberg 2005-05-26T21:02:25

* docs/GPL.txt: Update postal address of FSF. * include/freetype/ftbitmap.h (FT_Bitmap_Embolden): Improve documentation. * src/base/ftsynth.c (FT_BOLD_THRESHOLD): Removed. (FT_GlyphSlot_Embolden): Check whether slot is bitmap owner. Always modify the metrics.

diff --git a/ChangeLog b/ChangeLog
index bbd4b78..353fa31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-05-26  Werner Lemberg  <wl@gnu.org>
+
+	* docs/GPL.txt: Update postal address of FSF.
+
+2005-05-26  Chia I Wu  <b90201047@ntu.edu.tw>
+
+	* include/freetype/ftbitmap.h (FT_Bitmap_Embolden): Improve
+	documentation.
+
+	* src/base/ftsynth.c (FT_BOLD_THRESHOLD): Removed.
+	(FT_GlyphSlot_Embolden): Check whether slot is bitmap owner.
+	Always modify the metrics.
+
 2005-05-24  Werner Lemberg  <wl@gnu.org>
 
 	* docs/CHANGES: Updated.
diff --git a/docs/GPL.txt b/docs/GPL.txt
index e8a612e..b2fe7b6 100644
--- a/docs/GPL.txt
+++ b/docs/GPL.txt
@@ -1,8 +1,8 @@
 		    GNU GENERAL PUBLIC LICENSE
 		       Version 2, June 1991
 
- Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
 
 		     END OF TERMS AND CONDITIONS
 
-	Appendix: How to Apply These Terms to Your New Programs
+	    How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
 the "copyright" line and a pointer to where the full notice is found.
 
     <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
+    Copyright (C) <year>  <name of author>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -305,14 +305,15 @@ the "copyright" line and a pointer to where the full notice is found.
 
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 
 Also add information on how to contact you by electronic and paper mail.
 
 If the program is interactive, make it output a short notice like this
 when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision version 69, Copyright (C) year  name of author
     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.
diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h
index 8aae8c6..909e836 100644
--- a/include/freetype/ftbitmap.h
+++ b/include/freetype/ftbitmap.h
@@ -118,6 +118,10 @@ FT_BEGIN_HEADER
   /*    The current implementation restricts `xStrength' to be less than   */
   /*    or equal to 8.                                                     */
   /*                                                                       */
+  /*    Don't embolden the bitmap owned by a @FT_GlyphSlot directly!  Call */
+  /*    @FT_Bitmap_Copy to get a copy and work on the copy instead.        */
+  /*                                                                       */
+  /*                                                                       */
   FT_EXPORT_DEF( FT_Error )
   FT_Bitmap_Embolden( FT_Library  library,
                       FT_Bitmap*  bitmap,
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index 2529354..cdc01f7 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -23,9 +23,6 @@
 #include FT_BITMAP_H
 
 
-#define FT_BOLD_THRESHOLD  0x0100
-
-
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
@@ -90,7 +87,7 @@
     if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
     {
       error = FT_Outline_Embolden( &slot->outline, xstr );
-      xstr = ( xstr * 4 ) & ~63;
+      xstr = xstr * 4 ; /* according to the documentation */
       ystr = xstr;
     }
     else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
@@ -100,25 +97,41 @@
         xstr = 1 << 6;
       ystr = FT_PIX_FLOOR( ystr );
 
-      error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );
+      /* slot must be bitmap-owner */
+      if ( !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
+      {
+        FT_Bitmap  bitmap;
+
+
+        FT_Bitmap_New( &bitmap );
+        error = FT_Bitmap_Copy( library, &slot->bitmap, &bitmap );
+
+        if ( !error )
+        {
+          slot->bitmap = bitmap;
+          slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
+        }
+      }
 
-      /* XXX should we set these? */
       if ( !error )
-        slot->bitmap_top += ystr >> 6;
+        error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );
     }
     else
       error = FT_Err_Invalid_Argument;
 
-    /* XXX should we set these? */
+    /* modify the metrics accordingly */
     if ( !error )
     {
-#if 0
-      slot->advance.x            += xstr;
       slot->metrics.width        += xstr;
       slot->metrics.height       += ystr;
       slot->metrics.horiBearingY += ystr;
-#endif
       slot->metrics.horiAdvance  += xstr;
+      slot->metrics.vertBearingX -= xstr / 2;
+      slot->metrics.vertBearingY += ystr;
+      slot->metrics.vertAdvance  += ystr;
+
+      if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
+        slot->bitmap_top += ystr >> 6;
     }
   }