summaryrefslogtreecommitdiff
path: root/src/base/ftsynth.c
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2005-05-26 21:02:25 +0000
committerWerner Lemberg <wl@gnu.org>2005-05-26 21:02:25 +0000
commit6d8c18214efac66ca60bc9bd63845a0fc676ad8e (patch)
tree2c10bfb4be928db1a3cfd4e3f1a1c0c8eefd8333 /src/base/ftsynth.c
parentafb2ba5756be264d7dd74516d5b27b4c43c3cc97 (diff)
downloadfreetype2-6d8c18214efac66ca60bc9bd63845a0fc676ad8e.tar.gz
* 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.
Diffstat (limited to 'src/base/ftsynth.c')
-rw-r--r--src/base/ftsynth.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index 2529354c8..cdc01f7a0 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;
}
}