2009-03-30 04:31:51 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2010-03-10 15:46:41 +03:00
|
|
|
#ifndef GFX_CORETEXTSHAPER_H
|
|
|
|
#define GFX_CORETEXTSHAPER_H
|
2009-03-30 04:31:51 +04:00
|
|
|
|
|
|
|
#include "gfxFont.h"
|
|
|
|
|
2013-10-08 03:15:59 +04:00
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2010-03-10 15:46:41 +03:00
|
|
|
class gfxMacFont;
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2010-03-10 15:46:41 +03:00
|
|
|
class gfxCoreTextShaper : public gfxFontShaper {
|
2009-03-30 04:31:51 +04:00
|
|
|
public:
|
2010-03-10 15:46:41 +03:00
|
|
|
gfxCoreTextShaper(gfxMacFont *aFont);
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2010-03-10 15:46:41 +03:00
|
|
|
virtual ~gfxCoreTextShaper();
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2013-01-04 22:35:37 +04:00
|
|
|
virtual bool ShapeText(gfxContext *aContext,
|
|
|
|
const PRUnichar *aText,
|
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
int32_t aScript,
|
|
|
|
gfxShapedText *aShapedText);
|
2009-03-30 04:31:51 +04:00
|
|
|
|
|
|
|
// clean up static objects that may have been cached
|
|
|
|
static void Shutdown();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CTFontRef mCTFont;
|
|
|
|
CFDictionaryRef mAttributesDict;
|
|
|
|
|
2013-01-04 22:35:37 +04:00
|
|
|
nsresult SetGlyphsFromRun(gfxShapedText *aShapedText,
|
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
CTRunRef aCTRun,
|
|
|
|
int32_t aStringOffset);
|
2009-10-07 19:26:58 +04:00
|
|
|
|
2011-06-24 21:55:27 +04:00
|
|
|
CTFontRef CreateCTFontWithDisabledLigatures(CGFloat aSize);
|
|
|
|
|
2009-03-30 04:31:51 +04:00
|
|
|
static void CreateDefaultFeaturesDescriptor();
|
|
|
|
|
|
|
|
static CTFontDescriptorRef GetDefaultFeaturesDescriptor() {
|
2013-07-31 19:44:31 +04:00
|
|
|
if (sDefaultFeaturesDescriptor == nullptr) {
|
2009-03-30 04:31:51 +04:00
|
|
|
CreateDefaultFeaturesDescriptor();
|
2010-03-10 15:46:41 +03:00
|
|
|
}
|
2009-03-30 04:31:51 +04:00
|
|
|
return sDefaultFeaturesDescriptor;
|
|
|
|
}
|
|
|
|
|
|
|
|
// cached font descriptor, created the first time it's needed
|
|
|
|
static CTFontDescriptorRef sDefaultFeaturesDescriptor;
|
2010-03-10 15:46:41 +03:00
|
|
|
|
2009-03-30 04:31:51 +04:00
|
|
|
// cached descriptor for adding disable-ligatures setting to a font
|
|
|
|
static CTFontDescriptorRef sDisableLigaturesDescriptor;
|
|
|
|
};
|
|
|
|
|
2010-03-10 15:46:41 +03:00
|
|
|
#endif /* GFX_CORETEXTSHAPER_H */
|