2009-03-29 17:31:51 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 04:12:37 -07: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-29 17:31:51 -07:00
|
|
|
|
2010-03-10 04:46:41 -08:00
|
|
|
#ifndef GFX_CORETEXTSHAPER_H
|
|
|
|
#define GFX_CORETEXTSHAPER_H
|
2009-03-29 17:31:51 -07:00
|
|
|
|
|
|
|
#include "gfxTypes.h"
|
|
|
|
#include "gfxFont.h"
|
|
|
|
#include "gfxFontUtils.h"
|
|
|
|
#include "gfxPlatform.h"
|
2010-03-10 04:46:41 -08:00
|
|
|
#include "gfxMacPlatformFontList.h"
|
2009-03-29 17:31:51 -07:00
|
|
|
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
|
2010-03-10 04:46:41 -08:00
|
|
|
class gfxMacFont;
|
2009-03-29 17:31:51 -07:00
|
|
|
|
2010-03-10 04:46:41 -08:00
|
|
|
class gfxCoreTextShaper : public gfxFontShaper {
|
2009-03-29 17:31:51 -07:00
|
|
|
public:
|
2010-03-10 04:46:41 -08:00
|
|
|
gfxCoreTextShaper(gfxMacFont *aFont);
|
2009-03-29 17:31:51 -07:00
|
|
|
|
2010-03-10 04:46:41 -08:00
|
|
|
virtual ~gfxCoreTextShaper();
|
2009-03-29 17:31:51 -07:00
|
|
|
|
2013-01-04 10:35:37 -08:00
|
|
|
virtual bool ShapeText(gfxContext *aContext,
|
|
|
|
const PRUnichar *aText,
|
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
int32_t aScript,
|
|
|
|
gfxShapedText *aShapedText);
|
2009-03-29 17:31:51 -07:00
|
|
|
|
|
|
|
// clean up static objects that may have been cached
|
|
|
|
static void Shutdown();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CTFontRef mCTFont;
|
|
|
|
CFDictionaryRef mAttributesDict;
|
|
|
|
|
2013-01-04 10:35:37 -08:00
|
|
|
nsresult SetGlyphsFromRun(gfxShapedText *aShapedText,
|
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
CTRunRef aCTRun,
|
|
|
|
int32_t aStringOffset);
|
2009-10-07 08:26:58 -07:00
|
|
|
|
2011-06-24 10:55:27 -07:00
|
|
|
CTFontRef CreateCTFontWithDisabledLigatures(CGFloat aSize);
|
|
|
|
|
2009-03-29 17:31:51 -07:00
|
|
|
static void CreateDefaultFeaturesDescriptor();
|
|
|
|
|
|
|
|
static CTFontDescriptorRef GetDefaultFeaturesDescriptor() {
|
2010-03-10 04:46:41 -08:00
|
|
|
if (sDefaultFeaturesDescriptor == NULL) {
|
2009-03-29 17:31:51 -07:00
|
|
|
CreateDefaultFeaturesDescriptor();
|
2010-03-10 04:46:41 -08:00
|
|
|
}
|
2009-03-29 17:31:51 -07:00
|
|
|
return sDefaultFeaturesDescriptor;
|
|
|
|
}
|
|
|
|
|
|
|
|
// cached font descriptor, created the first time it's needed
|
|
|
|
static CTFontDescriptorRef sDefaultFeaturesDescriptor;
|
2010-03-10 04:46:41 -08:00
|
|
|
|
2009-03-29 17:31:51 -07:00
|
|
|
// cached descriptor for adding disable-ligatures setting to a font
|
|
|
|
static CTFontDescriptorRef sDisableLigaturesDescriptor;
|
|
|
|
};
|
|
|
|
|
2010-03-10 04:46:41 -08:00
|
|
|
#endif /* GFX_CORETEXTSHAPER_H */
|