summaryrefslogtreecommitdiff
path: root/gfx/2d
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/2d')
-rw-r--r--gfx/2d/2D.h5
-rw-r--r--gfx/2d/Factory.cpp21
2 files changed, 26 insertions, 0 deletions
diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h
index 89de5630c6..e2020dc9e6 100644
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -1481,6 +1481,11 @@ public:
static already_AddRefed<DrawTarget> CreateDrawTargetWithSkCanvas(SkCanvas* aCanvas);
#endif
+#ifdef XP_DARWIN
+ static already_AddRefed<GlyphRenderingOptions>
+ CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor);
+#endif
+
#ifdef WIN32
static already_AddRefed<DrawTarget> CreateDrawTargetForD3D11Texture(ID3D11Texture2D *aTexture, SurfaceFormat aFormat);
diff --git a/gfx/2d/Factory.cpp b/gfx/2d/Factory.cpp
index 22352b20c6..5cd5d14eab 100644
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -25,6 +25,11 @@
#include "NativeFontResourceGDI.h"
#endif
+#ifdef XP_DARWIN
+#include "ScaledFontMac.h"
+#include "NativeFontResourceMac.h"
+#endif
+
#ifdef MOZ_WIDGET_GTK
#include "ScaledFontFontconfig.h"
#endif
@@ -476,6 +481,12 @@ Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSiz
}
#endif
#endif
+#ifdef XP_DARWIN
+ case NativeFontType::MAC_FONT_FACE:
+ {
+ return MakeAndAddRef<ScaledFontMac>(static_cast<CGFontRef>(aNativeFont.mFont), aSize);
+ }
+#endif
#if defined(USE_CAIRO) || defined(USE_SKIA_FREETYPE)
case NativeFontType::CAIRO_FONT_FACE:
{
@@ -513,6 +524,8 @@ Factory::CreateNativeFontResource(uint8_t *aData, uint32_t aSize,
return NativeFontResourceGDI::Create(aData, aSize,
/* aNeedsCairo = */ true);
}
+#elif XP_DARWIN
+ return NativeFontResourceMac::Create(aData, aSize);
#else
gfxWarning() << "Unable to create cairo scaled font from truetype data";
return nullptr;
@@ -789,6 +802,14 @@ Factory::CreateWrappingDataSourceSurface(uint8_t *aData,
return newSurf.forget();
}
+#ifdef XP_DARWIN
+already_AddRefed<GlyphRenderingOptions>
+Factory::CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor)
+{
+ return MakeAndAddRef<GlyphRenderingOptionsCG>(aFontSmoothingBackgroundColor);
+}
+#endif
+
already_AddRefed<DataSourceSurface>
Factory::CreateDataSourceSurface(const IntSize &aSize,
SurfaceFormat aFormat,