Checking in Roland.Mainz@informatik.med.uni-giessen.de's fix for bug 87285, MathML broken in Xlib-toolkit and Xprint. r=rbs@maths.uq.edu.au, sr=kin@netscape.com

This commit is contained in:
jst%netscape.com 2001-09-20 05:13:26 +00:00
Родитель 132f8e334c
Коммит 023b7de114
6 изменённых файлов: 54 добавлений и 26 удалений

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

@ -387,7 +387,7 @@ NS_IMETHODIMP nsDeviceContextXlib::ConvertPixel(nscolor aColor, PRUint32 & aPixe
NS_IMETHODIMP nsDeviceContextXlib::CheckFontExistence(const nsString& aFontName)
{
return nsFontMetricsXlib::FamilyExists(aFontName);
return nsFontMetricsXlib::FamilyExists(this, aFontName);
}
NS_IMETHODIMP nsDeviceContextXlib::GetDeviceSurfaceDimensions(PRInt32 &aWidth, PRInt32 &aHeight)

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

@ -757,10 +757,18 @@ nsFontMetricsXlib::FreeGlobals(void)
* Initialize all the font lookup hash tables and other globals
*/
nsresult
nsFontMetricsXlib::InitGlobals(void)
nsFontMetricsXlib::InitGlobals(nsIDeviceContext *aDevice)
{
nsresult rv = NS_OK;
NS_ASSERTION(aDevice!=nsnull, "calling InitGlobals() without a device");
#ifdef USE_XPRINT
if (mPrinterMode)
gXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXp *,aDevice)->GetXlibRgbHandle();
else
#endif /* USE_XPRINT */
gXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXlib *,aDevice)->GetXlibRgbHandle();
nsServiceManager::GetService(kCharSetManagerCID,
NS_GET_IID(nsICharsetConverterManager2),
(nsISupports**) &gCharSetManager);
@ -1035,7 +1043,7 @@ nsFontMetricsXlib::Init(const nsFont& aFont, nsIAtom* aLangGroup,
mDocConverterType = nsnull;
if (!gInitialized) {
res = InitGlobals();
res = InitGlobals(aContext);
if (NS_FAILED(res))
return res;
}
@ -1057,16 +1065,6 @@ nsFontMetricsXlib::Init(const nsFont& aFont, nsIAtom* aLangGroup,
mDeviceContext = aContext;
if (!gXlibRgbHandle)
{
#ifdef USE_XPRINT
if (mPrinterMode)
gXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXp *,mDeviceContext)->GetXlibRgbHandle();
else
#endif /* USE_XPRINT */
gXlibRgbHandle = NS_STATIC_CAST(nsDeviceContextXlib *,mDeviceContext)->GetXlibRgbHandle();
}
float app2dev;
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
@ -1885,8 +1883,6 @@ nsFontXlib::LoadFont(void)
if (mAlreadyCalledLoadFont)
return;
mAlreadyCalledLoadFont = PR_TRUE;
Display *aDisplay = xxlib_rgb_get_display(gXlibRgbHandle);
#ifdef USE_XPRINT
@ -1896,11 +1892,17 @@ nsFontXlib::LoadFont(void)
{
/* applications must not make any assumptions about fonts _before_ XpSetContext() !!! */
NS_ERROR("Obtaining font information without a valid print context (XLoadQueryFont()) _before_ XpSetContext()\n");
#ifdef DEBUG
abort();
#else
return;
#endif /* DEBUG */
}
}
#endif /* USE_XPRINT */
mAlreadyCalledLoadFont = PR_TRUE;
XFontStruct *xlibFont = ::XLoadQueryFont(aDisplay, mName);
#ifdef DEBUG
@ -3048,8 +3050,15 @@ GetFontNames(const char* aPattern, nsFontNodeArrayXlib* aNodes)
Display *dpy = xxlib_rgb_get_display(gXlibRgbHandle);
#ifdef USE_XPRINT
#ifdef DEBUG
if(nsFontMetricsXlib::mPrinterMode)
{
if (!dpy)
{
NS_ERROR("Obtaining font information without having a |Display *|");
abort(); /* DIE!! */
}
if (XpGetContext(dpy) == None)
{
/* applications must not make any assumptions about fonts _before_ XpSetContext() !!! */
@ -3057,6 +3066,7 @@ GetFontNames(const char* aPattern, nsFontNodeArrayXlib* aNodes)
abort(); /* DIE!! */
}
}
#endif /* DEBUG */
#endif /* USE_XPRINT */
int count;
char** list = ::XListFonts(dpy, aPattern, INT_MAX, &count);
@ -3404,14 +3414,14 @@ FindFamily(nsCString* aName)
}
nsresult
nsFontMetricsXlib::FamilyExists(const nsString& aName)
nsFontMetricsXlib::FamilyExists(nsIDeviceContext *aDevice, const nsString& aName)
{
if (!gInitialized) {
nsresult res = InitGlobals();
nsresult res = InitGlobals(aDevice);
if (NS_FAILED(res))
return res;
}
if (!IsASCIIFontName(aName))
return NS_ERROR_FAILURE;

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

@ -117,7 +117,7 @@ public:
static void EnablePrinterMode(PRBool printermode);
#endif /* USE_XPRINT */
static nsresult InitGlobals(void);
static nsresult InitGlobals(nsIDeviceContext *);
static void FreeGlobals(void);
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
@ -171,7 +171,7 @@ public:
nsFontCharSetXlibInfo* aCharSet,
PRUnichar aChar);
static nsresult FamilyExists(const nsString& aFontName);
static nsresult FamilyExists(nsIDeviceContext*, const nsString& aFontName);
nsCAutoString mDefaultFont;
nsCString *mGeneric;

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

