Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsSVGRendererLibart.cpp File Reference
#include "nsCOMPtr.h"
#include "nsISVGRenderer.h"
#include "nsSVGLibartPathGeometry.h"
#include "nsSVGLibartCanvas.h"
#include "nsSVGLibartRegion.h"
#include "nsSVGLibartGlyphGeometryDefault.h"
#include "nsSVGLibartGlyphMetricsDefault.h"

Go to the source code of this file.

Classes

class  nsSVGRendererLibart
 Libart-based renderer implementation. More...

Functions

nsresult NS_NewSVGRendererLibart (nsISVGRenderer **aResult)
void NS_InitSVGRendererLibartGlobals ()
void NS_FreeSVGRendererLibartGlobals ()

Function Documentation

Definition at line 225 of file nsSVGRendererLibart.cpp.

{
  if (!nsSVGRendererLibart::sGlobalsInited) return;
  
#ifdef MOZ_ENABLE_FREETYPE2
  if (nsSVGRendererLibart::sUseFreetype) {
    NS_FreeSVGLibartGlyphMetricsFTGlobals();  
    nsSVGLibartFreetype::Shutdown();
  }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 216 of file nsSVGRendererLibart.cpp.

{
  // Initialization of freetype (if compiled-in) is done lazily in
  // NS_NewSVGRendererLibart(). The main reason is that we might want
  // to show error messages using the prompt service, and that's
  // probably not a good idea in *this* function, at a time when
  // layout is still not fully initialized.
}

Here is the caller graph for this function:

Definition at line 105 of file nsSVGRendererLibart.cpp.

{
  NS_PRECONDITION(aResult != nsnull, "null ptr");
  if (! aResult)
    return NS_ERROR_NULL_POINTER;

  nsSVGRendererLibart* result = new nsSVGRendererLibart();
  if (! result)
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(result);
  *aResult = result;

  if (!nsSVGRendererLibart::sGlobalsInited) {
#ifdef MOZ_ENABLE_FREETYPE2
    if (!nsSVGLibartFreetype::Init()) {
      nsCOMPtr<nsIPromptService> prompter(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
      NS_NAMED_LITERAL_STRING(title, "Freetype error");
      NS_NAMED_LITERAL_STRING(msg, "The Libart/Freetype SVG rendering engine could not initialize the freetype library. Please go to http://www.mozilla.org/projects/fonts/unix/enabling_truetype.html and follow steps 2-7.");
      prompter->Alert(nsnull, title.get(), msg.get());
    }
    else if (!nsSVGLibartFreetype::HasSuitableFonts()) {
      nsCOMPtr<nsIPromptService> prompter(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
      NS_NAMED_LITERAL_STRING(title, "Font Configuration Error");
      NS_NAMED_LITERAL_STRING(msg, "The Libart/Freetype SVG rendering engine can't find any truetype fonts on your system. Please go to http://www.mozilla.org/projects/fonts/unix/enabling_truetype.html and follow steps 2-7.");
      prompter->Alert(nsnull, title.get(), msg.get());
      nsSVGLibartFreetype::Shutdown();
    }
    else {
      nsSVGRendererLibart::sUseFreetype = PR_TRUE;
      NS_InitSVGLibartGlyphMetricsFTGlobals();
    }
#endif    
    nsSVGRendererLibart::sGlobalsInited = PR_TRUE;
  }
  
  return NS_OK;
}

Here is the call graph for this function: