Bug 1405790 - supply FontInstancePlatformOptions to WebRender. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Thu, 05 Oct 2017 15:26:01 -0400
changeset 385333 179ba985f5f9127f5a8df550a53d74379f4a7ff3
parent 385332 e44d51fdc331c548798f13ba1c584c124588e412
child 385334 20fa8f7c5cac22579e5acb0a295d127b43ac5c3a
push id32652
push userarchaeopteryx@coole-files.de
push dateTue, 10 Oct 2017 21:49:31 +0000
treeherdermozilla-central@f1ecd5c26948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1405790, 1406138
milestone58.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 1405790 - supply FontInstancePlatformOptions to WebRender. r=jrmuizel Patch originally developed in bug 1406138, but landed in bug 1405790 since it needs to land together with the upstream WR changes in PR 1816. MozReview-Commit-ID: IHVoKhVncd5
gfx/2d/2D.h
gfx/2d/ScaledFontDWrite.cpp
gfx/2d/ScaledFontDWrite.h
gfx/2d/ScaledFontFontconfig.cpp
gfx/2d/ScaledFontFontconfig.h
gfx/2d/ScaledFontMac.cpp
gfx/2d/ScaledFontMac.h
gfx/webrender_bindings/WebRenderTypes.h
gfx/webrender_bindings/cbindgen.toml
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/webrender_ffi_generated.h
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -68,17 +68,17 @@ struct gfxFontStyle;
 struct CGContext;
 typedef struct CGContext *CGContextRef;
 
 namespace mozilla {
 
 class Mutex;
 
 namespace wr {
-struct WrFontInstanceOptions;
+struct FontInstanceOptions;
 struct FontInstancePlatformOptions;
 }
 
 namespace gfx {
 class UnscaledFont;
 class ScaledFont;
 }
 
@@ -831,17 +831,17 @@ public:
   virtual void GetGlyphDesignMetrics(const uint16_t* aGlyphIndices, uint32_t aNumGlyphs, GlyphMetrics* aGlyphMetrics) = 0;
 
   typedef void (*FontInstanceDataOutput)(const uint8_t* aData, uint32_t aLength,
                                          const FontVariation* aVariations, uint32_t aNumVariations,
                                          void* aBaton);
 
   virtual bool GetFontInstanceData(FontInstanceDataOutput, void *) { return false; }
 
-  virtual bool GetWRFontInstanceOptions(Maybe<wr::WrFontInstanceOptions>* aOutOptions,
+  virtual bool GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions,
                                         Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
                                         std::vector<FontVariation>* aOutVariations)
   {
     return false;
   }
 
   virtual bool CanSerialize() { return false; }
 
--- a/gfx/2d/ScaledFontDWrite.cpp
+++ b/gfx/2d/ScaledFontDWrite.cpp
@@ -3,16 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ScaledFontDWrite.h"
 #include "UnscaledFontDWrite.h"
 #include "PathD2D.h"
 #include "gfxFont.h"
 #include "Logging.h"
+#include "mozilla/webrender/WebRenderTypes.h"
 
 using namespace std;
 
 #ifdef USE_SKIA
 #include "PathSkia.h"
 #include "skia/include/core/SkPaint.h"
 #include "skia/include/core/SkPath.h"
 #include "skia/include/ports/SkTypeface_win.h"
@@ -295,16 +296,38 @@ UnscaledFontDWrite::GetFontFileData(Font
 bool
 ScaledFontDWrite::GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton)
 {
   InstanceData instance(this);
   aCb(reinterpret_cast<uint8_t*>(&instance), sizeof(instance), nullptr, 0, aBaton);
   return true;
 }
 
+bool
+ScaledFontDWrite::GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions,
+                                           Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
+                                           std::vector<FontVariation>* aOutVariations)
+{
+  AntialiasMode aaMode = GetDefaultAAMode();
+  if (aaMode != AntialiasMode::SUBPIXEL) {
+    wr::FontInstanceOptions options;
+    options.render_mode =
+      aaMode == AntialiasMode::NONE ? wr::FontRenderMode::Mono : wr::FontRenderMode::Alpha;
+    options.subpx_dir = wr::SubpixelDirection::Horizontal;
+    options.synthetic_italics = false;
+    *aOutOptions = Some(options);
+  }
+
+  wr::FontInstancePlatformOptions platformOptions;
+  platformOptions.use_embedded_bitmap = UseEmbeddedBitmaps();
+  platformOptions.force_gdi_rendering = ForceGDIMode();
+  *aOutPlatformOptions = Some(platformOptions);
+  return true;
+}
+
 already_AddRefed<ScaledFont>
 UnscaledFontDWrite::CreateScaledFont(Float aGlyphSize,
                                      const uint8_t* aInstanceData,
                                      uint32_t aInstanceDataLength,
                                      const FontVariation* aVariations,
                                      uint32_t aNumVariations)
 {
   if (aInstanceDataLength < sizeof(ScaledFontDWrite::InstanceData)) {
--- a/gfx/2d/ScaledFontDWrite.h
+++ b/gfx/2d/ScaledFontDWrite.h
@@ -51,16 +51,20 @@ public:
   void CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink);
 
   void GetGlyphDesignMetrics(const uint16_t* aGlyphIndices, uint32_t aNumGlyphs, GlyphMetrics* aGlyphMetrics) override;
 
   bool CanSerialize() override { return true; }
 
   bool GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton) override;
 
