* 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.
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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
diff --git a/ChangeLog b/ChangeLog
index 47c2915..6ff5484 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
index 39205d6..6d8f1e8 100644
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -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
diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h
index 795e757..dcce1e0 100644
--- a/builds/vms/ftconfig.h
+++ b/builds/vms/ftconfig.h
@@ -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
diff --git a/docs/CHANGES b/docs/CHANGES
index 6ca0e1c..6f787b0 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -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.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 3f27cd7..517e83e 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -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;
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index c5bf79e..c1339d8 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -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;
+ if ( !error )
+ {
+ glyph->root.outline.n_points = 0;
+ glyph->root.outline.n_contours = 0;
- glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
+ glyph->root.metrics.width = (FT_Pos)metrics.width << 6;
+ glyph->root.metrics.height = (FT_Pos)metrics.height << 6;
- 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;
+ 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;
}
- return error;
}
- }
+ }
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */