michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef MOZILLA_GFX_SCALEDFONTDWRITE_H_ michael@0: #define MOZILLA_GFX_SCALEDFONTDWRITE_H_ michael@0: michael@0: #include michael@0: #include "ScaledFontBase.h" michael@0: michael@0: struct ID2D1GeometrySink; michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: michael@0: class ScaledFontDWrite MOZ_FINAL : public ScaledFontBase michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontDwrite) michael@0: ScaledFontDWrite(IDWriteFontFace *aFont, Float aSize) michael@0: : mFontFace(aFont) michael@0: , ScaledFontBase(aSize) michael@0: {} michael@0: ScaledFontDWrite(uint8_t *aData, uint32_t aSize, uint32_t aIndex, Float aGlyphSize); michael@0: michael@0: virtual FontType GetType() const { return FontType::DWRITE; } michael@0: michael@0: virtual TemporaryRef GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); michael@0: virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint); michael@0: michael@0: void CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink); michael@0: michael@0: virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); michael@0: michael@0: virtual AntialiasMode GetDefaultAAMode(); michael@0: michael@0: #ifdef USE_SKIA michael@0: virtual SkTypeface* GetSkTypeface() michael@0: { michael@0: MOZ_ASSERT(false, "Skia and DirectWrite do not mix"); michael@0: return nullptr; michael@0: } michael@0: #endif michael@0: michael@0: RefPtr mFontFace; michael@0: }; michael@0: michael@0: class GlyphRenderingOptionsDWrite : public GlyphRenderingOptions michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsDWrite) michael@0: GlyphRenderingOptionsDWrite(IDWriteRenderingParams *aParams) michael@0: : mParams(aParams) michael@0: { michael@0: } michael@0: michael@0: virtual FontType GetType() const { return FontType::DWRITE; } michael@0: michael@0: private: michael@0: friend class DrawTargetD2D; michael@0: friend class DrawTargetD2D1; michael@0: michael@0: RefPtr mParams; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif /* MOZILLA_GFX_SCALEDFONTDWRITE_H_ */