From 92f4b1b60880d7da2ed4b8b4274da82ac4f4d485 Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Tue, 11 Aug 1998 23:54:04 +0000 Subject: [PATCH] force aliasing of courier font --- gfx/src/nsDeviceContext.cpp | 23 ++++++++++++----------- gfx/src/nsDeviceContext.h | 3 ++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 7d04a9d1e61..686d4056633 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -416,14 +416,14 @@ nsresult DeviceContextImpl::CreateFontAliasTable() if (nsnull == mFontAliasTable) { mFontAliasTable = new nsHashtable(); if (nsnull != mFontAliasTable) { - AliasFont("Times", "Times New Roman", "Times Roman"); - AliasFont("Times Roman", "Times New Roman", "Times"); - AliasFont("Times New Roman", "Times Roman", "Times"); - AliasFont("Arial", "Helvetica", ""); - AliasFont("Helvetica", "Arial", ""); - AliasFont("Courier", "Courier New", ""); - AliasFont("Courier New", "Courier", ""); - AliasFont("Unicode", "Bitstream Cyberbit", ""); // XXX ???? + AliasFont("Times", "Times New Roman", "Times Roman", PR_FALSE); + AliasFont("Times Roman", "Times New Roman", "Times", PR_FALSE); + AliasFont("Times New Roman", "Times Roman", "Times", PR_FALSE); + AliasFont("Arial", "Helvetica", "", PR_FALSE); + AliasFont("Helvetica", "Arial", "", PR_FALSE); + AliasFont("Courier", "Courier New", "", PR_TRUE); + AliasFont("Courier New", "Courier", "", PR_FALSE); + AliasFont("Unicode", "Bitstream Cyberbit", "", PR_FALSE); // XXX ???? } else { result = NS_ERROR_OUT_OF_MEMORY; @@ -433,12 +433,13 @@ nsresult DeviceContextImpl::CreateFontAliasTable() } nsresult DeviceContextImpl::AliasFont(const nsString& aFont, - const nsString& aAlias, const nsString& aAltAlias) + const nsString& aAlias, const nsString& aAltAlias, + PRBool aForceAlias) { nsresult result = NS_OK; if (nsnull != mFontAliasTable) { - if (NS_OK != CheckFontExistence(aFont)) { + if (aForceAlias || (NS_OK != CheckFontExistence(aFont))) { if (NS_OK == CheckFontExistence(aAlias)) { nsString* entry = aAlias.ToNewString(); if (nsnull != entry) { @@ -449,7 +450,7 @@ nsresult DeviceContextImpl::AliasFont(const nsString& aFont, result = NS_ERROR_OUT_OF_MEMORY; } } - else if ((aAltAlias.Length() > 0) && (NS_OK == CheckFontExistence(aAltAlias))) { + else if ((0 < aAltAlias.Length()) && (NS_OK == CheckFontExistence(aAltAlias))) { nsString* entry = aAltAlias.ToNewString(); if (nsnull != entry) { StringKey key(aFont); diff --git a/gfx/src/nsDeviceContext.h b/gfx/src/nsDeviceContext.h index 4d63102d267..7ad41452021 100644 --- a/gfx/src/nsDeviceContext.h +++ b/gfx/src/nsDeviceContext.h @@ -80,7 +80,8 @@ protected: nsresult CreateIconILGroupContext(); virtual nsresult CreateFontAliasTable(); nsresult AliasFont(const nsString& aFont, - const nsString& aAlias, const nsString& aAltAlias); + const nsString& aAlias, const nsString& aAltAlias, + PRBool aForceAlias); float mTwipsToPixels; float mPixelsToTwips;