1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/2d/ScaledFontMac.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef MOZILLA_GFX_SCALEDFONTMAC_H_ 1.10 +#define MOZILLA_GFX_SCALEDFONTMAC_H_ 1.11 + 1.12 +#import <ApplicationServices/ApplicationServices.h> 1.13 +#include "2D.h" 1.14 + 1.15 +#include "ScaledFontBase.h" 1.16 + 1.17 +namespace mozilla { 1.18 +namespace gfx { 1.19 + 1.20 +class ScaledFontMac : public ScaledFontBase 1.21 +{ 1.22 +public: 1.23 + MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontMac) 1.24 + ScaledFontMac(CGFontRef aFont, Float aSize); 1.25 + virtual ~ScaledFontMac(); 1.26 + 1.27 + virtual FontType GetType() const { return FontType::MAC; } 1.28 +#ifdef USE_SKIA 1.29 + virtual SkTypeface* GetSkTypeface(); 1.30 +#endif 1.31 + virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget); 1.32 + virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint); 1.33 + virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton); 1.34 + 1.35 +private: 1.36 + friend class DrawTargetCG; 1.37 + CGFontRef mFont; 1.38 + CTFontRef mCTFont; // only created if CTFontDrawGlyphs is available, otherwise null 1.39 + 1.40 + typedef void (CTFontDrawGlyphsFuncT)(CTFontRef, 1.41 + const CGGlyph[], const CGPoint[], 1.42 + size_t, CGContextRef); 1.43 + 1.44 + static bool sSymbolLookupDone; 1.45 + 1.46 +public: 1.47 + // function pointer for CTFontDrawGlyphs, if available; 1.48 + // initialized the first time a ScaledFontMac is created, 1.49 + // so it will be valid by the time DrawTargetCG wants to use it 1.50 + static CTFontDrawGlyphsFuncT* CTFontDrawGlyphsPtr; 1.51 +}; 1.52 + 1.53 +} 1.54 +} 1.55 + 1.56 +#endif /* MOZILLA_GFX_SCALEDFONTMAC_H_ */