2009-03-30 00:31:51 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 11:12:37 +00: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 00:31:51 +00:00
|
|
|
|
2010-03-10 12:46:41 +00:00
|
|
|
#ifndef GFX_CORETEXTSHAPER_H
|
|
|
|
#define GFX_CORETEXTSHAPER_H
|
2009-03-30 00:31:51 +00:00
|
|
|
|
|
|
|
#include "gfxFont.h"
|
|
|
|
|
2013-10-07 23:15:59 +00:00
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
2009-03-30 00:31:51 +00:00
|
|
|
|
2010-03-10 12:46:41 +00:00
|
|
|
class gfxMacFont;
|
2009-03-30 00:31:51 +00:00
|
|
|
|
2010-03-10 12:46:41 +00:00
|
|
|
class gfxCoreTextShaper : public gfxFontShaper {
|
2009-03-30 00:31:51 +00:00
|
|
|
public:
|
2014-08-08 01:17:30 +00:00
|
|
|
explicit gfxCoreTextShaper(gfxMacFont *aFont);
|
2009-03-30 00:31:51 +00:00
|
|
|
|
2010-03-10 12:46:41 +00:00
|
|
|
virtual ~gfxCoreTextShaper();
|
2009-03-30 00:31:51 +00:00
|
|
|
|
2015-12-15 21:56:41 +00:00
|
|
|
virtual bool ShapeText(DrawTarget *aDrawTarget,
|
2014-01-04 15:02:17 +00:00
|
|
|
const char16_t *aText,
|
2013-01-04 18:35:37 +00:00
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
int32_t aScript,
|
2014-10-01 19:25:48 +00:00
|
|
|
bool aVertical,
|
2013-01-04 18:35:37 +00:00
|
|
|
gfxShapedText *aShapedText);
|
2009-03-30 00:31:51 +00:00
|
|
|
|
|
|
|
// clean up static objects that may have been cached
|
|
|
|
static void Shutdown();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CTFontRef mCTFont;
|
2015-12-30 20:29:48 +00:00
|
|
|
|
|
|
|
// attributes for shaping text with LTR or RTL directionality
|
|
|
|
CFDictionaryRef mAttributesDictLTR;
|
|
|
|
CFDictionaryRef mAttributesDictRTL;
|
2009-03-30 00:31:51 +00:00
|
|
|
|
2013-01-04 18:35:37 +00:00
|
|
|
nsresult SetGlyphsFromRun(gfxShapedText *aShapedText,
|
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
CTRunRef aCTRun,
|
|
|
|
int32_t aStringOffset);
|
2009-10-07 15:26:58 +00:00
|
|
|
|
2015-03-25 08:25:49 +00:00
|
|
|
CTFontRef CreateCTFontWithFeatures(CGFloat aSize,
|
|
|
|
CTFontDescriptorRef aDescriptor);
|
2011-06-24 17:55:27 +00:00
|
|
|
|
2015-12-30 20:29:48 +00:00
|
|
|
CFDictionaryRef CreateAttrDict(bool aRightToLeft);
|
|
|
|
CFDictionaryRef CreateAttrDictWithoutDirection();
|
|
|
|
|
2015-03-25 08:25:49 +00:00
|
|
|
static CTFontDescriptorRef
|
|
|
|
CreateFontFeaturesDescriptor(const std::pair<SInt16,SInt16> aFeatures[],
|
|
|
|
size_t aCount);
|
2009-03-30 00:31:51 +00:00
|
|
|
|
2015-03-25 08:25:49 +00:00
|
|
|
static CTFontDescriptorRef GetDefaultFeaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetDisableLigaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetIndicFeaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetIndicDisableLigaturesDescriptor();
|
2009-03-30 00:31:51 +00:00
|
|
|
|
|
|
|
// cached font descriptor, created the first time it's needed
|
|
|
|
static CTFontDescriptorRef sDefaultFeaturesDescriptor;
|
2010-03-10 12:46:41 +00:00
|
|
|
|
2009-03-30 00:31:51 +00:00
|
|
|
// cached descriptor for adding disable-ligatures setting to a font
|
|
|
|
static CTFontDescriptorRef sDisableLigaturesDescriptor;
|
2015-03-25 08:25:49 +00:00
|
|
|
|
|
|
|
// feature descriptors for buggy Indic AAT font workaround
|
|
|
|
static CTFontDescriptorRef sIndicFeaturesDescriptor;
|
|
|
|
static CTFontDescriptorRef sIndicDisableLigaturesDescriptor;
|
2009-03-30 00:31:51 +00:00
|
|
|
};
|
|
|
|
|
2010-03-10 12:46:41 +00:00
|
|
|
#endif /* GFX_CORETEXTSHAPER_H */
|