1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_CORETEXTSHAPER_H
7 #define GFX_CORETEXTSHAPER_H
11 #include "gfxFontUtils.h"
12 #include "gfxPlatform.h"
13 #include "gfxMacPlatformFontList.h"
15 #include <Carbon/Carbon.h>
19 class gfxCoreTextShaper
: public gfxFontShaper
{
21 gfxCoreTextShaper(gfxMacFont
*aFont
);
23 virtual ~gfxCoreTextShaper();
25 virtual bool ShapeText(gfxContext
*aContext
,
26 const PRUnichar
*aText
,
30 gfxShapedText
*aShapedText
);
32 // clean up static objects that may have been cached
33 static void Shutdown();
37 CFDictionaryRef mAttributesDict
;
39 nsresult
SetGlyphsFromRun(gfxShapedText
*aShapedText
,
43 int32_t aStringOffset
);
45 CTFontRef
CreateCTFontWithDisabledLigatures(CGFloat aSize
);
47 static void CreateDefaultFeaturesDescriptor();
49 static CTFontDescriptorRef
GetDefaultFeaturesDescriptor() {
50 if (sDefaultFeaturesDescriptor
== NULL
) {
51 CreateDefaultFeaturesDescriptor();
53 return sDefaultFeaturesDescriptor
;
56 // cached font descriptor, created the first time it's needed
57 static CTFontDescriptorRef sDefaultFeaturesDescriptor
;
59 // cached descriptor for adding disable-ligatures setting to a font
60 static CTFontDescriptorRef sDisableLigaturesDescriptor
;
63 #endif /* GFX_CORETEXTSHAPER_H */