Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Attributes | Private Attributes
nsGlyphTableList Class Reference
Inheritance diagram for nsGlyphTableList:
Inheritance graph
[legend]
Collaboration diagram for nsGlyphTableList:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsGlyphTableList ()
virtual ~nsGlyphTableList ()
nsresult Initialize ()
nsresult Finalize ()
nsGlyphTableTableAt (PRInt32 aIndex)
PRInt32 Count (PRBool aEverything=PR_FALSE)
nsGlyphTableAdditionalTableAt (PRInt32 aIndex)
PRInt32 AdditionalCount ()
PRBool AppendTable (nsGlyphTable *aGlyphTable)
nsGlyphTableAddGlyphTable (const nsString &aPrimaryFontName)
nsGlyphTableAddAdditionalGlyphTable (const nsString &aPrimaryFontName)
nsGlyphTableGetGlyphTableFor (nsPresContext *aPresContext, nsMathMLChar *aChar)
nsresult GetListFor (nsPresContext *aPresContext, nsMathMLChar *aChar, nsFont *aFont, nsVoidArray *aGlyphTableList)
nsresult GetPreferredListAt (nsPresContext *aPresContext, PRInt32 aStartingIndex, nsVoidArray *aGlyphTableList, PRInt32 *aCount)
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.

Static Public Attributes

NS_DECL_ISUPPORTS static
NS_DECL_NSIOBSERVER
nsBaseFontHashtable * 
gBaseFonts = nsnull
static PRInt32gParts = nsnull
static PRInt32gVariants = nsnull

Private Attributes

PRInt32 mDefaultCount
nsVoidArray mTableList
nsVoidArray mAdditionalTableList

Detailed Description

Definition at line 652 of file nsMathMLChar.cpp.


Constructor & Destructor Documentation

Definition at line 675 of file nsMathMLChar.cpp.

virtual nsGlyphTableList::~nsGlyphTableList ( ) [inline, virtual]

Definition at line 681 of file nsMathMLChar.cpp.


Member Function Documentation

Definition at line 834 of file nsMathMLChar.cpp.

{
  // allocate a table to be deleted at shutdown
  nsGlyphTable* glyphTable = new nsGlyphTable(aPrimaryFontName);
  if (!glyphTable) return nsnull;
  mAdditionalTableList.AppendElement(glyphTable);
  return glyphTable;
}

Here is the caller graph for this function:

Definition at line 823 of file nsMathMLChar.cpp.

{
  // allocate a table to be deleted at shutdown
  nsGlyphTable* glyphTable = new nsGlyphTable(aPrimaryFontName);
  if (!glyphTable) return nsnull;
  mTableList.AppendElement(glyphTable);
  mDefaultCount++;
  return glyphTable;
}

Here is the caller graph for this function:

Definition at line 699 of file nsMathMLChar.cpp.

                            {
    return mAdditionalTableList.Count();
  }

Here is the caller graph for this function:

Definition at line 696 of file nsMathMLChar.cpp.

                                                  {
    return NS_STATIC_CAST(nsGlyphTable*, mAdditionalTableList.ElementAt(aIndex));
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsGlyphTableList::AppendTable ( nsGlyphTable aGlyphTable) [inline]

Definition at line 703 of file nsMathMLChar.cpp.

                                                {
    return mTableList.AppendElement(aGlyphTable);
  }

Here is the caller graph for this function:

PRInt32 nsGlyphTableList::Count ( PRBool  aEverything = PR_FALSE) [inline]

Definition at line 692 of file nsMathMLChar.cpp.

                                               {
    return (aEverything) ? mTableList.Count() : mDefaultCount;
  }

Here is the caller graph for this function:

Definition at line 793 of file nsMathMLChar.cpp.

{
  // Remove our observer from the observer service
  nsresult rv = NS_OK;
  nsCOMPtr<nsIObserverService> obs = 
           do_GetService("@mozilla.org/observer-service;1", &rv);
  if (NS_SUCCEEDED(rv)) {
    rv = obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
  }
  // delete the glyph tables
  PRInt32 i;
  for (i = Count() - 1; i >= 0; i--) {
    nsGlyphTable* glyphTable = TableAt(i);
    delete glyphTable;
  }
  for (i = AdditionalCount() - 1; i >= 0; i--) {
    nsGlyphTable* glyphTable = AdditionalTableAt(i);
    delete glyphTable;
  }
  // delete the other variables
  delete gBaseFonts;
  delete [] gParts;
  delete [] gVariants;
  gParts = gVariants = nsnull;
  gInitialized = PR_FALSE;
  // our oneself will be destroyed when our |Release| is called by the observer
  return rv;
}

Here is the call graph for this function:

Definition at line 844 of file nsMathMLChar.cpp.

{
  PRInt32 i;
  for (i = 0; i < Count(); i++) {
    nsGlyphTable* glyphTable = TableAt(i);
    if (glyphTable->Has(aPresContext, aChar)) {
      return glyphTable;
    }
  }
  for (i = 0; i < AdditionalCount(); i++) {
    nsGlyphTable* glyphTable = AdditionalTableAt(i);
    if (glyphTable->Has(aPresContext, aChar)) {
      return glyphTable;
    }
  }
  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsGlyphTableList::GetListFor ( nsPresContext aPresContext,
nsMathMLChar aChar,
nsFont aFont,
nsVoidArray aGlyphTableList 
)

Definition at line 894 of file nsMathMLChar.cpp.

{
  // @see the documentation of -moz-math-stretchy in mathml.css
  // for how this work
  aGlyphTableList->Clear();
  PRBool useDocumentFonts =
    aPresContext->GetCachedBoolPref(kPresContext_UseDocumentFonts);

  // Check to honor the pref("browser.display.use_document_fonts", 0)
  // Only include fonts from CSS if the pref to disallow authors' fonts isn't set
  if (useDocumentFonts) {
    // Convert the list of fonts in aFont (from -moz-math-stretchy)
    // to an ordered list of corresponding glyph extension tables
    StretchyFontEnumContext context = {aPresContext, aChar, aGlyphTableList};
    aFont->EnumerateFamilies(StretchyFontEnumCallback, &context);
  }
  if (!aGlyphTableList->Count()) {
    // No font was retained, fallback to our default tables
    PRInt32 count = Count();
    for (PRInt32 i = 0; i < count; i++) {
      nsGlyphTable* glyphTable = TableAt(i);
      if (glyphTable->Has(aPresContext, aChar)) {
        aGlyphTableList->AppendElement(glyphTable);
      }
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsGlyphTableList::GetPreferredListAt ( nsPresContext aPresContext,
PRInt32  aStartingIndex,
nsVoidArray aGlyphTableList,
PRInt32 aCount 
)

Definition at line 927 of file nsMathMLChar.cpp.

{
  *aCount = 0;
  if (aStartingIndex == kNotFound) {
    return NS_OK;
  }
  nsAutoString fontName;
  PRInt32 index = aStartingIndex;
  NS_ASSERTION(index < Count(PR_TRUE), "invalid call");
  nsGlyphTable* glyphTable = TableAt(index);
  while (glyphTable) {
    glyphTable->GetPrimaryFontName(fontName);
    if (CheckFontExistence(aPresContext, fontName)) {
#ifdef NOISY_SEARCH
      char str[50];
      fontName.ToCString(str, sizeof(str));
      printf("Found preferreed font %s\n", str);
#endif
      if (index == aStartingIndex) {
        // At least one font is found, clear aGlyphTableList
        aGlyphTableList->Clear();
      }
      aGlyphTableList->AppendElement(glyphTable);
      ++*aCount;
    }
    glyphTable = TableAt(++index);
  } 
  // XXX append other tables if UseDocumentFonts is set?
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 780 of file nsMathMLChar.cpp.

{
  nsresult rv = NS_OK;
  nsCOMPtr<nsIObserverService> obs = 
           do_GetService("@mozilla.org/observer-service;1", &rv);
  if (NS_SUCCEEDED(rv)) {
    rv = obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.

Definition at line 689 of file nsMathMLChar.cpp.

                                        {
    return NS_STATIC_CAST(nsGlyphTable*, mTableList.ElementAt(aIndex));
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

nsBaseFontHashtable * nsGlyphTableList::gBaseFonts = nsnull [static]

Definition at line 659 of file nsMathMLChar.cpp.

Definition at line 672 of file nsMathMLChar.cpp.

Definition at line 673 of file nsMathMLChar.cpp.

Definition at line 752 of file nsMathMLChar.cpp.

Definition at line 745 of file nsMathMLChar.cpp.

Definition at line 746 of file nsMathMLChar.cpp.


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