* include/freetype/ftbitmap.h (FT_Bitmap_Embolden): Update documentation. * include/freetype/ftsynth.h (FT_GlyphSlot_Own_Bitmap), src/base/ftsynth.c (FT_GlyphSlot_Own_Bitmap): New function to make sure a glyph slot owns its bitmap. It is also marked experimental and due to change. (FT_GlyphSlot_Embolden): Undo the last change. It turns out rendering the outline confuses some applications.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
diff --git a/ChangeLog b/ChangeLog
index 40511b9..caae98e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-02-24 Chia-I Wu <b90201047@ntu.edu.tw>
+
+ * include/freetype/ftbitmap.h (FT_Bitmap_Embolden): Update
+ documentation.
+
+ * include/freetype/ftsynth.h (FT_GlyphSlot_Own_Bitmap),
+ src/base/ftsynth.c (FT_GlyphSlot_Own_Bitmap): New function to make
+ sure a glyph slot owns its bitmap. It is also marked experimental and
+ due to change.
+ (FT_GlyphSlot_Embolden): Undo the last change. It turns out rendering
+ the outline confuses some applications.
+
2006-02-24 David Turner <david@freetype.org>
* tagging Third release candidate with VER-2-2-0-RC3
diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h
index cd97032..7c61b6c 100644
--- a/include/freetype/ftbitmap.h
+++ b/include/freetype/ftbitmap.h
@@ -120,8 +120,8 @@ FT_BEGIN_HEADER
/* The current implementation restricts `xStrength' to be less than */
/* or equal to 8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
/* */
- /* 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. */
+ /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
+ /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Embolden( FT_Library library,
diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h
index f0c7385..36984bf 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 by */
+/* Copyright 2000-2001, 2003, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -50,10 +50,12 @@
FT_BEGIN_HEADER
+ /* Make sure slot owns slot->bitmap. */
+ FT_EXPORT( FT_Error )
+ FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
- /* This code is completely experimental -- use with care! */
- /* It will probably be completely rewritten in the future */
- /* or even integrated into the library. */
+ /* Do not use this function directly! Copy the code to */
+ /* your application and modify it to suit your need. */
FT_EXPORT( void )
FT_GlyphSlot_Embolden( FT_GlyphSlot slot );
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index e7b3d88..f363b3e 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -68,6 +68,29 @@
/*************************************************************************/
+ 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 )
@@ -91,42 +114,23 @@
if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
{
error = FT_Outline_Embolden( &slot->outline, xstr );
- if ( error )
- {
- error = FT_Render_Glyph( slot, FT_RENDER_MODE_NORMAL );
- if ( error )
- return;
- }
- else
- {
- /* this is more than enough for most glyphs; if you need accurate */
- /* values, you have to call FT_Outline_Get_CBox */
- xstr = xstr * 2;
- ystr = xstr;
- }
- }
+ /* ignore error */
- if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
+ /* this is more than enough for most glyphs; if you need accurate */
+ /* values, you have to call FT_Outline_Get_CBox */
+ xstr = xstr * 2;
+ ystr = xstr;
+ }
+ else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
{
xstr = FT_PIX_FLOOR( xstr );
if ( xstr == 0 )
xstr = 1 << 6;
ystr = FT_PIX_FLOOR( 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 )
- return;
-
- slot->bitmap = bitmap;
- slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
- }
+ error = FT_GlyphSlot_Own_Bitmap( slot );
+ if ( error )
+ return;
error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );
if ( error )