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 "gfxFont.h"
|
|
|
|
|
2013-10-07 16:15:59 -07:00
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
2009-03-29 17:31:51 -07:00
|
|
|
|
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:
|
2014-08-07 18:17:30 -07:00
|
|
|
explicit 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,
|
2014-01-04 07:02:17 -08:00
|
|
|
const char16_t *aText,
|
2013-01-04 10:35:37 -08:00
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
int32_t aScript,
|
2014-10-01 12:25:48 -07:00
|
|
|
bool aVertical,
|
2013-01-04 10:35:37 -08:00
|
|
|
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
|
|
|
|
2015-03-25 01:25:49 -07:00
|
|
|
CTFontRef CreateCTFontWithFeatures(CGFloat aSize,
|
|
|
|
CTFontDescriptorRef aDescriptor);
|
2011-06-24 10:55:27 -07:00
|
|
|
|
2015-03-25 01:25:49 -07:00
|
|
|
static CTFontDescriptorRef
|
|
|
|
CreateFontFeaturesDescriptor(const std::pair<SInt16,SInt16> aFeatures[],
|
|
|
|
size_t aCount);
|
2009-03-29 17:31:51 -07:00
|
|
|
|
2015-03-25 01:25:49 -07:00
|
|
|
static CTFontDescriptorRef GetDefaultFeaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetDisableLigaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetIndicFeaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetIndicDisableLigaturesDescriptor();
|
2009-03-29 17:31:51 -07:00
|
|
|
|
|
|
|
// 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;
|
2015-03-25 01:25:49 -07:00
|
|
|
|
|
|
|
// feature descriptors for buggy Indic AAT font workaround
|
|
|
|
static CTFontDescriptorRef sIndicFeaturesDescriptor;
|
|
|
|
static CTFontDescriptorRef sIndicDisableLigaturesDescriptor;
|
2009-03-29 17:31:51 -07:00
|
|
|
};
|
|
|
|
|
2010-03-10 04:46:41 -08:00
|
|
|
#endif /* GFX_CORETEXTSHAPER_H */
|