Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsDeviceContextPS.cpp File Reference
#include "gfx-config.h"
#include "prlog.h"
#include "nsDeviceContextPS.h"
#include "nsRenderingContextPS.h"
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsString.h"
#include "nsFontMetricsPS.h"
#include "nsPostScriptObj.h"
#include "nspr.h"
#include "nsILanguageAtomService.h"
#include "nsPrintJobPS.h"
#include "nsPrintJobFactoryPS.h"

Go to the source code of this file.

Classes

class  nsFontCachePS

Defines

#define WE_DO_NOT_SUPPORT_MULTIPLE_PRINT_DEVICECONTEXTS   1
#define FORCE_PR_LOG   /* Allow logging in the release build */
#define PR_LOGGING   1

Functions

static PRBool FreePSFontGeneratorList (nsHashKey *aKey, void *aData, void *aClosure)
 NS_IMPL_ISUPPORTS_INHERITED1 (nsDeviceContextPS, DeviceContextImpl, nsIDeviceContextPS) NS_IMETHODIMP nsDeviceContextPS
 
See documentation in nsDeviceContextPS.h 12/21/98 dwc
static PRBool PR_CALLBACK GeneratePSFontCallback (nsHashKey *aKey, void *aData, void *aClosure)

Variables

static PRLogModuleInfonsDeviceContextPSLM = PR_NewLogModule("nsDeviceContextPS")
nsIAtomgUsersLocale = nsnull
static int instance_counter = 0

Define Documentation

#define FORCE_PR_LOG   /* Allow logging in the release build */

Definition at line 51 of file nsDeviceContextPS.cpp.

#define PR_LOGGING   1

Definition at line 52 of file nsDeviceContextPS.cpp.

Definition at line 49 of file nsDeviceContextPS.cpp.


Function Documentation

static PRBool FreePSFontGeneratorList ( nsHashKey *  aKey,
void aData,
void aClosure 
) [static]

Definition at line 81 of file nsDeviceContextPS.cpp.

{
  nsPSFontGenerator *psFG = (nsPSFontGenerator*)aData;
  if (psFG) {
    delete psFG;
    psFG = nsnull;
  }
  return PR_TRUE;
}

Here is the caller graph for this function:

static PRBool PR_CALLBACK GeneratePSFontCallback ( nsHashKey *  aKey,
void aData,
void aClosure 
) [static]

Definition at line 439 of file nsDeviceContextPS.cpp.

{
  nsPSFontGenerator* psFontGenerator = (nsPSFontGenerator*)aData;
  NS_ENSURE_TRUE(psFontGenerator && aClosure, PR_FALSE);

  if (aClosure)
    psFontGenerator->GeneratePSFont((FILE *)aClosure);
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:


See documentation in nsDeviceContextPS.h 12/21/98 dwc

Definition at line 179 of file nsDeviceContextPS.cpp.

{
  PR_LOG(nsDeviceContextPSLM, PR_LOG_DEBUG, ("nsDeviceContextPS::InitDeviceContextPS()\n"));

  float origscale, newscale;
  float t2d, a2d;

#ifdef WE_DO_NOT_SUPPORT_MULTIPLE_PRINT_DEVICECONTEXTS
  NS_ASSERTION(instance_counter < 2, "Cannot have more than one print device context.");
  if (instance_counter > 1) {
    return NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW;
  }
#endif /* WE_DO_NOT_SUPPORT_MULTIPLE_PRINT_DEVICECONTEXTS */

  NS_ENSURE_ARG_POINTER(aParentContext);

  mDepth = 24; /* Our PostScript module code expects images and other stuff in 24bit RGB-format (8bits per gun)*/

  mTwipsToPixels = (float)72.0/(float)NSIntPointsToTwips(72);
  mPixelsToTwips = 1.0f / mTwipsToPixels;

  newscale = TwipsToDevUnits();
  origscale = aParentContext->TwipsToDevUnits();
  mCPixelScale = newscale / origscale;

  t2d = aParentContext->TwipsToDevUnits();
  a2d = aParentContext->AppUnitsToDevUnits();

  mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
  mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;

  mParentDeviceContext = aParentContext;

  mPSFontGeneratorList = new nsHashtable();
  NS_ENSURE_TRUE(mPSFontGeneratorList, NS_ERROR_OUT_OF_MEMORY);
 
  nsresult rv;
  nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID, &rv));
#ifdef MOZ_ENABLE_XFT
  if (NS_SUCCEEDED(rv)) {
      rv = pref->GetBoolPref("font.FreeType2.printing", &mFTPEnable);
      if (NS_FAILED(rv))
        mFTPEnable = PR_FALSE;
  }
#else 
  mFTPEnable = PR_FALSE;
#ifdef MOZ_ENABLE_FREETYPE2
  if (NS_SUCCEEDED(rv)) {
    rv = pref->GetBoolPref("font.FreeType2.enable", &mFTPEnable);
    if (NS_FAILED(rv))
      mFTPEnable = PR_FALSE;
    if (mFTPEnable) {
      rv = pref->GetBoolPref("font.FreeType2.printing", &mFTPEnable);
      if (NS_FAILED(rv))
        mFTPEnable = PR_FALSE;
    }
  }
#endif
#endif
  
  // the user's locale
  nsCOMPtr<nsILanguageAtomService> langService;
  langService = do_GetService(NS_LANGUAGEATOMSERVICE_CONTRACTID);
  if (langService) {
    NS_IF_ADDREF(gUsersLocale = langService->GetLocaleLanguageGroup());
  }
  if (!gUsersLocale) {
    gUsersLocale = NS_NewAtom("x-western");
  }

  return NS_OK;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 74 of file nsDeviceContextPS.cpp.

int instance_counter = 0 [static]

Definition at line 77 of file nsDeviceContextPS.cpp.

PRLogModuleInfo* nsDeviceContextPSLM = PR_NewLogModule("nsDeviceContextPS") [static]

Definition at line 71 of file nsDeviceContextPS.cpp.