diff --git a/mozilla/gfx/src/ps/nsDeviceContextPS.cpp b/mozilla/gfx/src/ps/nsDeviceContextPS.cpp index 78b1d63c28d..0f7c271953d 100644 --- a/mozilla/gfx/src/ps/nsDeviceContextPS.cpp +++ b/mozilla/gfx/src/ps/nsDeviceContextPS.cpp @@ -213,9 +213,14 @@ nsDeviceContextPS::InitDeviceContextPS(nsIDeviceContext *aCreatingDeviceContext, nsresult rv; nsCOMPtr pref(do_GetService(NS_PREF_CONTRACTID, &rv)); if (NS_SUCCEEDED(rv)) { - rv = pref->GetBoolPref("font.FreeType2.printing", &mTTPEnable); + rv = pref->GetBoolPref("font.FreeType2.enable", &mFTPEnable); if (NS_FAILED(rv)) - mTTPEnable = PR_FALSE; + mFTPEnable = PR_FALSE; + if (mFTPEnable) { + rv = pref->GetBoolPref("font.FreeType2.printing", &mFTPEnable); + if (NS_FAILED(rv)) + mFTPEnable = PR_FALSE; + } } #ifdef NS_FONTPS_DEBUG @@ -435,6 +440,13 @@ NS_IMETHODIMP nsDeviceContextPS::EndDocument(void) NS_ENSURE_TRUE(mPSObj != nsnull, NS_ERROR_NULL_POINTER); +#ifdef MOZ_ENABLE_FREETYPE2 + // Before output Type8 font, check whether printer support CID font + if (mFTPEnable && mPSFontGeneratorList) + if (mPSFontGeneratorList->Count() > 0) + mPSObj->add_cid_check(); +#endif + /* Core of TrueType printing: * enumerate items("nsPSFontGenerator") in hashtable * to generate Type8 font and output to Postscript file diff --git a/mozilla/gfx/src/ps/nsDeviceContextPS.h b/mozilla/gfx/src/ps/nsDeviceContextPS.h index 6f4a7727aa3..c716528a357 100644 --- a/mozilla/gfx/src/ps/nsDeviceContextPS.h +++ b/mozilla/gfx/src/ps/nsDeviceContextPS.h @@ -99,7 +99,7 @@ public: nsPostScriptObj* GetPrintContext() { return mPSObj; } nsHashtable* GetPSFontGeneratorList() { return mPSFontGeneratorList; } - PRBool mTTPEnable; + PRBool mFTPEnable; protected: virtual ~nsDeviceContextPS(); diff --git a/mozilla/gfx/src/ps/nsFontMetricsPS.cpp b/mozilla/gfx/src/ps/nsFontMetricsPS.cpp index c9dc3cdccc1..603fc0e9926 100644 --- a/mozilla/gfx/src/ps/nsFontMetricsPS.cpp +++ b/mozilla/gfx/src/ps/nsFontMetricsPS.cpp @@ -461,7 +461,7 @@ nsFontPS::FindFont(PRUnichar aChar, const nsFont& aFont, #ifdef MOZ_ENABLE_FREETYPE2 nsDeviceContextPS* dc = aFontMetrics->GetDeviceContext(); NS_ENSURE_TRUE(dc, nsnull); - if (dc->mTTPEnable) { + if (dc->mFTPEnable) { fontPS = nsFontPSFreeType::FindFont(aChar, aFont, aFontMetrics); if (fontPS) return fontPS; @@ -1606,7 +1606,8 @@ void nsFT2Type8Generator::GeneratePSFont(FILE* aFile) return; int wmode = 0; - FT2SubsetToType8(face, mSubset.get(), mSubset.Length(), wmode, aFile); + if (mSubset.Length() > 0) + FT2SubsetToType8(face, mSubset.get(), mSubset.Length(), wmode, aFile); } #endif //MOZ_ENABLE_FREETYPE2 diff --git a/mozilla/gfx/src/ps/nsPostScriptObj.cpp b/mozilla/gfx/src/ps/nsPostScriptObj.cpp index 6fe6c06d539..f1d6a9a4377 100644 --- a/mozilla/gfx/src/ps/nsPostScriptObj.cpp +++ b/mozilla/gfx/src/ps/nsPostScriptObj.cpp @@ -1993,10 +1993,18 @@ FILE *f; initlanggroup(); fprintf(f, "%%%%EndProlog\n"); -#ifdef MOZ_ENABLE_FREETYPE2 - AddCIDCheckCode(f); -#endif +} +/** --------------------------------------------------- + * See documentation in nsPostScriptObj.h + * @update 20/01/03 louie + */ +void +nsPostScriptObj::add_cid_check() +{ +#ifdef MOZ_ENABLE_FREETYPE2 + AddCIDCheckCode(mPrintContext->prSetup->out); +#endif } /** --------------------------------------------------- diff --git a/mozilla/gfx/src/ps/nsPostScriptObj.h b/mozilla/gfx/src/ps/nsPostScriptObj.h index a95d0e2d3d0..8a68d8da4bd 100644 --- a/mozilla/gfx/src/ps/nsPostScriptObj.h +++ b/mozilla/gfx/src/ps/nsPostScriptObj.h @@ -282,6 +282,11 @@ public: * @update 2/1/99 dwc */ nsresult end_document(); + /** --------------------------------------------------- + * add CID check code + * @update 01/20/03 louie + */ + void add_cid_check(); /** --------------------------------------------------- * move the cursor to this location * @update 2/1/99 dwc