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

r=bstell; sr=blizzard
This commit is contained in:
louie.zhao%sun.com 2003-01-22 03:52:38 +00:00
Родитель 71e3aa338c
Коммит 283a4a1a8f
5 изменённых файлов: 34 добавлений и 8 удалений

Просмотреть файл

@ -213,9 +213,14 @@ nsDeviceContextPS::InitDeviceContextPS(nsIDeviceContext *aCreatingDeviceContext,
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID, &rv)); nsCOMPtr<nsIPref> pref(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
rv = pref->GetBoolPref("font.FreeType2.printing", &mTTPEnable); rv = pref->GetBoolPref("font.FreeType2.enable", &mFTPEnable);
if (NS_FAILED(rv)) 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 #ifdef NS_FONTPS_DEBUG
@ -435,6 +440,13 @@ NS_IMETHODIMP nsDeviceContextPS::EndDocument(void)
NS_ENSURE_TRUE(mPSObj != nsnull, NS_ERROR_NULL_POINTER); 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: /* Core of TrueType printing:
* enumerate items("nsPSFontGenerator") in hashtable * enumerate items("nsPSFontGenerator") in hashtable
* to generate Type8 font and output to Postscript file * to generate Type8 font and output to Postscript file

Просмотреть файл

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

Просмотреть файл

@ -461,7 +461,7 @@ nsFontPS::FindFont(PRUnichar aChar, const nsFont& aFont,
#ifdef MOZ_ENABLE_FREETYPE2 #ifdef MOZ_ENABLE_FREETYPE2
nsDeviceContextPS* dc = aFontMetrics->GetDeviceContext(); nsDeviceContextPS* dc = aFontMetrics->GetDeviceContext();
NS_ENSURE_TRUE(dc, nsnull); NS_ENSURE_TRUE(dc, nsnull);
if (dc->mTTPEnable) { if (dc->mFTPEnable) {
fontPS = nsFontPSFreeType::FindFont(aChar, aFont, aFontMetrics); fontPS = nsFontPSFreeType::FindFont(aChar, aFont, aFontMetrics);
if (fontPS) if (fontPS)
return fontPS; return fontPS;
@ -1606,7 +1606,8 @@ void nsFT2Type8Generator::GeneratePSFont(FILE* aFile)
return; return;
int wmode = 0; 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 #endif //MOZ_ENABLE_FREETYPE2

Просмотреть файл

@ -1993,10 +1993,18 @@ FILE *f;
initlanggroup(); initlanggroup();
fprintf(f, "%%%%EndProlog\n"); 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
} }
/** --------------------------------------------------- /** ---------------------------------------------------

Просмотреть файл

@ -282,6 +282,11 @@ public:
* @update 2/1/99 dwc * @update 2/1/99 dwc
*/ */
nsresult end_document(); nsresult end_document();
/** ---------------------------------------------------
* add CID check code
* @update 01/20/03 louie
*/
void add_cid_check();
/** --------------------------------------------------- /** ---------------------------------------------------
* move the cursor to this location * move the cursor to this location
* @update 2/1/99 dwc * @update 2/1/99 dwc