gfx/thebes/gfxCoreTextShaper.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 "gfxFont.h"
    11 #include <ApplicationServices/ApplicationServices.h>
    13 class gfxMacFont;
    15 class gfxCoreTextShaper : public gfxFontShaper {
    16 public:
    17     gfxCoreTextShaper(gfxMacFont *aFont);
    19     virtual ~gfxCoreTextShaper();
    21     virtual bool ShapeText(gfxContext      *aContext,
    22                            const char16_t *aText,
    23                            uint32_t         aOffset,
    24                            uint32_t         aLength,
    25                            int32_t          aScript,
    26                            gfxShapedText   *aShapedText);
    28     // clean up static objects that may have been cached
    29     static void Shutdown();
    31 protected:
    32     CTFontRef mCTFont;
    33     CFDictionaryRef mAttributesDict;
    35     nsresult SetGlyphsFromRun(gfxShapedText *aShapedText,
    36                               uint32_t       aOffset,
    37                               uint32_t       aLength,
    38                               CTRunRef       aCTRun,
    39                               int32_t        aStringOffset);
    41     CTFontRef CreateCTFontWithDisabledLigatures(CGFloat aSize);
    43     static void CreateDefaultFeaturesDescriptor();
    45     static CTFontDescriptorRef GetDefaultFeaturesDescriptor() {
    46         if (sDefaultFeaturesDescriptor == nullptr) {
    47             CreateDefaultFeaturesDescriptor();
    48         }
    49         return sDefaultFeaturesDescriptor;
    50     }
    52     // cached font descriptor, created the first time it's needed
    53     static CTFontDescriptorRef    sDefaultFeaturesDescriptor;
    55     // cached descriptor for adding disable-ligatures setting to a font
    56     static CTFontDescriptorRef    sDisableLigaturesDescriptor;
    57 };
    59 #endif /* GFX_CORETEXTSHAPER_H */

mercurial