summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2002-03-06 23:18:55 +0000
committerDavid Turner <david@freetype.org>2002-03-06 23:18:55 +0000
commitf6dc81e5d2cb80f2e30e32dc7a7f29ca6ad8f07f (patch)
treef1f71758a533ab7214350dca6bf4f19e33a38b47
parent7e7dae1bc51e3bf494c687a98968e11a68d9c90e (diff)
downloadfreetype2-f6dc81e5d2cb80f2e30e32dc7a7f29ca6ad8f07f.tar.gz
* docs/CHANGES: update to indicate the new FT_Library_Version API
and the small quality improvement in the Postscript hinter.. * src/pshinter/pshglob.c: fixed a small bug that created un-even stem widths when hinting Postscript fonts. A small fix with pretty important improvements in quality of Postscript hinting !!
-rw-r--r--ChangeLog7
-rw-r--r--docs/CHANGES11
-rw-r--r--src/base/ftobjs.c2
-rw-r--r--src/pshinter/pshglob.c73
4 files changed, 89 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index aa5a5aa95..27ec4cea7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2002-03-06 David Turner <david@freetype.org>
+ * docs/CHANGES: update to indicate the new FT_Library_Version API
+ and the small quality improvement in the Postscript hinter..
+
+ * src/pshinter/pshglob.c: fixed a small bug that created un-even
+ stem widths when hinting Postscript fonts. A small fix with pretty
+ important improvements in quality of Postscript hinting !!
+
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
src/base/ftobjs.c, src/base/ftinit.c: adding the new FT_Library_Version
API to return the library's current version in dynamic links.
diff --git a/docs/CHANGES b/docs/CHANGES
index 05965b3de..069159b8e 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -20,9 +20,20 @@ LATESET CHANGES BETWEEN 2.0.9 and 2.0.8
- FreeType 2 should now compile fine on AIX 4.3.3 as a shared library.
+ - A bug in the Postscript hinter has been found and fixed. You shouldn't
+ be experimenting un-even stem widths at small pixel sizes (like 14-17).
+
+ This improves the quality of a certain number of Postscript fonts :o)
+
II. NEW FEATURES:
+ - A new function named FT_Library_Version has been added to return
+ the current library's major, minor and patch version numbers. This
+ is important since the macros FREETYPE_MAJOR, FREETYPE_MINOR and
+ FREETYPE_PATCH cannot be used when the library is dynamically linked
+ by a program..
+
- Two new APIs have been added: FT_Get_First_Char and FT_Get_Next_Char.
Together, these can be used to iterate efficiently over the currently
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 40b696bab..9e2b613d9 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2690,6 +2690,7 @@
/* documentation is in freetype.h */
+
FT_EXPORT_DEF( void )
FT_Library_Version( FT_Library library,
FT_Int *amajor,
@@ -2699,6 +2700,7 @@
FT_Int major = 0;
FT_Int minor = 0;
FT_Int patch = 0;
+
if ( library )
{
diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c
index 4e175a897..5a06cf979 100644
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -45,13 +45,33 @@
PSH_Widths stdw = &dim->stdw;
FT_UInt count = stdw->count;
PSH_Width width = stdw->widths;
+ PSH_Width stand = width; /* standard width/height */
FT_Fixed scale = dim->scale_mult;
-
- for ( ; count > 0; count--, width++ )
+
+ if ( count > 0 )
{
width->cur = FT_MulFix( width->org, scale );
width->fit = FT_RoundFix( width->cur );
+
+ width++;
+ count--;
+
+ for ( ; count > 0; count--, width++ )
+ {
+ FT_Pos w, dist;
+
+ w = FT_MulFix( width->org, scale );
+ dist = w - stand->cur;
+ if ( dist < 0 )
+ dist = -dist;
+
+ if ( dist < 128 )
+ w = stand->cur;
+
+ width->cur = w;
+ width->fit = FT_RoundFix(w);
+ }
}
}
@@ -61,6 +81,50 @@
psh_dimension_snap_width( PSH_Dimension dimension,
FT_Int org_width )
{
+#if 0
+ FT_UInt n;
+ FT_Pos width;
+ FT_Pos delta, best = 32000;
+ FT_Int reference = -1;
+
+ /* find the standard width nearest 'org_width' in font units */
+ for ( n = 0; n < dimension->stdw.count; n++ )
+ {
+ FT_Pos w;
+ FT_Pos dist;
+
+ w = dimension->stdw.widths[n].org;
+ dist = org_width - w;
+ if ( dist < 0 )
+ dist = -dist;
+
+ if ( dist < best )
+ {
+ best = dist;
+ reference = n;
+ }
+ }
+
+ /* if the scaled best distance is smaller than 1.5 pixels, we */
+ /* snap the width to the 'best' one, otherwise we simply round */
+ /* it.. */
+ if ( reference < 0 )
+ {
+ Simple_Round:
+ width = FT_MulFix( org_width, dimension->scale_mult );
+ width = (width + 32) & -64;
+ if ( width == 0 )
+ width = 64;
+
+ return width;
+ }
+
+ delta = FT_MulFix( best, dimension->scale_mult );
+ if ( delta >= 128 || delta <= -128 )
+ goto Simple_Round;
+
+ return dimension->stdw.widths[n].fit;
+#else
FT_UInt n;
FT_Pos width = FT_MulFix( org_width, dimension->scale_mult );
FT_Pos best = 64 + 32 + 2;
@@ -96,6 +160,7 @@
if ( width > reference )
width = reference;
}
+#endif
return width;
}
@@ -600,7 +665,7 @@
PSH_Width write = dim->stdw.widths;
- write->org = priv->standard_width[1];
+ write->org = priv->standard_width[0];
write++;
read = priv->snap_widths;
@@ -620,7 +685,7 @@
PSH_Width write = dim->stdw.widths;
- write->org = priv->standard_height[1];
+ write->org = priv->standard_height[0];
write++;
read = priv->snap_heights;