bug 189740 Adding CID support Check Code to PS should be close when TrueType printing is disabled

r=bstell; sr=blizzard


git-svn-id: svn://10.0.0.236/trunk@136792 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
louie.zhao%sun.com
2003-01-22 03:52:38 +00:00
parent 29dc467308
commit adba43c7fb
5 changed files with 34 additions and 8 deletions

View File

@@ -213,9 +213,14 @@ nsDeviceContextPS::InitDeviceContextPS(nsIDeviceContext *aCreatingDeviceContext,
nsresult rv;
nsCOMPtr<nsIPref> 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

View File

@@ -99,7 +99,7 @@ public:
nsPostScriptObj* GetPrintContext() { return mPSObj; }
nsHashtable* GetPSFontGeneratorList() { return mPSFontGeneratorList; }
PRBool mTTPEnable;
PRBool mFTPEnable;
protected:
virtual ~nsDeviceContextPS();

View File

@@ -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

View File

@@ -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
}
/** ---------------------------------------------------

View File

@@ -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