diff --git a/mozilla/gfx/thebes/public/gfxWindowsFonts.h b/mozilla/gfx/thebes/public/gfxWindowsFonts.h index b82dfeb55bf..7a698191e10 100644 --- a/mozilla/gfx/thebes/public/gfxWindowsFonts.h +++ b/mozilla/gfx/thebes/public/gfxWindowsFonts.h @@ -192,11 +192,8 @@ public: PRPackedBool mUnicodeFont; PRPackedBool mSymbolFont; -<<<<<<< gfxWindowsFonts.h PRPackedBool mIsType1; -======= PRPackedBool mIsBadUnderlineFont; ->>>>>>> 1.68 std::bitset<256> mCharset; std::bitset<128> mUnicodeRanges; diff --git a/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp b/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp index 393266ab773..106d19727cf 100644 --- a/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp +++ b/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp @@ -912,9 +912,9 @@ public: * S_OK - things succeeded * GDI_ERROR - things failed to shape. Might want to try again after calling DisableShaping() */ - HRESULT Shape() { - HRESULT rv; + HRESULT ShapeUniscribe() { + HRESULT rv; HDC shapeDC = nsnull; const PRUnichar *str = mAlternativeString ? mAlternativeString : mRangeString; @@ -960,20 +960,34 @@ public: shapeDC = mDC; continue; } -#ifdef DEBUG_pavlov - if (rv == USP_E_SCRIPT_NOT_IN_FONT) { - ScriptGetCMap(mDC, mCurrentFont->ScriptCache(), str, mRangeString, 0, mGlyphs.Elements()); - PRUnichar foo[LF_FACESIZE+1]; - GetTextFaceW(mDC, LF_FACESIZE, foo); - printf("bah\n"); - } - else if (FAILED(rv)) - printf("%d\n", rv); -#endif + return rv; } } + HRESULT ShapeGDI() { + SelectFont(); + + mGlyphs.SetLength(mRangeLength); + mNumGlyphs = mRangeLength; + GetGlyphIndicesW(mDC, mRangeString, mRangeLength, + (WORD*) mGlyphs.Elements(), + GGI_MARK_NONEXISTING_GLYPHS); + + for (PRUint32 i = 0; i < mItemLength; ++i) + mClusters[i] = i; + + return S_OK; + } + + HRESULT Shape() { + /* Type1 fonts don't like Uniscribe */ + if (mCurrentFont->GetFontEntry()->mIsType1) + return ShapeGDI(); + + return ShapeUniscribe(); + } + PRBool ShapingEnabled() { return (mScriptItem->a.eScript != SCRIPT_UNDEFINED); } @@ -1053,16 +1067,21 @@ public: mAdvances.SetLength(mNumGlyphs); PRBool allCJK = PR_TRUE; - for (PRUint32 i = 0; i < mRangeLength; i++) { - const PRUnichar ch = mRangeString[i]; - if (ch == ' ' || FindCharUnicodeRange(ch) == kRangeSetCJK) - continue; - allCJK = PR_FALSE; - break; + /* Type1 fonts need to use GDI to be rendered so only do this + * check if we're not a type1 font */ + if (!mCurrentFont->GetFontEntry()->mIsType1) { + for (PRUint32 i = 0; i < mRangeLength; i++) { + const PRUnichar ch = mRangeString[i]; + if (ch == ' ' || FindCharUnicodeRange(ch) == kRangeSetCJK) + continue; + + allCJK = PR_FALSE; + break; + } } - if (allCJK) + if (allCJK || mCurrentFont->GetFontEntry()->mIsType1) return PlaceGDI(); return PlaceUniscribe(); diff --git a/mozilla/gfx/thebes/src/gfxWindowsPlatform.cpp b/mozilla/gfx/thebes/src/gfxWindowsPlatform.cpp index 118c343aa9e..0697edd1fb9 100644 --- a/mozilla/gfx/thebes/src/gfxWindowsPlatform.cpp +++ b/mozilla/gfx/thebes/src/gfxWindowsPlatform.cpp @@ -122,10 +122,13 @@ gfxWindowsPlatform::FontEnumProc(const ENUMLOGFONTEXW *lpelfe, nsRefPtr fe; if (!thisp->mFonts.Get(name, &fe)) { - fe = new FontEntry(nsDependentString(logFont.lfFaceName), (PRUint16)fontType); + fe = new FontEntry(nsDependentString(logFont.lfFaceName)); thisp->mFonts.Put(name, fe); } + if (metrics.ntmFlags & NTM_TYPE1) + fe->mIsType1 = PR_TRUE; + // mark the charset bit fe->mCharset[metrics.tmCharSet] = 1; @@ -135,11 +138,6 @@ gfxWindowsPlatform::FontEnumProc(const ENUMLOGFONTEXW *lpelfe, // store the default font weight fe->mDefaultWeight = metrics.tmWeight; - if (metrics.ntmFlags & NTM_TYPE1) { - fe->mSymbolFont = PR_TRUE; - fe->mUnicodeFont = PR_FALSE; - } - fe->mFamily = logFont.lfPitchAndFamily & 0xF0; fe->mPitch = logFont.lfPitchAndFamily & 0x0F; @@ -213,8 +211,10 @@ gfxWindowsPlatform::FontGetCMapDataProc(nsStringHashKey::KeyType aKey, nsresult rv = ReadCMAP(hdc, aFontEntry); if (NS_FAILED(rv)) { + if (aFontEntry->mIsType1) + aFontEntry->mSymbolFont = PR_TRUE; aFontEntry->mUnicodeFont = PR_FALSE; - //printf("%s failed to get cmap\n", NS_ConvertUTF16toUTF8(aFontEntry->mName).get()); + //printf("%d, %s failed to get cmap\n", aFontEntry->mIsType1, NS_ConvertUTF16toUTF8(aFontEntry->mName).get()); } SelectObject(hdc, oldFont);