@ -61,7 +61,9 @@ public:
}
PRInt32 AddRef(void) {
if(mRefCnt>100) abort();
#ifdef DEBUG
if(mRefCnt>400) abort();
#endif /* DEBUG */
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");
++mRefCnt;
return mRefCnt;

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

@ -1483,7 +1483,12 @@ FoundFont:
if (aSpacing) {
const PRUnichar* str = &aString[start];
const PRUnichar* end = &aString[i];
// save off mCurrentFont and set it so that we cache the GC's font correctly
nsFontXlib *oldFont = mCurrentFont;
mCurrentFont = prevFont;
UpdateGC();
while (str < end) {
x = aX;
y = aY;
@ -1492,12 +1497,16 @@ FoundFont:
aX += *aSpacing++;
str++;
}
mCurrentFont = oldFont;
}
else
{
else {
// save off mCurrentFont and set it so that we cache the GC's font correctly
nsFontXlib *oldFont = mCurrentFont;
mCurrentFont = prevFont;
UpdateGC();
prevFont->DrawString(this, mRenderingSurface, x, y, &aString[start], i - start);
x += prevFont->GetWidth(&aString[start], i -start);
x += prevFont->DrawString(this, mRenderingSurface, x, y, &aString[start],
i - start);
mCurrentFont = oldFont;
}
prevFont = currFont;
start = i;
@ -1510,7 +1519,11 @@ FoundFont:
}
if (prevFont) {
// save off mCurrentFont and set it so that we cache the GC's font correctly
nsFontXlib *oldFont = mCurrentFont;
mCurrentFont = prevFont;
UpdateGC();
if (aSpacing) {
const PRUnichar* str = &aString[start];
const PRUnichar* end = &aString[i];
@ -1522,10 +1535,13 @@ FoundFont:
aX += *aSpacing++;
str++;
}
}
else {
prevFont->DrawString(this, mRenderingSurface, x, y, &aString[start], i - start);
}
mCurrentFont = oldFont;
}
}

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

@ -181,7 +181,7 @@ NS_IMETHODIMP nsDeviceContextXp :: GetDrawingSurface(nsIRenderingContext &aConte
*/
NS_IMETHODIMP nsDeviceContextXp :: CheckFontExistence(const nsString& aFontName)
{
return nsFontMetricsXlib::FamilyExists(aFontName);
return nsFontMetricsXlib::FamilyExists(this, aFontName);
}
NS_IMETHODIMP nsDeviceContextXp :: GetSystemAttribute(nsSystemAttrID anID,