servo: Handle when glyphs don't exist on mac
authorBrian Anderson <banderson@mozilla.com>
Thu, 06 Sep 2012 19:38:06 -0700
changeset 361890 4fc91b3bae6ce66d70b9a073b9f32b990edd3095
parent 361889 0bc2c5a42ffb97071587cfac90ba6fcdf12b912e
child 361891 d24d1405c7ea9e23e415085a77da05ce94b55681
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
servo: Handle when glyphs don't exist on mac Source-Repo: https://github.com/servo/servo Source-Revision: 19e1e39acc1030be97173c656ec3fa3b7535b78d
servo/src/servo/text/native_font/quartz_native_font.rs
--- a/servo/src/servo/text/native_font/quartz_native_font.rs
+++ b/servo/src/servo/text/native_font/quartz_native_font.rs
@@ -81,17 +81,20 @@ struct QuartzNativeFont/& {
         let count: CFIndex = 1;
 
         let result = do vec::as_buf(characters) |character_buf, _l| {
             do vec::as_buf(glyphs) |glyph_buf, _l| {
                 CTFontGetGlyphsForCharacters(ctfont, character_buf, glyph_buf, count)
             }
         };
 
-        assert result != false; // FIXME: error handling
+        if !result {
+            // No glyph for this character
+            return None;
+        }
 
         CFRelease(ctfont);
 
         assert glyphs[0] != 0; // FIXME: error handling
         return Some(glyphs[0] as GlyphIndex);
     }
 
     // FIXME: What unit is this returning? Let's have a custom type