Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes

gfxPlatform Class Reference

#include <gfxPlatform.h>

Inheritance diagram for gfxPlatform:
Collaboration diagram for gfxPlatform:

List of all members.

Public Types

typedef PRBool(* FontResolverCallback )(const nsAString &aName, void *aClosure)
 Font name resolver, this returns actual font name(s) by the callback function.
typedef PRBool(* PrefFontCallback )(eFontPrefLang aLang, const nsAString &aName, void *aClosure)
 Iterate over pref fonts given a list of lang groups.

Public Member Functions

virtual already_AddRefed
< gfxASurface
CreateOffscreenSurface (const gfxIntSize &size, gfxASurface::gfxImageFormat imageFormat)=0
 Create an offscreen surface of the given dimensions and image format.
virtual already_AddRefed
< gfxASurface
OptimizeImage (gfxImageSurface *aSurface, gfxASurface::gfxImageFormat format)
virtual void SetupClusterBoundaries (gfxTextRun *aTextRun, const PRUnichar *aString)
virtual nsresult GetFontList (const nsACString &aLangGroup, const nsACString &aGenericFamily, nsTArray< nsString > &aListOfFonts)
 Fill aListOfFonts with the results of querying the list of font names that correspond to the given language group or generic font family (or both, or neither).
virtual nsresult UpdateFontList ()
 Rebuilds the any cached system font lists.
virtual gfxPlatformFontList * CreatePlatformFontList ()
 Create the platform font-list object (gfxPlatformFontList concrete subclass).
virtual nsresult ResolveFontName (const nsAString &aFontName, FontResolverCallback aCallback, void *aClosure, PRBool &aAborted)=0
virtual nsresult GetStandardFamilyName (const nsAString &aFontName, nsAString &aFamilyName)=0
 Resolving a font name to family name.
virtual gfxFontGroupCreateFontGroup (const nsAString &aFamilies, const gfxFontStyle *aStyle, gfxUserFontSet *aUserFontSet)=0
 Create the appropriate platform font group.
virtual gfxFontEntryLookupLocalFont (const gfxProxyFontEntry *aProxyEntry, const nsAString &aFontName)
 Look up a local platform font using the full font face name.
virtual gfxFontEntryMakePlatformFont (const gfxProxyFontEntry *aProxyEntry, const PRUint8 *aFontData, PRUint32 aLength)
 Activate a platform font.
virtual PRBool DownloadableFontsEnabled ()
 Whether to allow downloadable fonts via -face rules.
virtual PRBool IsFontFormatSupported (nsIURI *aFontURI, PRUint32 aFormatFlags)
void GetPrefFonts (const char *aLangGroup, nsString &array, PRBool aAppendUnicode=1)
void GetLangPrefs (eFontPrefLang aPrefLangs[], PRUint32 &aLen, eFontPrefLang aCharLang, eFontPrefLang aPageLang)

Static Public Member Functions

static gfxPlatformGetPlatform ()
 Return a pointer to the current active platform.
static nsresult Init ()
 Start up Thebes.
static void Shutdown ()
 Clean up static objects to shut down thebes.
static PRBool ForEachPrefFont (eFontPrefLang aLangArray[], PRUint32 aLangArrayLen, PrefFontCallback aCallback, void *aClosure)
static eFontPrefLang GetFontPrefLangFor (const char *aLang)
static const char * GetPrefLangName (eFontPrefLang aLang)
static eFontPrefLang GetFontPrefLangFor (PRUint8 aUnicodeRange)
static PRBool IsLangCJK (eFontPrefLang aLang)
static void AppendPrefLang (eFontPrefLang aPrefLangs[], PRUint32 &aLen, eFontPrefLang aAddLang)
static eCMSMode GetCMSMode ()
 Are we going to try color management?
static int GetRenderingIntent ()
 Determines the rendering intent for color management.
static void TransformPixel (const gfxRGBA &in, gfxRGBA &out, qcms_transform *transform)
 Convert a pixel using a cms transform in an endian-aware manner.
static qcms_profileGetCMSOutputProfile ()
 Return the output device ICC profile.
static qcms_profileGetCMSsRGBProfile ()
 Return the sRGB ICC profile.
static qcms_transformGetCMSRGBTransform ()
 Return sRGB -> output device transform.
