Bug 574778 - Fix win widget's ConstrainPosition so that it supports full screen windo...
[mozilla-central.git] / gfx / thebes / gfxCoreTextShaper.h
blob678507c252d5a020deef7e7def9b99eb822f0326
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is thebes gfx code.
17 * The Initial Developer of the Original Code is Mozilla Foundation.
18 * Portions created by the Initial Developer are Copyright (C) 2006-2009
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Vladimir Vukicevic <vladimir@pobox.com>
23 * Masayuki Nakano <masayuki@d-toybox.com>
24 * John Daggett <jdaggett@mozilla.com>
25 * Jonathan Kew <jfkthame@gmail.com>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef GFX_CORETEXTSHAPER_H
42 #define GFX_CORETEXTSHAPER_H
44 #include "gfxTypes.h"
45 #include "gfxFont.h"
46 #include "gfxFontUtils.h"
47 #include "gfxPlatform.h"
48 #include "gfxMacPlatformFontList.h"
50 #include <Carbon/Carbon.h>
52 class gfxMacFont;
54 class gfxCoreTextShaper : public gfxFontShaper {
55 public:
56 gfxCoreTextShaper(gfxMacFont *aFont);
58 virtual ~gfxCoreTextShaper();
60 virtual PRBool InitTextRun(gfxContext *aContext,
61 gfxTextRun *aTextRun,
62 const PRUnichar *aString,
63 PRUint32 aRunStart,
64 PRUint32 aRunLength,
65 PRInt32 aRunScript);
67 // clean up static objects that may have been cached
68 static void Shutdown();
70 protected:
71 CTFontRef mCTFont;
72 CFDictionaryRef mAttributesDict;
74 nsresult SetGlyphsFromRun(gfxTextRun *aTextRun,
75 CTRunRef aCTRun,
76 PRInt32 aStringOffset,
77 PRInt32 aLayoutStart,
78 PRInt32 aLayoutLength);
80 static void CreateDefaultFeaturesDescriptor();
82 static CTFontDescriptorRef GetDefaultFeaturesDescriptor() {
83 if (sDefaultFeaturesDescriptor == NULL) {
84 CreateDefaultFeaturesDescriptor();
86 return sDefaultFeaturesDescriptor;
89 static CTFontRef CreateCTFontWithDisabledLigatures(ATSFontRef aFontRef, CGFloat aSize);
91 // cached font descriptor, created the first time it's needed
92 static CTFontDescriptorRef sDefaultFeaturesDescriptor;
94 // cached descriptor for adding disable-ligatures setting to a font
95 static CTFontDescriptorRef sDisableLigaturesDescriptor;
98 #endif /* GFX_CORETEXTSHAPER_H */