Commit dcb8b7103fc8692cce093247188249fb786de2ff

Wu, Chia-I (吳佳一) 2005-12-16T14:27:14

* include/freetype/internal/ftobjs.h (ft_glyphslot_grid_fit_metrics), src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Removed. * src/base/ftobjs.c (ft_recompute_scaled_metrics): Do not round. * src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c (cid_slot_load_glyph), src/truetype/ttgload.c (compute_glyph_metrics), src/type1/t1gload.c (T1_Load_Glyph): Do not round glyph metrics. * doc/CHANGES: Mention the changes.

diff --git a/ChangeLog b/ChangeLog
index b103a8d..edbf1dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-12-16  Chia-I Wu  <b90201047@ntu.edu.tw>
+
+	* include/freetype/internal/ftobjs.h (ft_glyphslot_grid_fit_metrics),
+	src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Removed.
+
+	* src/base/ftobjs.c (ft_recompute_scaled_metrics): Do not round.
+
+	* src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c
+	(cid_slot_load_glyph), src/truetype/ttgload.c (compute_glyph_metrics),
+	src/type1/t1gload.c (T1_Load_Glyph): Do not round glyph metrics.
+
+	* doc/CHANGES: Mention the changes.
+
 2005-12-13  David Turner  <david@freetype.org>
 
 	* src/autofit/aflatin.c, src/autofit/afhints.c: changed the
diff --git a/docs/CHANGES b/docs/CHANGES
index 0365534..37ed7eb 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -14,6 +14,10 @@ LATEST CHANGES BETWEEN 2.2.0 and 2.1.10
 
   II. IMPORTANT CHANGES
 
+    - Face metrics (face->size->metrics) and glyph metrics are no
+      longer rounded.  If you do not round in your applications too,
+      you may find glyphs become blurry.
+
     - A  new API  `FT_TrueTypeGX_Validate'  (in FT_GX_VALIDATE_H)  has
       been added to validate TrueType GX/ATT tables (feat, mort, morx,
       bsln, just, kern, opbd, trak,  prop).  After validation it is no
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index ca5196a..49f6800 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -452,13 +452,6 @@ FT_BEGIN_HEADER
  /* */
 
  /*
-  * grid-fit slot->metrics
-  */
-  FT_BASE( void )
-  ft_glyphslot_grid_fit_metrics( FT_GlyphSlot  slot );
-
-
- /*
   * Free the bitmap of a given glyphslot when needed
   * (i.e., only when it was allocated with ft_glyphslot_alloc_bitmap).
   */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 5199e29..84436e1 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -251,29 +251,6 @@
 
 
   FT_BASE_DEF( void )
-  ft_glyphslot_grid_fit_metrics( FT_GlyphSlot  slot )
-  {
-    FT_Pos  tmp;
-
-
-    tmp = FT_PIX_CEIL( slot->metrics.horiBearingX + slot->metrics.width );
-    slot->metrics.horiBearingX = FT_PIX_FLOOR( slot->metrics.horiBearingX );
-    slot->metrics.width        = tmp - slot->metrics.horiBearingX;
-
-    tmp = FT_PIX_FLOOR( slot->metrics.horiBearingY - slot->metrics.height );
-    slot->metrics.horiBearingY = FT_PIX_CEIL( slot->metrics.horiBearingY );
-    slot->metrics.height       = slot->metrics.horiBearingY - tmp;
-
-    slot->metrics.horiAdvance  = FT_PIX_ROUND( slot->metrics.horiAdvance );
-
-    slot->metrics.vertBearingX = FT_PIX_FLOOR( slot->metrics.vertBearingX );
-    /* note that vertBearingY should be floor'ed */
-    slot->metrics.vertBearingY = FT_PIX_FLOOR( slot->metrics.vertBearingY );
-    slot->metrics.vertAdvance  = FT_PIX_ROUND( slot->metrics.vertAdvance );
-  }
-
-
-  FT_BASE_DEF( void )
   ft_glyphslot_set_bitmap( FT_GlyphSlot  slot,
                            FT_Byte*      buffer )
   {
@@ -1983,17 +1960,17 @@
   {
     /* Compute root ascender, descender, test height, and max_advance */
 
-    metrics->ascender    = FT_PIX_CEIL( FT_MulFix( face->ascender,
-                                                   metrics->y_scale ) );
+    metrics->ascender    = FT_MulFix( face->ascender,
+                                      metrics->y_scale );
 
-    metrics->descender   = FT_PIX_FLOOR( FT_MulFix( face->descender,
-                                                    metrics->y_scale ) );
+    metrics->descender   = FT_MulFix( face->descender,
+                                      metrics->y_scale );
 
-    metrics->height      = FT_PIX_ROUND( FT_MulFix( face->height,
-                                                    metrics->y_scale ) );
+    metrics->height      = FT_MulFix( face->height,
+                                      metrics->y_scale );
 
-    metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,
-                                                    metrics->x_scale ) );
+    metrics->max_advance = FT_MulFix( face->max_advance_width,
+                                      metrics->x_scale );
   }
 
 
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 7ac2fcd..ef67835 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -2687,9 +2687,6 @@
 
         metrics->horiBearingX = cbox.xMin;
         metrics->horiBearingY = cbox.yMax;
-
-        if ( hinting )
-          ft_glyphslot_grid_fit_metrics( &glyph->root );
       }
     }
 
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index d61d959..12d749d 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -402,9 +402,6 @@
         /* make up vertical ones */
         metrics->vertBearingX = 0;
         metrics->vertBearingY = 0;
-
-        if ( hinting )
-          ft_glyphslot_grid_fit_metrics( cidglyph );
       }
     }
 
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index bdd0a06..ebbd7a0 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1801,9 +1801,6 @@
     glyph->metrics.width  = bbox.xMax - bbox.xMin;
     glyph->metrics.height = bbox.yMax - bbox.yMin;
 
-    if ( IS_HINTED( loader->load_flags ) )
-      ft_glyphslot_grid_fit_metrics( glyph );
-
     return 0;
   }
 
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 54c9b68..88c57da 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -359,9 +359,6 @@
         /* make up vertical ones */
         metrics->vertBearingX = 0;
         metrics->vertBearingY = 0;
-
-        if ( hinting )
-          ft_glyphslot_grid_fit_metrics( &glyph->root );
       }
 
       /* Set control data to the glyph charstrings.  Note that this is */