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_SCALEDFONTMAC_H_ michael@0: #define MOZILLA_GFX_SCALEDFONTMAC_H_ michael@0: michael@0: #import michael@0: #include "2D.h" michael@0: michael@0: #include "ScaledFontBase.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: michael@0: class ScaledFontMac : public ScaledFontBase michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontMac) michael@0: ScaledFontMac(CGFontRef aFont, Float aSize); michael@0: virtual ~ScaledFontMac(); michael@0: michael@0: virtual FontType GetType() const { return FontType::MAC; } michael@0: #ifdef USE_SKIA michael@0: virtual SkTypeface* GetSkTypeface(); michael@0: #endif 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: virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); michael@0: michael@0: private: michael@0: friend class DrawTargetCG; michael@0: CGFontRef mFont; michael@0: CTFontRef mCTFont; // only created if CTFontDrawGlyphs is available, otherwise null michael@0: michael@0: typedef void (CTFontDrawGlyphsFuncT)(CTFontRef, michael@0: const CGGlyph[], const CGPoint[], michael@0: size_t, CGContextRef); michael@0: michael@0: static bool sSymbolLookupDone; michael@0: michael@0: public: michael@0: // function pointer for CTFontDrawGlyphs, if available; michael@0: // initialized the first time a ScaledFontMac is created, michael@0: // so it will be valid by the time DrawTargetCG wants to use it michael@0: static CTFontDrawGlyphsFuncT* CTFontDrawGlyphsPtr; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif /* MOZILLA_GFX_SCALEDFONTMAC_H_ */