Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsFontPackageService Class Reference

#include <nsFontPackageService.h>

Inheritance diagram for nsFontPackageService:
Inheritance graph
Collaboration diagram for nsFontPackageService:
Collaboration graph

List of all members.

Public Member Functions

nsFontPackageService ()
virtual ~nsFontPackageService ()
void SetHandler (in nsIFontPackageHandler aHandler)
void FontPackageHandled (in boolean aSuccess, in boolean aRedrawPages, in string aFontPackID)
void NeedFontPackage (in string aFontPackID)
 Request a font package.

Protected Member Functions

nsresult CallDownload (const char *aFontPackID, PRInt8 aInState, PRInt8 *aOutState)

Protected Attributes

nsCOMPtr< nsIFontPackageHandlermHandler

Detailed Description

Definition at line 44 of file nsFontPackageService.h.

Constructor & Destructor Documentation


Definition at line 70 of file nsFontPackageService.cpp.

  /* destructor code */

Member Function Documentation

nsresult nsFontPackageService::CallDownload ( const char *  aFontPackID,
PRInt8  aInState,
PRInt8 *  aOutState 
) [protected]

Definition at line 106 of file nsFontPackageService.cpp.

  nsresult rv = NS_OK;

  if (aInState == eInit)  {
    nsCOMPtr<nsIFontEnumerator> fontEnum = do_GetService(";1", &rv);
    if (NS_SUCCEEDED(rv)) { 
      PRBool have = PR_FALSE;

      // aFontPackID="lang:xxxx", strip "lang:" and get the actual langID
      NS_ASSERTION((strncmp(aFontPackID, "lang:", 5) == 0), "Invalid FontPackID format.");
      const char *langID = &aFontPackID[5]; 
      rv = fontEnum->HaveFontFor(langID, &have);
      if (NS_SUCCEEDED(rv)) { 
        if (!have) {
          *aOutState = eDownload;
          rv = mHandler->NeedFontPackage(aFontPackID);
          if (rv == NS_ERROR_ABORT) {
            *aOutState = eInit;
            rv = NS_OK;
        else  {
          *aOutState = eInstalled;

  return rv;

Here is the call graph for this function:

void nsIFontPackageService::FontPackageHandled ( in boolean  aSuccess,
in boolean  aRedrawPages,
in string  aFontPackID 
) [inherited]
void nsIFontPackageProxy::NeedFontPackage ( in string  aFontPackID) [inherited]

Request a font package.

The proxy will call font package handler to download the font package

aFontPackIDa font package ID. The id have the following naming convenation name_space:name we currently define one name space lang - a font package for a particular language group and udnder the lang name space, we use the language code to identify the package, below are the defined packages ja - Japanese font package ("lang:ja") ko - Korean font package ("lang:ko") zh-TW - Traditional Chinese font package ("lang:zh-TW") zh-CN - Simplified Chinese font package ("lang:zh-CN") In the future, we may want to add ar - Arabic font packges ("lang:ar") he - Hebrew font packages ("lang:he") th - Thai font package ("lang:th") other name space are reserved for now.

This interface is implemented by Gecko for internal purpose It is a service and are different from nsIFontPackageHandler although the method signature is the same. Embedding application should not see this interface.

Here is the caller graph for this function:

Member Data Documentation

Definition at line 55 of file nsFontPackageService.h.

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