static qcms_transformGetCMSInverseRGBTransform ()
 Return output -> sRGB device transform.
static qcms_transformGetCMSRGBATransform ()
 Return sRGBA -> output device transform.
static PRInt32 GetDPI ()
 Return display DPI.

Protected Member Functions

 gfxPlatform ()
virtual ~gfxPlatform ()
void AppendCJKPrefLangs (eFontPrefLang aPrefLangs[], PRUint32 &aLen, eFontPrefLang aCharLang, eFontPrefLang aPageLang)
virtual void InitDisplayCaps ()
 Initialize any needed display metrics (such as DPI).

Static Protected Attributes

static PRInt32 sDPI

Member Typedef Documentation

typedef PRBool(* gfxPlatform::FontResolverCallback)(const nsAString &aName, void *aClosure)

Font name resolver, this returns actual font name(s) by the callback function.

If the font doesn't exist, the callback function is not called. If the callback function returns PR_FALSE, the aAborted value is set to PR_TRUE, otherwise, PR_FALSE.

typedef PRBool(* gfxPlatform::PrefFontCallback)(eFontPrefLang aLang, const nsAString &aName, void *aClosure)

Iterate over pref fonts given a list of lang groups.

For a single lang group, multiple pref fonts are possible. If error occurs, returns PR_FALSE, PR_TRUE otherwise. Callback returns PR_FALSE to abort process.


Constructor & Destructor Documentation

gfxPlatform::gfxPlatform (  )  [inline, protected]
virtual gfxPlatform::~gfxPlatform (  )  [protected, virtual]

Member Function Documentation

void gfxPlatform::AppendCJKPrefLangs ( eFontPrefLang  aPrefLangs[],
PRUint32 &  aLen,
eFontPrefLang  aCharLang,
eFontPrefLang  aPageLang 
) [protected]
static void gfxPlatform::AppendPrefLang ( eFontPrefLang  aPrefLangs[],
PRUint32 &  aLen,
eFontPrefLang  aAddLang 
) [static]
virtual gfxFontGroup* gfxPlatform::CreateFontGroup ( const nsAString aFamilies,
const gfxFontStyle aStyle,
gfxUserFontSet aUserFontSet 
) [pure virtual]

Create the appropriate platform font group.

Implemented in gfxPlatformGtk.

virtual already_AddRefed<gfxASurface> gfxPlatform::CreateOffscreenSurface ( const gfxIntSize size,
gfxASurface::gfxImageFormat  imageFormat 
) [pure virtual]

Create an offscreen surface of the given dimensions and image format.

Implemented in gfxPlatformGtk.

virtual gfxPlatformFontList* gfxPlatform::CreatePlatformFontList (  )  [inline, virtual]

Create the platform font-list object (gfxPlatformFontList concrete subclass).

virtual PRBool gfxPlatform::DownloadableFontsEnabled (  )  [virtual]

Whether to allow downloadable fonts via -face rules.

static PRBool gfxPlatform::ForEachPrefFont ( eFontPrefLang  aLangArray[],
PRUint32  aLangArrayLen,
PrefFontCallback  aCallback,
void *  aClosure 
) [static]
static qcms_transform* gfxPlatform::GetCMSInverseRGBTransform (  )  [static]

Return output -> sRGB device transform.

static eCMSMode gfxPlatform::GetCMSMode (  )  [static]

Are we going to try color management?

static qcms_profile* gfxPlatform::GetCMSOutputProfile (  )  [static]

Return the output device ICC profile.

static qcms_transform* gfxPlatform::GetCMSRGBATransform (  )  [static]

Return sRGBA -> output device transform.

static qcms_transform* gfxPlatform::GetCMSRGBTransform (  )  [static]

Return sRGB -> output device transform.

static qcms_profile* gfxPlatform::GetCMSsRGBProfile (  )  [static]

Return the sRGB ICC profile.

static PRInt32 gfxPlatform::GetDPI (  )  [inline, static]

Return display DPI.

virtual nsresult gfxPlatform::GetFontList ( const nsACString aLangGroup,
const nsACString aGenericFamily,
nsTArray< nsString > &  aListOfFonts 
) [virtual]

Fill aListOfFonts with the results of querying the list of font names that correspond to the given language group or generic font family (or both, or neither).

