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
|
|
|
|
2011-12-06 04:39:19 -08:00
|
|
|
virtual bool ShapeWord(gfxContext *aContext,
|
|
|
|
gfxShapedWord *aShapedWord,
|
|
|
|
const PRUnichar *aText);
|
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;
|
|
|
|
|
2011-12-06 04:39:19 -08:00
|
|
|
nsresult SetGlyphsFromRun(gfxShapedWord *aShapedWord,
|
2009-10-07 08:26:58 -07:00
|
|
|
CTRunRef aCTRun,
|
2012-08-22 08:56:38 -07:00
|
|
|
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 */
|