Bug 835381 - Update libnestegg to 38c83d9d4c0c5c84373aa285bd30094a12d6b6f6. r=kinetik
[gecko.git] / gfx / thebes / gfxCoreTextShaper.h
blobaa22dcb6da422fe8e0006646be4b6cdc757e6a25
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
9 #include "gfxTypes.h"
10 #include "gfxFont.h"
11 #include "gfxFontUtils.h"
12 #include "gfxPlatform.h"
13 #include "gfxMacPlatformFontList.h"
15 #include <Carbon/Carbon.h>
17 class gfxMacFont;
19 class gfxCoreTextShaper : public gfxFontShaper {
20 public:
21 gfxCoreTextShaper(gfxMacFont *aFont);
23 virtual ~gfxCoreTextShaper();
25 virtual bool ShapeText(gfxContext *aContext,
26 const PRUnichar *aText,
27 uint32_t aOffset,
28 uint32_t aLength,
29 int32_t aScript,
30 gfxShapedText *aShapedText);
32 // clean up static objects that may have been cached
33 static void Shutdown();
35 protected:
36 CTFontRef mCTFont;
37 CFDictionaryRef mAttributesDict;
39 nsresult SetGlyphsFromRun(gfxShapedText *aShapedText,
40 uint32_t aOffset,
41 uint32_t aLength,
42 CTRunRef aCTRun,
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 */