gfx/thebes/gfxPangoFonts.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef GFX_PANGOFONTS_H
michael@0 7 #define GFX_PANGOFONTS_H
michael@0 8
michael@0 9 #include "cairo.h"
michael@0 10 #include "gfxTypes.h"
michael@0 11 #include "gfxFont.h"
michael@0 12
michael@0 13 #include "nsAutoRef.h"
michael@0 14 #include "nsTArray.h"
michael@0 15
michael@0 16 #include <pango/pango.h>
michael@0 17
michael@0 18 class gfxFcFontSet;
michael@0 19 class gfxFcFont;
michael@0 20 class gfxProxyFontEntry;
michael@0 21 typedef struct _FcPattern FcPattern;
michael@0 22 typedef struct FT_FaceRec_* FT_Face;
michael@0 23 typedef struct FT_LibraryRec_ *FT_Library;
michael@0 24
michael@0 25 class gfxPangoFontGroup : public gfxFontGroup {
michael@0 26 public:
michael@0 27 gfxPangoFontGroup (const nsAString& families,
michael@0 28 const gfxFontStyle *aStyle,
michael@0 29 gfxUserFontSet *aUserFontSet);
michael@0 30 virtual ~gfxPangoFontGroup ();
michael@0 31
michael@0 32 virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle);
michael@0 33
michael@0 34 virtual gfxFont *GetFontAt(int32_t i);
michael@0 35
michael@0 36 virtual void UpdateFontList();
michael@0 37
michael@0 38 virtual already_AddRefed<gfxFont>
michael@0 39 FindFontForChar(uint32_t aCh, uint32_t aPrevCh, int32_t aRunScript,
michael@0 40 gfxFont *aPrevMatchedFont,
michael@0 41 uint8_t *aMatchType);
michael@0 42
michael@0 43 static void Shutdown();
michael@0 44
michael@0 45 // Used for @font-face { src: local(); }
michael@0 46 static gfxFontEntry *NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
michael@0 47 const nsAString &aFullname);
michael@0 48 // Used for @font-face { src: url(); }
michael@0 49 static gfxFontEntry *NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
michael@0 50 const uint8_t *aFontData,
michael@0 51 uint32_t aLength);
michael@0 52
michael@0 53 private:
michael@0 54 // @param aLang [in] language to use for pref fonts and system default font
michael@0 55 // selection, or nullptr for the language guessed from the
michael@0 56 // gfxFontStyle.
michael@0 57 // The FontGroup holds a reference to this set.
michael@0 58 gfxFcFontSet *GetFontSet(PangoLanguage *aLang = nullptr);
michael@0 59
michael@0 60 class FontSetByLangEntry {
michael@0 61 public:
michael@0 62 FontSetByLangEntry(PangoLanguage *aLang, gfxFcFontSet *aFontSet);
michael@0 63 PangoLanguage *mLang;
michael@0 64 nsRefPtr<gfxFcFontSet> mFontSet;
michael@0 65 };
michael@0 66 // There is only one of entry in this array unless characters from scripts
michael@0 67 // of other languages are measured.
michael@0 68 nsAutoTArray<FontSetByLangEntry,1> mFontSets;
michael@0 69
michael@0 70 gfxFloat mSizeAdjustFactor;
michael@0 71 PangoLanguage *mPangoLanguage;
michael@0 72
michael@0 73 void GetFcFamilies(nsTArray<nsString> *aFcFamilyList,
michael@0 74 nsIAtom *aLanguage);
michael@0 75
michael@0 76 // @param aLang [in] language to use for pref fonts and system font
michael@0 77 // resolution, or nullptr to guess a language from the gfxFontStyle.
michael@0 78 // @param aMatchPattern [out] if non-nullptr, will return the pattern used.
michael@0 79 already_AddRefed<gfxFcFontSet>
michael@0 80 MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor,
michael@0 81 nsAutoRef<FcPattern> *aMatchPattern = nullptr);
michael@0 82
michael@0 83 gfxFcFontSet *GetBaseFontSet();
michael@0 84 gfxFcFont *GetBaseFont();
michael@0 85
michael@0 86 gfxFloat GetSizeAdjustFactor()
michael@0 87 {
michael@0 88 if (mFontSets.Length() == 0)
michael@0 89 GetBaseFontSet();
michael@0 90 return mSizeAdjustFactor;
michael@0 91 }
michael@0 92
michael@0 93 friend class gfxSystemFcFontEntry;
michael@0 94 static FT_Library GetFTLibrary();
michael@0 95 };
michael@0 96
michael@0 97 #endif /* GFX_PANGOFONTS_H */

mercurial