LCOV - code coverage report
Current view: directory - gfx/thebes - gfxPangoFonts.h (source / functions) Found Hit Coverage
Test: app.info Lines: 1 0 0.0 %
Date: 2012-06-02 Functions: 2 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  * ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Foundation code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Mozilla Foundation.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2005
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Vladimir Vukicevic <vladimir@mozilla.com>
      23                 :  *   Masayuki Nakano <masayuki@d-toybox.com>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef GFX_PANGOFONTS_H
      40                 : #define GFX_PANGOFONTS_H
      41                 : 
      42                 : #include "cairo.h"
      43                 : #include "gfxTypes.h"
      44                 : #include "gfxFont.h"
      45                 : 
      46                 : #include "nsAutoRef.h"
      47                 : #include "nsTArray.h"
      48                 : 
      49                 : #include <pango/pango.h>
      50                 : 
      51                 : class gfxFcFontSet;
      52                 : class gfxFcFont;
      53                 : class gfxProxyFontEntry;
      54                 : typedef struct _FcPattern FcPattern;
      55                 : typedef struct FT_FaceRec_* FT_Face;
      56                 : typedef struct FT_LibraryRec_  *FT_Library;
      57                 : 
      58                 : class THEBES_API gfxPangoFontGroup : public gfxFontGroup {
      59                 : public:
      60                 :     gfxPangoFontGroup (const nsAString& families,
      61                 :                        const gfxFontStyle *aStyle,
      62                 :                        gfxUserFontSet *aUserFontSet);
      63                 :     virtual ~gfxPangoFontGroup ();
      64                 : 
      65                 :     virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle);
      66                 : 
      67                 :     virtual gfxFont *GetFontAt(PRInt32 i);
      68                 : 
      69                 :     virtual void UpdateFontList();
      70                 : 
      71                 :     virtual already_AddRefed<gfxFont>
      72                 :         FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh, PRInt32 aRunScript,
      73                 :                         gfxFont *aPrevMatchedFont,
      74                 :                         PRUint8 *aMatchType);
      75                 : 
      76                 :     static void Shutdown();
      77                 : 
      78                 :     // Used for @font-face { src: local(); }
      79                 :     static gfxFontEntry *NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
      80                 :                                       const nsAString &aFullname);
      81                 :     // Used for @font-face { src: url(); }
      82                 :     static gfxFontEntry *NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
      83                 :                                       const PRUint8 *aFontData,
      84                 :                                       PRUint32 aLength);
      85                 : 
      86                 :     // Interfaces used internally
      87                 :     // (but public so that they can be accessed from non-member functions):
      88                 : 
      89                 :     // A language guessed from the gfxFontStyle
      90                 :     PangoLanguage *GetPangoLanguage() { return mPangoLanguage; }
      91                 : 
      92                 : private:
      93                 :     // @param aLang [in] language to use for pref fonts and system default font
      94                 :     //        selection, or NULL for the language guessed from the gfxFontStyle.
      95                 :     // The FontGroup holds a reference to this set.
      96                 :     gfxFcFontSet *GetFontSet(PangoLanguage *aLang = NULL);
      97                 : 
      98               0 :     class FontSetByLangEntry {
      99                 :     public:
     100                 :         FontSetByLangEntry(PangoLanguage *aLang, gfxFcFontSet *aFontSet);
     101                 :         PangoLanguage *mLang;
     102                 :         nsRefPtr<gfxFcFontSet> mFontSet;
     103                 :     };
     104                 :     // There is only one of entry in this array unless characters from scripts
     105                 :     // of other languages are measured.
     106                 :     nsAutoTArray<FontSetByLangEntry,1> mFontSets;
     107                 : 
     108                 :     gfxFloat mSizeAdjustFactor;
     109                 :     PangoLanguage *mPangoLanguage;
     110                 : 
     111                 :     void GetFcFamilies(nsTArray<nsString> *aFcFamilyList,
     112                 :                        nsIAtom *aLanguage);
     113                 : 
     114                 :     // @param aLang [in] language to use for pref fonts and system font
     115                 :     //        resolution, or NULL to guess a language from the gfxFontStyle.
     116                 :     // @param aMatchPattern [out] if non-NULL, will return the pattern used.
     117                 :     already_AddRefed<gfxFcFontSet>
     118                 :     MakeFontSet(PangoLanguage *aLang, gfxFloat aSizeAdjustFactor,
     119                 :                 nsAutoRef<FcPattern> *aMatchPattern = NULL);
     120                 : 
     121                 :     gfxFcFontSet *GetBaseFontSet();
     122                 :     gfxFcFont *GetBaseFont();
     123                 : 
     124                 :     gfxFloat GetSizeAdjustFactor()
     125                 :     {
     126                 :         if (mFontSets.Length() == 0)
     127                 :             GetBaseFontSet();
     128                 :         return mSizeAdjustFactor;
     129                 :     }
     130                 : 
     131                 :     static FT_Library GetFTLibrary();
     132                 : };
     133                 : 
     134                 : #endif /* GFX_PANGOFONTS_H */

Generated by: LCOV version 1.7