aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-07-15 00:50:46 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-07-15 00:50:46 +0800
commitd1df267f3880d560d778edb115a63acce689737f (patch)
tree732689344ba58c7b21c82c5b7611b257abc0f7e4 /embed
parentedd4b54aea706e6e2c4b6b35edb37012230c5cea (diff)
downloadgsoc2013-epiphany-d1df267f3880d560d778edb115a63acce689737f.tar
gsoc2013-epiphany-d1df267f3880d560d778edb115a63acce689737f.tar.gz
gsoc2013-epiphany-d1df267f3880d560d778edb115a63acce689737f.tar.bz2
gsoc2013-epiphany-d1df267f3880d560d778edb115a63acce689737f.tar.lz
gsoc2013-epiphany-d1df267f3880d560d778edb115a63acce689737f.tar.xz
gsoc2013-epiphany-d1df267f3880d560d778edb115a63acce689737f.tar.zst
gsoc2013-epiphany-d1df267f3880d560d778edb115a63acce689737f.zip
List all mozilla fonts and not only the language specific, otherwise we
2003-07-14 Marco Pesenti Gritti <marco@it.gnome.org> * embed/mozilla/mozilla-embed-single.cpp: List all mozilla fonts and not only the language specific, otherwise we get empty list. Use fontconfig aliases as defaults. This is temporary until we design simpler fonts configuration.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp54
1 files changed, 17 insertions, 37 deletions
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index 6d03e08d4..ca2e4fd3f 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -45,7 +45,7 @@
#include <nsIIOService.h>
#include <nsIProtocolProxyService.h>
#include <nsIAtom.h>
-#include <nsIFontList.h>
+#include <nsIFontEnumerator.h>
#include <nsISupportsPrimitives.h>
#include <nsReadableUtils.h>
#include <nsICookieManager.h>
@@ -795,54 +795,34 @@ impl_get_font_list (EphyEmbedSingle *shell,
char **default_font)
{
nsresult rv;
+ PRUint32 fontCount;
+ PRUnichar **fontArray;
+ GList *l = NULL;
- nsCOMPtr<nsIFontList> mozFontList;
- mozFontList = do_CreateInstance("@mozilla.org/gfx/fontlist;1", &rv);
+ nsCOMPtr<nsIFontEnumerator> mozFontEnumerator;
+ mozFontEnumerator = do_CreateInstance("@mozilla.org/gfx/fontenumerator;1", &rv);
if(NS_FAILED(rv)) return G_FAILED;
- nsCOMPtr<nsISimpleEnumerator> fontEnum;
- mozFontList->AvailableFonts(NS_ConvertUTF8toUCS2(langGroup).get(),
- NS_ConvertUTF8toUCS2(fontType).get(),
- getter_AddRefs(fontEnum));
- if(NS_FAILED(rv)) return G_FAILED;
+ rv = mozFontEnumerator->EnumerateFonts (nsnull, nsnull,
+ &fontCount, &fontArray);
+ if (NS_FAILED (rv)) return G_FAILED;
- GList *l = NULL;
- PRBool enumResult;
- for(fontEnum->HasMoreElements(&enumResult) ;
- enumResult == PR_TRUE;
- fontEnum->HasMoreElements(&enumResult))
+ for (int i = 0; i < fontCount; i++)
{
- nsCOMPtr<nsISupportsString> fontName;
- fontEnum->GetNext(getter_AddRefs(fontName));
- if(NS_FAILED(rv)) return G_FAILED;
-
- nsString fontString;
- fontName->GetData(fontString);
-
char *gFontString;
- gFontString = g_strdup(NS_ConvertUCS2toUTF8(fontString).get());
+
+ gFontString = g_strdup(NS_ConvertUCS2toUTF8 (fontArray[i]).get());
l = g_list_prepend (l, gFontString);
+ nsMemory::Free (fontArray[i]);
}
+
+ nsMemory::Free (fontArray);
+
*fontList = g_list_reverse (l);
if (default_font != NULL)
{
- char key[255];
- char *value = NULL;
- nsCOMPtr<nsIPrefService> prefService;
-
- prefService = do_GetService (NS_PREFSERVICE_CONTRACTID);
- g_return_val_if_fail (prefService != NULL, G_FAILED);
-
- nsCOMPtr<nsIPrefBranch> pref;
- prefService->GetBranch ("", getter_AddRefs(pref));
- g_return_val_if_fail (pref != NULL, G_FAILED);
-
- sprintf (key, "font.name.%s.%s", fontType, langGroup);
-
- pref->GetCharPref (key, &value);
- *default_font = g_strdup (value);
- nsMemory::Free (value);
+ *default_font = g_strdup (fontType);
}
return G_OK;