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:
|
2014-08-08 05:17:30 +04:00
|
|
|
explicit 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
|
|
|
|
2015-12-16 00:56:41 +03:00
|
|
|
virtual bool ShapeText(DrawTarget *aDrawTarget,
|
2014-01-04 19:02:17 +04:00
|
|
|
const char16_t *aText,
|
2013-01-04 22:35:37 +04:00
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength,
|
|
|
|
int32_t aScript,
|
2014-10-01 23:25:48 +04:00
|
|
|
bool aVertical,
|
2013-01-04 22:35:37 +04:00
|
|
|
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;
|
2015-12-30 23:29:48 +03:00
|
|
|
|
|
|
|
// attributes for shaping text with LTR or RTL directionality
|
|
|
|
CFDictionaryRef mAttributesDictLTR;
|
|
|
|
CFDictionaryRef mAttributesDictRTL;
|
2009-03-30 04:31:51 +04:00
|
|
|
|
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
|
|
|
|
2015-03-25 11:25:49 +03:00
|
|
|
CTFontRef CreateCTFontWithFeatures(CGFloat aSize,
|
|
|
|
CTFontDescriptorRef aDescriptor);
|
2011-06-24 21:55:27 +04:00
|
|
|
|
2015-12-30 23:29:48 +03:00
|
|
|
CFDictionaryRef CreateAttrDict(bool aRightToLeft);
|
|
|
|
CFDictionaryRef CreateAttrDictWithoutDirection();
|
|
|
|
|
2015-03-25 11:25:49 +03:00
|
|
|
static CTFontDescriptorRef
|
|
|
|
CreateFontFeaturesDescriptor(const std::pair<SInt16,SInt16> aFeatures[],
|
|
|
|
size_t aCount);
|
2009-03-30 04:31:51 +04:00
|
|
|
|
2015-03-25 11:25:49 +03:00
|
|
|
static CTFontDescriptorRef GetDefaultFeaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetDisableLigaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetIndicFeaturesDescriptor();
|
|
|
|
static CTFontDescriptorRef GetIndicDisableLigaturesDescriptor();
|
2009-03-30 04:31:51 +04:00
|
|
|
|
|
|
|
// 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;
|
2015-03-25 11:25:49 +03:00
|
|
|
|
|
|
|
// feature descriptors for buggy Indic AAT font workaround
|
|
|
|
static CTFontDescriptorRef sIndicFeaturesDescriptor;
|
|
|
|
static CTFontDescriptorRef sIndicDisableLigaturesDescriptor;
|
2009-03-30 04:31:51 +04:00
|
|
|
};
|
|
|
|
|
2010-03-10 15:46:41 +03:00
|
|
|
#endif /* GFX_CORETEXTSHAPER_H */
|