* src/pshinter/pshalgo.c: slight modification to the Postscript hinter to slightly increase the contrast of smooth hinting. This is very similar to what the auto-hinter does when it comes to stem width computations. However, it produces better results with well-hinted fonts..
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
diff --git a/ChangeLog b/ChangeLog
index 90bf2ad..4c0068f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,19 @@
+2002-08-29 David Turner <david@freetype.org>
+
+ * src/pshinter/pshalgo.c: slight modification to the Postscript hinter
+ to slightly increase the contrast of smooth hinting. This is very similar
+ to what the auto-hinter does when it comes to stem width computations.
+ However, it produces better results with well-hinted fonts..
+
2002-08-27 David Turner <david@freetype.org>
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
-
+
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
-
+
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
@@ -14,7 +21,7 @@
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
-
+
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
@@ -23,12 +30,12 @@
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
-
+
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
-
+
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
@@ -185,7 +192,7 @@
2002-08-15 Graham Asher <graham.asher@btinternet.com>
- Implemented the incremental font loading system for the CFF driver.
+ Implemented the incremental font loading system for the CFF driver.
Tested using the GhostScript-to-FreeType bridge (under development).
* src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data): New
@@ -300,7 +307,7 @@
2002-07-18 Graham Asher <graham.asher@btinternet.com>
- Added types and structures to support incremental typeface loading.
+ Added types and structures to support incremental typeface loading.
The FT_Incremental_Interface structure, defined in freetype.h, is
designed to be passed to FT_Open_Face to provide callback functions
to obtain glyph recipes and metrics, for fonts like those passed
diff --git a/src/pshinter/pshalgo3.c b/src/pshinter/pshalgo3.c
index 0a178e0..518cc34 100644
--- a/src/pshinter/pshalgo3.c
+++ b/src/pshinter/pshalgo3.c
@@ -33,10 +33,8 @@
#endif
-#undef SNAP_STEMS
-#undef ONLY_ALIGN_Y
-
-#define COMPUTE_INFLEXS
+#define COMPUTE_INFLEXS /* compute inflection points to optimize "S" and others */
+#define STRONGER /* slightly increase the contrast of smooth hinting */
/*************************************************************************/
/*************************************************************************/
@@ -412,7 +410,7 @@
/* perform stem snapping when requested */
no_snapping = ( dimension == 0 && !glyph->no_horz_snapping ) ||
( dimension == 1 && !glyph->no_vert_snapping );
-
+
if ( !no_snapping )
{
/* compute fitted width/height */
@@ -499,6 +497,58 @@
}
else
{
+#ifdef STRONGER
+ if ( len <= 64 )
+ {
+ /* the stem is less than one pixel, we will center it */
+ /* around the nearest pixel center */
+ /* */
+ pos = ( pos + (len >> 1) & -64 );
+ len = 64;
+ }
+ else
+ {
+ FT_Pos delta = len - dim->stdw.widths[0].cur;
+
+
+ if ( delta < 0 )
+ delta = -delta;
+
+ if ( delta < 40 )
+ {
+ len = dim->stdw.widths[0].cur;
+ if ( len < 32 )
+ len = 32;
+ }
+
+ if ( len < 3 * 64 )
+ {
+ delta = ( len & 63 );
+ len &= -64;
+
+ if ( delta < 10 )
+ len += delta;
+
+ else if ( delta < 32 )
+ len += 10;
+
+ else if ( delta < 54 )
+ len += 54;
+
+ else
+ len += delta;
+ }
+ else
+ len = ( len + 32 ) & -64;
+ }
+
+ /* now that we have a good hinted stem width, try to position */
+ /* the stem along a pixel grid integer coordinate */
+ hint->cur_pos = pos + psh3_hint_snap_stem_side_delta( pos, len );
+ hint->cur_len = len;
+
+#else /* !STRONGER */
+
/* Stems less than one pixel wide are easy - we want to
* make them as dark as possible, so they must fall within
* one pixel. If the stem is split between two pixels
@@ -541,7 +591,7 @@
FT_Fixed delta_a, delta_b;
- if ( len & 64 )
+ if ( len & 64 )
{
delta_a = ( center & -64 ) + 32 - center;
delta_b = ( ( center + 32 ) & - 64 ) - center;
@@ -573,6 +623,7 @@
pos += delta_b;
}
hint->cur_pos = pos;
+#endif /* !STRONGER */
}
}
}
@@ -1712,7 +1763,7 @@
glyph->no_horz_hints = 0;
glyph->no_vert_hints = 0;
-
+
glyph->no_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_NORMAL ||
hint_mode == FT_RENDER_MODE_LCD_V );