Bug 1099977. Part 1.5: Make gfxFT2FontBase::GetSpaceGlyph work for zero-sized fonts. r=jfkthame
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 19 Nov 2014 22:41:42 +1300
changeset 223460 953dbdb984be9537822d9db51b42e4ee4be8bf14
parent 223459 02f84b2d07ba32457d15cafc52f9cd19c214b1b0
child 223461 5af10836905a5991a1da8b2deda8c908c978155f
push id28095
push usercbook@mozilla.com
push dateTue, 13 Jan 2015 13:24:48 +0000
treeherdermozilla-central@a5700bec72e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1099977
milestone38.0a1
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 1099977. Part 1.5: Make gfxFT2FontBase::GetSpaceGlyph work for zero-sized fonts. r=jfkthame
gfx/thebes/gfxFT2FontBase.cpp
--- a/gfx/thebes/gfxFT2FontBase.cpp
+++ b/gfx/thebes/gfxFT2FontBase.cpp
@@ -111,17 +111,17 @@ gfxFT2FontBase::GetGlyphExtents(uint32_t
 const gfxFont::Metrics&
 gfxFT2FontBase::GetHorizontalMetrics()
 {
     if (mHasMetrics)
         return mMetrics;
 
     if (MOZ_UNLIKELY(GetStyle()->size <= 0.0)) {
         new(&mMetrics) gfxFont::Metrics(); // zero initialize
-        mSpaceGlyph = 0;
+        mSpaceGlyph = GetGlyph(' ');
     } else {
         gfxFT2LockedFace face(this);
         face.GetMetrics(&mMetrics, &mSpaceGlyph);
     }
 
     SanitizeMetrics(&mMetrics, false);
 
 #if 0
@@ -139,18 +139,16 @@ gfxFT2FontBase::GetHorizontalMetrics()
     mHasMetrics = true;
     return mMetrics;
 }
 
 // Get the glyphID of a space
 uint32_t
 gfxFT2FontBase::GetSpaceGlyph()
 {
-    NS_ASSERTION(GetStyle()->size != 0,
-                 "forgot to short-circuit a text run with zero-sized font?");
     GetHorizontalMetrics();
     return mSpaceGlyph;
 }
 
 uint32_t
 gfxFT2FontBase::GetGlyph(uint32_t unicode, uint32_t variation_selector)
 {
     if (variation_selector) {