Revert "Round when scaling values"
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 4 Sep 2013 00:11:01 +0000 (20:11 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 4 Sep 2013 00:11:01 +0000 (20:11 -0400)
This reverts commit 10f964623f003c70f6bdd33423420abda3820ce0.

See discussion with Khaled Hosny on mailing list.  In short, since
integers here can be negative, and int division is "round towards
zero", proper rounding should take sign into account.  Just skip
doing it again, has been serving us well before.

TODO
src/hb-font-private.hh

diff --git a/TODO b/TODO
index 08db6f9..e1aa39c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -12,6 +12,8 @@ General fixes:
 - Warn at compile time (and runtime with HB_DEBUG?) if no Unicode / font
   funcs found / set.
 
+- Do proper rounding when scaling from font space?  May be a non-issue.
+
 - Misc features:
   * init/medi/fina/isol for non-cursive scripts
 
index 620d05e..9638839 100644 (file)
@@ -397,11 +397,7 @@ struct hb_font_t {
   }
 
   private:
-  inline hb_position_t em_scale (int16_t v, int scale)
-  {
-    unsigned int upem = face->get_upem ();
-    return (v * (int64_t) scale + upem / 2) / upem;
-  }
+  inline hb_position_t em_scale (int16_t v, int scale) { return v * (int64_t) scale / face->get_upem (); }
 };
 
 #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS