2009-03-29 17:31:51 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is thebes gfx code.
|
|
|
|
*
|
2009-12-21 13:50:30 -08:00
|
|
|
* The Initial Developer of the Original Code is Mozilla Foundation.
|
2009-08-16 06:52:12 -07:00
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2006-2009
|
2009-03-29 17:31:51 -07:00
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Vladimir Vukicevic <vladimir@pobox.com>
|
|
|
|
* Masayuki Nakano <masayuki@d-toybox.com>
|
|
|
|
* John Daggett <jdaggett@mozilla.com>
|
|
|
|
* Jonathan Kew <jfkthame@gmail.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
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,
|
2011-12-06 04:39:19 -08:00
|
|
|
PRInt32 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 */
|