+  bool GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions,
+                                Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
+                                std::vector<FontVariation>* aOutVariations) override;
+
   AntialiasMode GetDefaultAAMode() override;
 
   bool UseEmbeddedBitmaps() { return mUseEmbeddedBitmap; }
   bool ForceGDIMode() { return mForceGDIMode; }
 
 #ifdef USE_SKIA
   SkTypeface* GetSkTypeface() override;
   SkFontStyle mStyle;
--- a/gfx/2d/ScaledFontFontconfig.cpp
+++ b/gfx/2d/ScaledFontFontconfig.cpp
@@ -1,24 +1,36 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ScaledFontFontconfig.h"
 #include "UnscaledFontFreeType.h"
 #include "Logging.h"
+#include "mozilla/webrender/WebRenderTypes.h"
 
 #ifdef USE_SKIA
 #include "skia/include/ports/SkTypeface_cairo.h"
 #endif
 
 #include <fontconfig/fcfreetype.h>
 
 namespace mozilla {
+namespace wr {
+  enum {
+    FONT_FORCE_AUTOHINT  = 1 << 0,
+    FONT_NO_AUTOHINT     = 1 << 1,
+    FONT_EMBEDDED_BITMAP = 1 << 2,
+    FONT_EMBOLDEN        = 1 << 3,
+    FONT_VERTICAL_LAYOUT = 1 << 4,
+    FONT_SUBPIXEL_BGR    = 1 << 5
+  };
+}
+
 namespace gfx {
 
 // On Linux and Android our "platform" font is a cairo_scaled_font_t and we use
 // an SkFontHost implementation that allows Skia to render using this.
 // This is mainly because FT_Face is not good for sharing between libraries, which
 // is a requirement when we consider runtime switchable backends and so on
 ScaledFontFontconfig::ScaledFontFontconfig(cairo_scaled_font_t* aScaledFont,
                                            FcPattern* aPattern,
@@ -226,16 +238,134 @@ bool
 ScaledFontFontconfig::GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton)
 {
   InstanceData instance(GetCairoScaledFont(), mPattern);
 
   aCb(reinterpret_cast<uint8_t*>(&instance), sizeof(instance), nullptr, 0, aBaton);
   return true;
 }
 
+bool
+ScaledFontFontconfig::GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions,
+                                               Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
+                                               std::vector<FontVariation>* aOutVariations)
+{
+  wr::FontInstanceOptions options;
+  options.render_mode = wr::FontRenderMode::Alpha;
+  options.subpx_dir = wr::SubpixelDirection::Horizontal;
+  options.synthetic_italics = false;
+
+  wr::FontInstancePlatformOptions platformOptions;
+  platformOptions.flags = 0;
+  platformOptions.lcd_filter = wr::FontLCDFilter::Legacy;
+  platformOptions.hinting = wr::FontHinting::Normal;
+
+  FcBool autohint;
+  if (FcPatternGetBool(mPattern, FC_AUTOHINT, 0, &autohint) == FcResultMatch && autohint) {
+    platformOptions.flags |= wr::FONT_FORCE_AUTOHINT;
+  }
+  FcBool embolden;
+  if (FcPatternGetBool(mPattern, FC_EMBOLDEN, 0, &embolden) == FcResultMatch && embolden) {
+    platformOptions.flags |= wr::FONT_EMBOLDEN;
+  }
+  FcBool vertical;
+  if (FcPatternGetBool(mPattern, FC_VERTICAL_LAYOUT, 0, &vertical) == FcResultMatch && vertical) {
+    platformOptions.flags |= wr::FONT_VERTICAL_LAYOUT;
+  }
+
+  FcBool antialias;
+  if (FcPatternGetBool(mPattern, FC_ANTIALIAS, 0, &antialias) != FcResultMatch || antialias) {
+    int rgba;
+    if (FcPatternGetInteger(mPattern, FC_RGBA, 0, &rgba) == FcResultMatch) {
+      switch (rgba) {
+        case FC_RGBA_RGB:
+        case FC_RGBA_BGR:
+        case FC_RGBA_VRGB:
+        case FC_RGBA_VBGR:
+            options.render_mode = wr::FontRenderMode::Subpixel;
+            if (rgba == FC_RGBA_VRGB || rgba == FC_RGBA_VBGR) {
+                options.subpx_dir = wr::SubpixelDirection::Vertical;
+            }
+            platformOptions.hinting = wr::FontHinting::LCD;
+            if (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR) {
+                platformOptions.flags |= wr::FONT_SUBPIXEL_BGR;
+            }
+            break;
+        case FC_RGBA_NONE:
+        case FC_RGBA_UNKNOWN:
+        default:
+          break;
+      }
+    }
+
+    if (options.render_mode == wr::FontRenderMode::Subpixel) {
+      int filter;
+      if (FcPatternGetInteger(mPattern, FC_LCD_FILTER, 0, &filter) == FcResultMatch) {
+        switch (filter) {
+        case FC_LCD_NONE:
+          platformOptions.lcd_filter = wr::FontLCDFilter::None;
+          break;
+        case FC_LCD_DEFAULT:
+          platformOptions.lcd_filter = wr::FontLCDFilter::Default;
+          break;
+        case FC_LCD_LIGHT:
+          platformOptions.lcd_filter = wr::FontLCDFilter::Light;
+          break;
+        case FC_LCD_LEGACY:
+        default:
+          break;
+        }
+      }
+    }
+
+    // Match cairo-ft's handling of embeddedbitmap:
+    // If AA is explicitly disabled, leave bitmaps enabled.
+    // Otherwise, disable embedded bitmaps unless explicitly enabled.
+    FcBool bitmap;
+    if (FcPatternGetBool(mPattern, FC_EMBEDDED_BITMAP, 0, &bitmap) == FcResultMatch && bitmap) {
+      platformOptions.flags |= wr::FONT_EMBEDDED_BITMAP;
+    }
+  } else {
+    options.render_mode = wr::FontRenderMode::Mono;
+    options.subpx_dir = wr::SubpixelDirection::None;
+    platformOptions.hinting = wr::FontHinting::Mono;
+    platformOptions.flags |= wr::FONT_EMBEDDED_BITMAP;
+  }
+
+  FcBool hinting;
+  int hintstyle;
+  if (FcPatternGetBool(mPattern, FC_HINTING, 0, &hinting) != FcResultMatch || hinting) {
+    if (FcPatternGetInteger(mPattern, FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch) {
+        hintstyle = FC_HINT_FULL;
+    }
+  } else {
+    hintstyle = FC_HINT_NONE;
+  }
+
+  if (hintstyle == FC_HINT_NONE) {
+    platformOptions.hinting = wr::FontHinting::None;
+  } else if (options.render_mode != wr::FontRenderMode::Mono) {
+    switch (hintstyle) {
+    case FC_HINT_SLIGHT:
+      platformOptions.hinting = wr::FontHinting::Light;
+      break;
+    case FC_HINT_MEDIUM:
+      platformOptions.hinting = wr::FontHinting::Normal;
+      break;
+    case FC_HINT_FULL:
+    default:
+      break;
+    }
+  }
+
+  *aOutOptions = Some(options);
+  *aOutPlatformOptions = Some(platformOptions);
+  return true;
+}
+
 already_AddRefed<ScaledFont>
 UnscaledFontFontconfig::CreateScaledFont(Float aGlyphSize,
                                          const uint8_t* aInstanceData,
                                          uint32_t aInstanceDataLength,
                                          const FontVariation* aVariations,
                                          uint32_t aNumVariations)
 {
   if (aInstanceDataLength < sizeof(ScaledFontFontconfig::InstanceData)) {
--- a/gfx/2d/ScaledFontFontconfig.h
+++ b/gfx/2d/ScaledFontFontconfig.h
@@ -29,16 +29,20 @@ public:
 #ifdef USE_SKIA
   SkTypeface* GetSkTypeface() override;
 #endif
 
   bool CanSerialize() override { return true; }
 
   bool GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton) override;
 
+  bool GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions,
+                                Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
+                                std::vector<FontVariation>* aOutVariations) override;
+
 private:
   friend class NativeFontResourceFontconfig;
   friend class UnscaledFontFontconfig;
 
   struct InstanceData
   {
     enum {
       ANTIALIAS       = 1 << 0,
--- a/gfx/2d/ScaledFontMac.cpp
+++ b/gfx/2d/ScaledFontMac.cpp
@@ -354,17 +354,17 @@ ScaledFontMac::GetFontInstanceData(FontI
     if (!GetVariationsForCTFont(mCTFont, &variations)) {
       return false;
     }
     aCb(nullptr, 0, variations.data(), variations.size(), aBaton);
     return true;
 }
 
 bool
-ScaledFontMac::GetWRFontInstanceOptions(Maybe<wr::WrFontInstanceOptions>* aOutOptions,
+ScaledFontMac::GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions,
                                         Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
                                         std::vector<FontVariation>* aOutVariations)
 {
     if (!GetVariationsForCTFont(mCTFont, aOutVariations)) {
       return false;
     }
     return true;
 }
--- a/gfx/2d/ScaledFontMac.h
+++ b/gfx/2d/ScaledFontMac.h
@@ -47,17 +47,17 @@ public:
   FontType GetType() const override { return FontType::MAC; }
 #ifdef USE_SKIA
   SkTypeface* GetSkTypeface() override;
 #endif
   already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) override;
 
   bool GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton) override;
 
-  bool GetWRFontInstanceOptions(Maybe<wr::WrFontInstanceOptions>* aOutOptions,
+  bool GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions,
                                 Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
                                 std::vector<FontVariation>* aOutVariations) override;
 
   bool CanSerialize() override { return true; }
 
 #ifdef USE_CAIRO_SCALED_FONT
   cairo_font_face_t* GetCairoFontFace() override;
 #endif
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -23,17 +23,16 @@
 namespace mozilla {
 namespace wr {
 
 typedef wr::WrWindowId WindowId;
 typedef wr::WrPipelineId PipelineId;
 typedef wr::WrImageKey ImageKey;
 typedef wr::WrFontKey FontKey;
 typedef wr::WrFontInstanceKey FontInstanceKey;
-typedef wr::WrFontInstanceOptions FontInstanceOptions;
 typedef wr::WrEpoch Epoch;
 typedef wr::WrExternalImageId ExternalImageId;
 typedef wr::WrDebugFlags DebugFlags;
 
 typedef mozilla::Maybe<mozilla::wr::WrImageMask> MaybeImageMask;
 typedef Maybe<ExternalImageId> MaybeExternalImageId;
 
 typedef Maybe<FontInstanceOptions> MaybeFontInstanceOptions;
--- a/gfx/webrender_bindings/cbindgen.toml
+++ b/gfx/webrender_bindings/cbindgen.toml
@@ -26,8 +26,13 @@ args = "Vertical"
 rename_args = "GeckoCase"
 
 [struct]
 derive_eq = true
 generic_template_specialization = false
 
 [enum]
 add_sentinel = true
+
+[defines]
+"target_os = windows" = "XP_WIN"
+"target_os = macos" = "XP_MACOSX"
+
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -171,32 +171,16 @@ impl MutByteSlice {
 
     pub fn as_mut_slice(&mut self) -> &mut [u8] {
         make_slice_mut(self.buffer, self.len)
     }
 }
 
 #[repr(C)]
 #[derive(Debug, Clone, Copy)]
-pub struct WrFontInstanceOptions {
-    pub render_mode: FontRenderMode,
-    pub synthetic_italics: bool,
-}
-
-impl Into<FontInstanceOptions> for WrFontInstanceOptions {
-    fn into(self) -> FontInstanceOptions {
-        FontInstanceOptions {
-            render_mode: Some(self.render_mode),
-            synthetic_italics: self.synthetic_italics,
-        }
-    }
-}
-
-#[repr(C)]
-#[derive(Debug, Clone, Copy)]
 pub struct WrImageMask {
     image: WrImageKey,
     rect: LayoutRect,
     repeat: bool,
 }
 
 impl Into<ImageMask> for WrImageMask {
     fn into(self) -> ImageMask {
@@ -980,28 +964,25 @@ pub extern "C" fn wr_resource_updates_de
 }
 
 #[no_mangle]
 pub extern "C" fn wr_resource_updates_add_font_instance(
     resources: &mut ResourceUpdates,
     key: WrFontInstanceKey,
     font_key: WrFontKey,
     glyph_size: f32,
-    options: *const WrFontInstanceOptions,
+    options: *const FontInstanceOptions,
     platform_options: *const FontInstancePlatformOptions,
     variations: &mut WrVecU8,
 ) {
-    let instance_options: Option<FontInstanceOptions> = unsafe {
-        options.as_ref().map(|opts|{ (*opts).into() })
-    };
     resources.add_font_instance(
         key,
         font_key,
         Au::from_f32_px(glyph_size),
-        instance_options,
+        unsafe { options.as_ref().cloned() },
         unsafe { platform_options.as_ref().cloned() },
         variations.convert_into_vec::<FontVariation>(),
     );
 }
 
 #[no_mangle]
 pub extern "C" fn wr_resource_updates_delete_font_instance(
     resources: &mut ResourceUpdates,
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -54,34 +54,38 @@ enum class ExternalImageType : uint32_t 
   Texture2DArrayHandle = 1,
   TextureRectHandle = 2,
   TextureExternalHandle = 3,
   ExternalBuffer = 4,
 
   Sentinel /* this must be last for serialization purposes. */
 };
 
+#if !(defined(XP_MACOSX) || defined(XP_WIN))
 enum class FontHinting : uint8_t {
   None = 0,
   Mono = 1,
   Light = 2,
   Normal = 3,
   LCD = 4,
 
   Sentinel /* this must be last for serialization purposes. */
 };
+#endif
 
+#if !(defined(XP_MACOSX) || defined(XP_WIN))
 enum class FontLCDFilter : uint8_t {
   None = 0,
   Default = 1,
   Light = 2,
   Legacy = 3,
 
   Sentinel /* this must be last for serialization purposes. */
 };
+#endif
 
 enum class FontRenderMode : uint32_t {
   Mono = 0,
   Alpha = 1,
   Subpixel = 2,
   Bitmap = 3,
 
   Sentinel /* this must be last for serialization purposes. */
@@ -147,16 +151,24 @@ enum class RepeatMode : uint32_t {
   Stretch = 0,
   Repeat = 1,
   Round = 2,
   Space = 3,
 
   Sentinel /* this must be last for serialization purposes. */
 };
 
+enum class SubpixelDirection : uint32_t {
+  None = 0,
+  Horizontal = 1,
+  Vertical = 2,
+
+  Sentinel /* this must be last for serialization purposes. */
+};
+
 enum class TransformStyle : uint32_t {
   Flat = 0,
   Preserve3D = 1,
 
   Sentinel /* this must be last for serialization purposes. */
 };
 
 enum class WrExternalImageType : uint32_t {
@@ -743,55 +755,63 @@ struct FontKey {
   bool operator==(const FontKey& aOther) const {
     return mNamespace == aOther.mNamespace &&
            mHandle == aOther.mHandle;
   }
 };
 
 typedef FontKey WrFontKey;
 
-struct WrFontInstanceOptions {
+struct FontInstanceOptions {
   FontRenderMode render_mode;
+  SubpixelDirection subpx_dir;
   bool synthetic_italics;
 
-  bool operator==(const WrFontInstanceOptions& aOther) const {
+  bool operator==(const FontInstanceOptions& aOther) const {
     return render_mode == aOther.render_mode &&
+           subpx_dir == aOther.subpx_dir &&
            synthetic_italics == aOther.synthetic_italics;
   }
 };
 
+#if defined(XP_WIN)
 struct FontInstancePlatformOptions {
   bool use_embedded_bitmap;
   bool force_gdi_rendering;
 
   bool operator==(const FontInstancePlatformOptions& aOther) const {
     return use_embedded_bitmap == aOther.use_embedded_bitmap &&
            force_gdi_rendering == aOther.force_gdi_rendering;
   }
 };
+#endif
 
+#if defined(XP_MACOSX)
 struct FontInstancePlatformOptions {
   uint32_t unused;
 
   bool operator==(const FontInstancePlatformOptions& aOther) const {
     return unused == aOther.unused;
   }
 };
+#endif
 
+#if !(defined(XP_MACOSX) || defined(XP_WIN))
 struct FontInstancePlatformOptions {
   uint16_t flags;
   FontLCDFilter lcd_filter;
   FontHinting hinting;
 
   bool operator==(const FontInstancePlatformOptions& aOther) const {
     return flags == aOther.flags &&
            lcd_filter == aOther.lcd_filter &&
            hinting == aOther.hinting;
   }
 };
+#endif
 
 /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
  * To generate this file:
  *   1. Get the latest cbindgen using `cargo install --force cbindgen`
  *      a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
  *   2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
  */
 
@@ -1243,17 +1263,17 @@ void wr_resource_updates_add_external_im
                                             uint8_t aChannelIndex)
 WR_FUNC;
 
 WR_INLINE
 void wr_resource_updates_add_font_instance(ResourceUpdates *aResources,
                                            WrFontInstanceKey aKey,
                                            WrFontKey aFontKey,
                                            float aGlyphSize,
-                                           const WrFontInstanceOptions *aOptions,
+                                           const FontInstanceOptions *aOptions,
                                            const FontInstancePlatformOptions *aPlatformOptions,
                                            WrVecU8 *aVariations)
 WR_FUNC;
 
 WR_INLINE
 void wr_resource_updates_add_image(ResourceUpdates *aResources,
                                    WrImageKey aImageKey,
                                    const WrImageDescriptor *aDescriptor,