* builds/unix/ftconfig.in, builds/vms/ftconfig.h: Define

FT_CHAR_BIT.

* src/base/ftobjs.c (FT_Load_Glyph): Don't apply autohinting if
glyph is vertically distorted or mirrored.

* src/cff/cffgload.c (cff_slot_load): Handle zero `size' properly
for embedded bitmaps.

* docs/CHANGES: Updated.
This commit is contained in:
Werner Lemberg 2004-04-16 09:56:30 +00:00
parent 63df8823f2
commit 291a4783d0
6 changed files with 71 additions and 46 deletions

View File

@ -1,3 +1,16 @@
2004-04-15 Werner Lemberg <wl@gnu.org>
* builds/unix/ftconfig.in, builds/vms/ftconfig.h: Define
FT_CHAR_BIT.
* src/base/ftobjs.c (FT_Load_Glyph): Don't apply autohinting if
glyph is vertically distorted or mirrored.
* src/cff/cffgload.c (cff_slot_load): Handle zero `size' properly
for embedded bitmaps.
* docs/CHANGES: Updated.
2004-04-15 bytesoftware <bytesoftware@btinternet.com>
* include/freetype/config/ftconfig.h, src/base/ftstream.c

View File

@ -4,7 +4,7 @@
/* */
/* UNIX-specific configuration file (specification only). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -67,6 +67,7 @@ FT_BEGIN_HEADER
#define FT_SIZEOF_INT SIZEOF_INT
#define FT_SIZEOF_LONG SIZEOF_LONG
#define FT_CHAR_BIT CHAR_BIT
/* Preferred alignment of data */
#define FT_ALIGNMENT 8

View File

@ -4,7 +4,7 @@
/* */
/* VMS-specific configuration file (specification only). */
/* */
/* Copyright 1996-2001, 2002, 2003 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -67,6 +67,8 @@ FT_BEGIN_HEADER
#define FT_SIZEOF_INT 4
#define FT_SIZEOF_LONG 4
#define FT_CHAR_BIT 8
/* Preferred alignment of data */
#define FT_ALIGNMENT 8

View File

@ -6,7 +6,7 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
- The native TrueType hinter contained some bugs which prevented
some fonts to be rendered correctly, most notably Legendum.otf.
- The PostScript hinter now produces much improved results.
- The PostScript hinter now produces improved results.
- The linear advance width and height values were incorrectly
rounded, making them virtually unusable if not loaded with
@ -39,6 +39,10 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
- Metrics for BDF and PCF bitmap font formats have been fixed.
- Autohinting is now disabled for glyphs which are vertically
distorted or mirrored (using a transformation matrix). This
fixes a bug which produced zero-height glyphs.
- The `freetype-config' script now handles --prefix and
--exec-prefix correctly; it also returns the proper --rpath (or
-R) value if FreeType has been built as a shared library.

View File

@ -517,7 +517,10 @@
autohint = 0;
}
if ( autohint )
/* don't apply autohinting if glyph is vertically distorted or */
/* mirrored */
if ( autohint && !( face->internal->transform_matrix.yy <= 0 ||
face->internal->transform_matrix.yx != 0 ) )
{
FT_AutoHinter_Service hinting;

View File

@ -2292,11 +2292,6 @@
FT_Error error;
CFF_Decoder decoder;
TT_Face face = (TT_Face)glyph->root.face;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
CFF_Face cff_face = (CFF_Face)size->root.face;
SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt;
FT_Stream stream = cff_face->root.stream;
#endif
FT_Bool hinting;
CFF_Font cff = (CFF_Font)face->extra.data;
@ -2321,53 +2316,60 @@
/* */
/* XXX: The convention should be emphasized in */
/* the documents because it can be confusing. */
if ( size &&
size->strike_index != 0xFFFFU &&
sfnt->load_sbits &&
( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
if ( size )
{
TT_SBit_MetricsRec metrics;
CFF_Face cff_face = (CFF_Face)size->root.face;
SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt;
FT_Stream stream = cff_face->root.stream;
error = sfnt->load_sbit_image( face,
(FT_ULong)size->strike_index,
(FT_UInt)glyph_index,
(FT_Int)load_flags,
stream,
&glyph->root.bitmap,
&metrics );
if ( !error )
if ( size->strike_index != 0xFFFFU &&
sfnt->load_sbits &&
( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
{
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
TT_SBit_MetricsRec metrics;
glyph->root.metrics.width = (FT_Pos)metrics.width << 6;
glyph->root.metrics.height = (FT_Pos)metrics.height << 6;
glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;
glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;
glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6;
error = sfnt->load_sbit_image( face,
(FT_ULong)size->strike_index,
(FT_UInt)glyph_index,
(FT_Int)load_flags,
stream,
&glyph->root.bitmap,
&metrics );
glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;
glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;
glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
if ( !error )
{
glyph->root.bitmap_left = metrics.vertBearingX;
glyph->root.bitmap_top = metrics.vertBearingY;
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
glyph->root.metrics.width = (FT_Pos)metrics.width << 6;
glyph->root.metrics.height = (FT_Pos)metrics.height << 6;
glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;
glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;
glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6;
glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;
glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;
glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
glyph->root.bitmap_left = metrics.vertBearingX;
glyph->root.bitmap_top = metrics.vertBearingY;
}
else
{
glyph->root.bitmap_left = metrics.horiBearingX;
glyph->root.bitmap_top = metrics.horiBearingY;
}
return error;
}
else
{
glyph->root.bitmap_left = metrics.horiBearingX;
glyph->root.bitmap_top = metrics.horiBearingY;
}
return error;
}
}
}
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */