Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsSVGGDIPlusGlyphMetrics.cpp File Reference
#include <windows.h>
#include <unknwn.h>
#include <Gdiplus.h>
#include "nsUnicharUtils.h"
#include "nsCOMPtr.h"
#include "nsISVGGlyphMetricsSource.h"
#include "nsPromiseFlatString.h"
#include "nsFont.h"
#include "nsPresContext.h"
#include "nsDeviceContextWin.h"
#include "nsISVGGDIPlusGlyphMetrics.h"
#include "nsSVGGDIPlusGlyphMetrics.h"
#include "float.h"
#include "nsIDOMSVGMatrix.h"
#include "nsIDOMSVGRect.h"
#include "nsSVGTypeCIDs.h"
#include "nsIComponentManager.h"
#include "nsDataHashtable.h"

Go to the source code of this file.

Classes

class  nsWindowsDC
 Helper class used by nsSVGGDIPlusGlyphMetrics. More...
class  nsSVGGDIPlusGlyphMetrics
 GDI+ glyph metrics implementation. More...

Functions

nsresult NS_NewSVGGDIPlusGlyphMetrics (nsISVGRendererGlyphMetrics **result, nsISVGGlyphMetricsSource *src)
void NS_InitSVGGDIPlusGlyphMetricsGlobals ()
void NS_FreeSVGGDIPlusGlyphMetricsGlobals ()
static PRBool FindFontFamily (const nsString &aFamily, PRBool aGeneric, void *aData)

Function Documentation

static PRBool FindFontFamily ( const nsString aFamily,
PRBool  aGeneric,
void aData 
) [static]

Definition at line 465 of file nsSVGGDIPlusGlyphMetrics.cpp.

{
  PRBool retval = PR_TRUE;
  
#ifdef DEBUG
//   printf("trying to instantiate font %s, generic=%d\n", NS_ConvertUCS2toUTF8(aFamily).get(),
//          aGeneric);
#endif
  
  FontFamily *family = nsnull;
  if (!aGeneric)
    family = new FontFamily(aFamily.get());
  else {
    PRUint8 id;
    nsFont::GetGenericID(aFamily, &id);
    switch (id) {
      case kGenericFont_serif:
        family = FontFamily::GenericSerif()->Clone();
        break;
      case kGenericFont_monospace:
        family = FontFamily::GenericMonospace()->Clone();
        break;
      case kGenericFont_sans_serif:
      default:
        family = FontFamily::GenericSansSerif()->Clone();
        break;
    }
  }

  if (family->IsAvailable()) {
    retval = PR_FALSE; // break
    *(FontFamily**)aData = family;
  }
  else {
    delete family;
    
    //try alias if there is one:
    const nsString *alias = nsnull;
    nsAutoString canonical_name(aFamily);
    ToLowerCase(canonical_name);
    nsSVGGDIPlusGlyphMetrics::sFontAliases.Get(canonical_name, &alias);
    if (alias) {
      // XXX this might cause a stack-overflow if there are cyclic
      // aliases in sFontAliases
      retval = FindFontFamily(*alias, PR_FALSE, aData);
    }
  }

  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 204 of file nsSVGGDIPlusGlyphMetrics.cpp.

Here is the call graph for this function:

Definition at line 185 of file nsSVGGDIPlusGlyphMetrics.cpp.

Here is the call graph for this function:

Definition at line 175 of file nsSVGGDIPlusGlyphMetrics.cpp.

{
  *result = new nsSVGGDIPlusGlyphMetrics(src);
  if (!*result) return NS_ERROR_OUT_OF_MEMORY;
  
  NS_ADDREF(*result);
  return NS_OK;
}

Here is the call graph for this function: