gfx/thebes/gfxCoreTextShaper.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/thebes/gfxCoreTextShaper.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     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 GFX_CORETEXTSHAPER_H
    1.10 +#define GFX_CORETEXTSHAPER_H
    1.11 +
    1.12 +#include "gfxFont.h"
    1.13 +
    1.14 +#include <ApplicationServices/ApplicationServices.h>
    1.15 +
    1.16 +class gfxMacFont;
    1.17 +
    1.18 +class gfxCoreTextShaper : public gfxFontShaper {
    1.19 +public:
    1.20 +    gfxCoreTextShaper(gfxMacFont *aFont);
    1.21 +
    1.22 +    virtual ~gfxCoreTextShaper();
    1.23 +
    1.24 +    virtual bool ShapeText(gfxContext      *aContext,
    1.25 +                           const char16_t *aText,
    1.26 +                           uint32_t         aOffset,
    1.27 +                           uint32_t         aLength,
    1.28 +                           int32_t          aScript,
    1.29 +                           gfxShapedText   *aShapedText);
    1.30 +
    1.31 +    // clean up static objects that may have been cached
    1.32 +    static void Shutdown();
    1.33 +
    1.34 +protected:
    1.35 +    CTFontRef mCTFont;
    1.36 +    CFDictionaryRef mAttributesDict;
    1.37 +
    1.38 +    nsresult SetGlyphsFromRun(gfxShapedText *aShapedText,
    1.39 +                              uint32_t       aOffset,
    1.40 +                              uint32_t       aLength,
    1.41 +                              CTRunRef       aCTRun,
    1.42 +                              int32_t        aStringOffset);
    1.43 +
    1.44 +    CTFontRef CreateCTFontWithDisabledLigatures(CGFloat aSize);
    1.45 +
    1.46 +    static void CreateDefaultFeaturesDescriptor();
    1.47 +
    1.48 +    static CTFontDescriptorRef GetDefaultFeaturesDescriptor() {
    1.49 +        if (sDefaultFeaturesDescriptor == nullptr) {
    1.50 +            CreateDefaultFeaturesDescriptor();
    1.51 +        }
    1.52 +        return sDefaultFeaturesDescriptor;
    1.53 +    }
    1.54 +
    1.55 +    // cached font descriptor, created the first time it's needed
    1.56 +    static CTFontDescriptorRef    sDefaultFeaturesDescriptor;
    1.57 +
    1.58 +    // cached descriptor for adding disable-ligatures setting to a font
    1.59 +    static CTFontDescriptorRef    sDisableLigaturesDescriptor;
    1.60 +};
    1.61 +
    1.62 +#endif /* GFX_CORETEXTSHAPER_H */

mercurial