Bug 730550 - Make sure the t2embed library is available before using. r=jdaggett

--HG--
extra : rebase_source : f5fd56246a71795ad872f4db10c58c9f28fbaac2
This commit is contained in:
Masatoshi Kimura 2012-02-28 17:04:05 +01:00
Родитель fb0d08523f
Коммит e7e857a078
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -103,6 +103,8 @@ BuildKeyNameFromFontName(nsAString &aName)
// Implementation of gfxPlatformFontList for Win32 GDI,
// using GDI font enumeration APIs to get the list of fonts
static HMODULE fontlib;
class WinUserFontData : public gfxUserFontData {
public:
WinUserFontData(HANDLE aFontRef, bool aIsEmbedded)
@ -563,6 +565,12 @@ GDIFontFamily::FindStyleVariations()
gfxGDIFontList::gfxGDIFontList()
{
mFontSubstitutes.Init(50);
// Make sure the t2embed library is available because it may be
// disabled to work around security vulnerabilities.
if (!fontlib) {
fontlib = LoadLibraryW(L"t2embed.dll");
}
}
static void
@ -852,6 +860,10 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
};
FontDataDeleter autoDelete(aFontData);
// if the t2embed library isn't available, bail
if (!fontlib)
return nsnull;
bool hasVertical;
bool isCFF = gfxFontUtils::IsCffFont(aFontData, hasVertical);