2007-03-22 10:30:00 -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
|
2007-03-22 10:30:00 -07:00
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Vladimir Vukicevic <vladimir@pobox.com>
|
|
|
|
* Masayuki Nakano <masayuki@d-toybox.com>
|
2007-12-27 17:28:26 -08:00
|
|
|
* John Daggett <jdaggett@mozilla.com>
|
2009-08-16 06:52:12 -07:00
|
|
|
* Jonathan Kew <jfkthame@gmail.com>
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* 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 ***** */
|
|
|
|
|
|
|
|
#ifndef GFX_ATSUIFONTS_H
|
|
|
|
#define GFX_ATSUIFONTS_H
|
|
|
|
|
2009-03-29 17:31:51 -07:00
|
|
|
#ifndef __LP64__ /* ATSUI not available on 64-bit */
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "cairo.h"
|
|
|
|
#include "gfxTypes.h"
|
|
|
|
#include "gfxFont.h"
|
2007-12-27 17:28:26 -08:00
|
|
|
#include "gfxFontUtils.h"
|
2008-02-11 20:57:57 -08:00
|
|
|
#include "gfxPlatform.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
|
2008-01-28 22:00:55 -08:00
|
|
|
class MacOSFontEntry;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-12-10 12:18:14 -08:00
|
|
|
#define kLiGothicBadCharUnicode 0x775B // ATSUI failure on 10.6 (bug 532346)
|
|
|
|
#define kLiGothicBadCharGlyph 3774 // the expected glyph for this char
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class gfxAtsuiFont : public gfxFont {
|
|
|
|
public:
|
2008-01-28 22:00:55 -08:00
|
|
|
|
|
|
|
gfxAtsuiFont(MacOSFontEntry *aFontEntry,
|
2008-03-19 17:02:21 -07:00
|
|
|
const gfxFontStyle *fontStyle, PRBool aNeedsBold);
|
2008-01-28 22:00:55 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual ~gfxAtsuiFont();
|
|
|
|
|
|
|
|
virtual const gfxFont::Metrics& GetMetrics();
|
|
|
|
|
2007-05-08 15:46:14 -07:00
|
|
|
float GetCharWidth(PRUnichar c, PRUint32 *aGlyphID = nsnull);
|
2007-03-22 10:30:00 -07:00
|
|
|
float GetCharHeight(PRUnichar c);
|
|
|
|
|
2009-03-29 17:31:51 -07:00
|
|
|
ATSFontRef GetATSFontRef();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
cairo_font_face_t *CairoFontFace() { return mFontFace; }
|
|
|
|
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }
|
|
|
|
|
|
|
|
ATSUStyle GetATSUStyle() { return mATSUStyle; }
|
|
|
|
|
|
|
|
virtual nsString GetUniqueName();
|
|
|
|
|
2007-05-08 15:46:14 -07:00
|
|
|
virtual PRUint32 GetSpaceGlyph() { return mSpaceGlyph; }
|
2008-03-12 19:36:58 -07:00
|
|
|
|
2007-07-04 02:19:27 -07:00
|
|
|
PRBool HasMirroringInfo();
|
2007-05-08 15:46:14 -07:00
|
|
|
|
2007-09-23 19:19:14 -07:00
|
|
|
virtual void SetupGlyphExtents(gfxContext *aContext, PRUint32 aGlyphID,
|
|
|
|
PRBool aNeedTight, gfxGlyphExtents *aExtents);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
const gfxFontStyle *mFontStyle;
|
|
|
|
|
|
|
|
ATSUStyle mATSUStyle;
|
2007-12-27 17:28:26 -08:00
|
|
|
|
2007-07-04 02:19:27 -07:00
|
|
|
PRBool mHasMirroring;
|
|
|
|
PRBool mHasMirroringLookedUp;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsString mUniqueName;
|
|
|
|
|
|
|
|
cairo_font_face_t *mFontFace;
|
|
|
|
cairo_scaled_font_t *mScaledFont;
|
|
|
|
|
|
|
|
gfxFont::Metrics mMetrics;
|
|
|
|
|
|
|
|
gfxFloat mAdjustedSize;
|
2007-05-08 15:46:14 -07:00
|
|
|
PRUint32 mSpaceGlyph;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
void InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef);
|
|
|
|
|
2009-10-07 08:26:58 -07:00
|
|
|
virtual void InitTextRun(gfxTextRun *aTextRun,
|
|
|
|
const PRUnichar *aString,
|
|
|
|
PRUint32 aRunStart,
|
|
|
|
PRUint32 aRunLength);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-10-07 08:26:58 -07:00
|
|
|
virtual PRBool SetupCairoFont(gfxContext *aContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
2009-03-29 17:31:51 -07:00
|
|
|
|
|
|
|
#endif /* not __LP64__ */
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif /* GFX_ATSUIFONTS_H */
|