Bug 610554. Round advances rather than truncating them. r=karlt a=blocking-fennec
authorStuart Parmenter <stuart@mozilla.com>
Tue, 09 Nov 2010 12:18:17 -0800
changeset 57165 09d926c185f6909f070e54f8804fafaed5f2df90
parent 57164 924808901dce90dd7897992ff990f3cc58bd6e62
child 57166 f11c25226916df9762722c11eba2f3a2ee33f905
push id16825
push userpavlov@mozilla.com
push dateTue, 09 Nov 2010 20:18:51 +0000
treeherdermozilla-central@09d926c185f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, blocking-fennec
bugs610554
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 610554. Round advances rather than truncating them. r=karlt a=blocking-fennec
gfx/thebes/gfxFT2Fonts.cpp
--- a/gfx/thebes/gfxFT2Fonts.cpp
+++ b/gfx/thebes/gfxFT2Fonts.cpp
@@ -799,18 +799,20 @@ gfxFT2FontGroup::AddRange(gfxTextRun *aT
                 advance += kerning.x;
                 if (cgd->rsbDelta - lsbDeltaNext >= 32) {
                     advance -= 64;
                 } else if (cgd->rsbDelta - lsbDeltaNext < -32) {
                     advance += 64;
                 }
             }
 
-            // now apply unit conversion and scaling
-            advance = MOZ_FT_TRUNC(advance) * appUnitsPerDevUnit;
+            // convert 26.6 fixed point to app units
+            // round rather than truncate to nearest pixel
+            // because these advances are often scaled
+            advance = ((advance * appUnitsPerDevUnit + 32) >> 6);
         }
 #ifdef DEBUG_thebes_2
         printf(" gid=%d, advance=%d (%s)\n", gid, advance,
                NS_LossyConvertUTF16toASCII(font->GetName()).get());
 #endif
 
         if (advance >= 0 &&
             gfxTextRun::CompressedGlyph::IsSimpleAdvance(advance) &&