Reimplemented in gfxPlatformGtk.

static eFontPrefLang gfxPlatform::GetFontPrefLangFor ( const char *  aLang  )  [static]
static eFontPrefLang gfxPlatform::GetFontPrefLangFor ( PRUint8  aUnicodeRange  )  [static]
void gfxPlatform::GetLangPrefs ( eFontPrefLang  aPrefLangs[],
PRUint32 &  aLen,
eFontPrefLang  aCharLang,
eFontPrefLang  aPageLang 
)
static gfxPlatform* gfxPlatform::GetPlatform (  )  [static]

Return a pointer to the current active platform.

This is a singleton; it contains mostly convenience functions to obtain platform-specific objects.

Reimplemented in gfxPlatformGtk.

void gfxPlatform::GetPrefFonts ( const char *  aLangGroup,
nsString &  array,
PRBool  aAppendUnicode = 1 
)
static const char* gfxPlatform::GetPrefLangName ( eFontPrefLang  aLang  )  [static]
static int gfxPlatform::GetRenderingIntent (  )  [static]

Determines the rendering intent for color management.

If the value in the pref gfx.color_management.rendering_intent is a valid rendering intent as defined in gfx/qcms/qcms.h, that value is returned. Otherwise, -1 is returned and the embedded intent should be used.

See bug 444014 for details.

virtual nsresult gfxPlatform::GetStandardFamilyName ( const nsAString aFontName,
nsAString aFamilyName 
) [pure virtual]

Resolving a font name to family name.

The result MUST be in the result of GetFontList(). If the name doesn't in the system, aFamilyName will be empty string, but not failed.

Implemented in gfxPlatformGtk.

static nsresult gfxPlatform::Init (  )  [static]

Start up Thebes.

This can fail.

virtual void gfxPlatform::InitDisplayCaps (  )  [protected, virtual]

Initialize any needed display metrics (such as DPI).

Reimplemented in gfxPlatformGtk.

virtual PRBool gfxPlatform::IsFontFormatSupported ( nsIURI aFontURI,
PRUint32  aFormatFlags 
) [inline, virtual]
static PRBool gfxPlatform::IsLangCJK ( eFontPrefLang  aLang  )  [static]
virtual gfxFontEntry* gfxPlatform::LookupLocalFont ( const gfxProxyFontEntry aProxyEntry,
const nsAString aFontName 
) [inline, virtual]

Look up a local platform font using the full font face name.

(Needed to support -face src local().) Ownership of the returned gfxFontEntry is passed to the caller, who must either AddRef() or delete.

virtual gfxFontEntry* gfxPlatform::MakePlatformFont ( const gfxProxyFontEntry aProxyEntry,
const PRUint8 *  aFontData,
PRUint32  aLength 
) [virtual]

Activate a platform font.

(Needed to support -face src url().) aFontData is a NS_Malloc'ed block that must be freed by this function (or responsibility passed on) when it is no longer needed; the caller will NOT free it. Ownership of the returned gfxFontEntry is passed to the caller, who must either AddRef() or delete.

virtual already_AddRefed<gfxASurface> gfxPlatform::OptimizeImage ( gfxImageSurface aSurface,
gfxASurface::gfxImageFormat  format 
) [virtual]
virtual nsresult gfxPlatform::ResolveFontName ( const nsAString aFontName,
FontResolverCallback  aCallback,
void *  aClosure,
PRBool aAborted 
) [pure virtual]

Implemented in gfxPlatformGtk.

virtual void gfxPlatform::SetupClusterBoundaries ( gfxTextRun aTextRun,
const PRUnichar aString 
) [virtual]
static void gfxPlatform::Shutdown (  )  [static]

Clean up static objects to shut down thebes.

static void gfxPlatform::TransformPixel ( const gfxRGBA in,
gfxRGBA out,
qcms_transform transform 
) [static]

Convert a pixel using a cms transform in an endian-aware manner.

Sets 'out' to 'in' if transform is NULL.

virtual nsresult gfxPlatform::UpdateFontList (  )  [virtual]

Rebuilds the any cached system font lists.

Reimplemented in gfxPlatformGtk.


Member Data Documentation

PRInt32 gfxPlatform::sDPI [static, protected]

The documentation for this class was generated from the following file: