From 7de7827badc4b5c6c5a09bd979bb88614add6556 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Mon, 4 May 2009 13:00:54 -0400 Subject: [PATCH] bug 491305 - Allow loading fonts from an application folder r=vlad --- gfx/thebes/src/gfxWindowsPlatform.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gfx/thebes/src/gfxWindowsPlatform.cpp b/gfx/thebes/src/gfxWindowsPlatform.cpp index 123a8b39fc0..0af55f10e7b 100644 --- a/gfx/thebes/src/gfxWindowsPlatform.cpp +++ b/gfx/thebes/src/gfxWindowsPlatform.cpp @@ -59,6 +59,7 @@ #include FT_FREETYPE_H #include "gfxFT2Fonts.h" #include "cairo-ft.h" +#include "nsAppDirectoryServiceDefs.h" #else #include "gfxWindowsFonts.h" #endif @@ -318,7 +319,7 @@ void gfxWindowsPlatform::AppendFacesFromFontFile(const PRUnichar *aFileName) { void gfxWindowsPlatform::FindFonts() { - nsTArray searchPaths(2); + nsTArray searchPaths(3); nsTArray fontPatterns(3); fontPatterns.AppendElement(NS_LITERAL_STRING("\\*.ttf")); fontPatterns.AppendElement(NS_LITERAL_STRING("\\*.ttc")); @@ -328,6 +329,14 @@ gfxWindowsPlatform::FindFonts() searchPaths.AppendElement(pathBuf); SHGetSpecialFolderPathW(0, pathBuf, CSIDL_FONTS, 0); searchPaths.AppendElement(pathBuf); + nsCOMPtr resDir; + NS_GetSpecialDirectory(NS_APP_RES_DIR, getter_AddRefs(resDir)); + if (resDir) { + resDir->Append(NS_LITERAL_STRING("fonts")); + nsDependentString resPath; + resDir->GetPath(resPath); + searchPaths.AppendElement(resPath); + } WIN32_FIND_DATAW results; for (PRUint32 i = 0; i < searchPaths.Length(); i++) { const nsString& path(searchPaths[i]);