зеркало из https://github.com/mozilla/gecko-dev.git
backing out trial patch for bug 424018.
This commit is contained in:
Родитель
df64c78961
Коммит
502a03c7c7
|
@ -64,13 +64,12 @@ public:
|
||||||
THEBES_INLINE_DECL_REFCOUNTING(FontFamily)
|
THEBES_INLINE_DECL_REFCOUNTING(FontFamily)
|
||||||
|
|
||||||
FontFamily(const nsAString& aName) :
|
FontFamily(const nsAString& aName) :
|
||||||
mName(aName), mHasStyles(PR_FALSE)
|
mName(aName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTArray<nsRefPtr<FontEntry> > mVariations;
|
nsTArray<nsRefPtr<FontEntry> > mVariations;
|
||||||
nsString mName;
|
nsString mName;
|
||||||
PRBool mHasStyles;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FontEntry
|
class FontEntry
|
||||||
|
|
|
@ -129,7 +129,6 @@ gfxWindowsPlatform::FontEnumProc(const ENUMLOGFONTEXW *lpelfe,
|
||||||
if (!ht->Get(name, &ff)) {
|
if (!ht->Get(name, &ff)) {
|
||||||
ff = new FontFamily(nsDependentString(logFont.lfFaceName));
|
ff = new FontFamily(nsDependentString(logFont.lfFaceName));
|
||||||
ht->Put(name, ff);
|
ht->Put(name, ff);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<FontEntry> fe;
|
nsRefPtr<FontEntry> fe;
|
||||||
|
@ -253,12 +252,8 @@ gfxWindowsPlatform::FontGetStylesProc(nsStringHashKey::KeyType aKey,
|
||||||
nsRefPtr<FontFamily>& aFontFamily,
|
nsRefPtr<FontFamily>& aFontFamily,
|
||||||
void* userArg)
|
void* userArg)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
NS_ASSERTION(aFontFamily->mVariations.Length() == 1, "We should only have 1 variation here");
|
NS_ASSERTION(aFontFamily->mVariations.Length() == 1, "We should only have 1 variation here");
|
||||||
nsRefPtr<FontEntry> aFontEntry = aFontFamily->mVariations[0];
|
nsRefPtr<FontEntry> aFontEntry = aFontFamily->mVariations[0];
|
||||||
*/
|
|
||||||
NS_ASSERTION(!aFontFamily->mHasStyles, "Already got styles for this family");
|
|
||||||
aFontFamily->mHasStyles = PR_TRUE;
|
|
||||||
|
|
||||||
HDC hdc = GetDC(nsnull);
|
HDC hdc = GetDC(nsnull);
|
||||||
|
|
||||||
|
@ -266,9 +261,9 @@ gfxWindowsPlatform::FontGetStylesProc(nsStringHashKey::KeyType aKey,
|
||||||
memset(&logFont, 0, sizeof(LOGFONTW));
|
memset(&logFont, 0, sizeof(LOGFONTW));
|
||||||
logFont.lfCharSet = DEFAULT_CHARSET;
|
logFont.lfCharSet = DEFAULT_CHARSET;
|
||||||
logFont.lfPitchAndFamily = 0;
|
logFont.lfPitchAndFamily = 0;
|
||||||
PRUint32 l = PR_MIN(aFontFamily->mName.Length(), LF_FACESIZE - 1);
|
PRUint32 l = PR_MIN(aFontEntry->GetName().Length(), LF_FACESIZE - 1);
|
||||||
memcpy(logFont.lfFaceName,
|
memcpy(logFont.lfFaceName,
|
||||||
nsPromiseFlatString(aFontFamily->mName).get(),
|
nsPromiseFlatString(aFontEntry->GetName()).get(),
|
||||||
l * sizeof(PRUnichar));
|
l * sizeof(PRUnichar));
|
||||||
logFont.lfFaceName[l] = 0;
|
logFont.lfFaceName[l] = 0;
|
||||||
|
|
||||||
|
@ -391,6 +386,9 @@ gfxWindowsPlatform::UpdateFontList()
|
||||||
EnumFontFamiliesExW(dc, &logFont, (FONTENUMPROCW)gfxWindowsPlatform::FontEnumProc, (LPARAM)&mFonts, 0);
|
EnumFontFamiliesExW(dc, &logFont, (FONTENUMPROCW)gfxWindowsPlatform::FontEnumProc, (LPARAM)&mFonts, 0);
|
||||||
::ReleaseDC(nsnull, dc);
|
::ReleaseDC(nsnull, dc);
|
||||||
|
|
||||||
|
// Look for additional styles
|
||||||
|
mFonts.Enumerate(gfxWindowsPlatform::FontGetStylesProc, &mFonts);
|
||||||
|
|
||||||
// Create the list of FontSubstitutes
|
// Create the list of FontSubstitutes
|
||||||
nsCOMPtr<nsIWindowsRegKey> regKey = do_CreateInstance("@mozilla.org/windows-registry-key;1");
|
nsCOMPtr<nsIWindowsRegKey> regKey = do_CreateInstance("@mozilla.org/windows-registry-key;1");
|
||||||
if (!regKey)
|
if (!regKey)
|
||||||
|
@ -693,12 +691,6 @@ gfxWindowsPlatform::FindFontEntry(const nsAString& aName, const gfxFontStyle *aF
|
||||||
FontEntry *
|
FontEntry *
|
||||||
gfxWindowsPlatform::FindFontEntry(FontFamily *aFontFamily, const gfxFontStyle *aFontStyle)
|
gfxWindowsPlatform::FindFontEntry(FontFamily *aFontFamily, const gfxFontStyle *aFontStyle)
|
||||||
{
|
{
|
||||||
if (!aFontFamily->mHasStyles) {
|
|
||||||
nsStringHashKey::KeyType aKey = aFontFamily->mName;
|
|
||||||
nsRefPtr<FontFamily> ff = aFontFamily;
|
|
||||||
gfxWindowsPlatform::FontGetStylesProc(aKey, ff, &mFonts);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRUint8 bestMatch = 0;
|
PRUint8 bestMatch = 0;
|
||||||
PRBool italic = (aFontStyle->style & (FONT_STYLE_ITALIC | FONT_STYLE_OBLIQUE)) != 0;
|
PRBool italic = (aFontStyle->style & (FONT_STYLE_ITALIC | FONT_STYLE_OBLIQUE)) != 0;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче