summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-04-06 19:45:04 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-04-06 19:45:04 -0400
commitcaabe183c7747d7486695071ab592e677bbdce25 (patch)
tree5ed1c7a510b18a3286a458bd8dd6a6a20b71bf6d /pango
parent1e990af007255d1137ec76bd86658198d73994c6 (diff)
downloadpango-caabe183c7747d7486695071ab592e677bbdce25.tar.gz
Allow font_family=NULL in load_font() and load_fontset() methods
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-context.c5
-rw-r--r--pango/pango-fontmap.c6
-rw-r--r--pango/pangoatsui-fontmap.c5
-rw-r--r--pango/pangowin32-fontmap.c8
-rw-r--r--pango/pangox-fontmap.c4
5 files changed, 16 insertions, 12 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 6c40a295..0b70f596 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -287,7 +287,6 @@ pango_context_load_font (PangoContext *context,
const PangoFontDescription *desc)
{
g_return_val_if_fail (context != NULL, NULL);
- g_return_val_if_fail (pango_font_description_get_family (desc) != NULL, NULL);
return pango_font_map_load_font (context->font_map, context, desc);
}
@@ -306,11 +305,9 @@ pango_context_load_font (PangoContext *context,
PangoFontset *
pango_context_load_fontset (PangoContext *context,
const PangoFontDescription *desc,
- PangoLanguage *language)
+ PangoLanguage *language)
{
g_return_val_if_fail (context != NULL, NULL);
- g_return_val_if_fail (pango_font_description_get_family (desc) != NULL, NULL);
- g_return_val_if_fail (pango_font_description_get_size (desc) != 0, NULL);
return pango_font_map_load_fontset (context->font_map, context, desc, language);
}
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c
index a2b1452d..13f4263c 100644
--- a/pango/pango-fontmap.c
+++ b/pango/pango-fontmap.c
@@ -90,7 +90,6 @@ pango_font_map_load_font (PangoFontMap *fontmap,
const PangoFontDescription *desc)
{
g_return_val_if_fail (fontmap != NULL, NULL);
- g_return_val_if_fail (pango_font_description_get_family (desc) != NULL, NULL);
return PANGO_FONT_MAP_GET_CLASS (fontmap)->load_font (fontmap, context, desc);
}
@@ -133,7 +132,6 @@ pango_font_map_load_fontset (PangoFontMap *fontmap,
PangoLanguage *language)
{
g_return_val_if_fail (fontmap != NULL, NULL);
- g_return_val_if_fail (pango_font_description_get_family (desc) != NULL, NULL);
return PANGO_FONT_MAP_GET_CLASS (fontmap)->load_fontset (fontmap, context, desc, language);
}
@@ -180,12 +178,14 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap,
PangoLanguage *language)
{
PangoFontDescription *tmp_desc = pango_font_description_copy_static (desc);
+ const char *family;
char **families;
int i;
PangoFontsetSimple *fonts;
static GHashTable *warned_fonts = NULL;
- families = g_strsplit (pango_font_description_get_family (desc), ",", -1);
+ family = pango_font_description_get_family (desc);
+ families = g_strsplit (family ? family : "", ",", -1);
fonts = pango_fontset_simple_new (language);
diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c
index 0844e6ec..f433440d 100644
--- a/pango/pangoatsui-fontmap.c
+++ b/pango/pangoatsui-fontmap.c
@@ -669,6 +669,7 @@ pango_atsui_font_map_load_font (PangoFontMap *fontmap,
{
PangoATSUIFontMap *atsuifontmap = (PangoATSUIFontMap *)fontmap;
PangoATSUIFamily *font_family;
+ const gchar *family;
gchar *name;
gint size;
@@ -676,7 +677,9 @@ pango_atsui_font_map_load_font (PangoFontMap *fontmap,
if (size < 0)
return NULL;
- name = g_utf8_casefold (pango_font_description_get_family (description), -1);
+ family = pango_font_description_get_family (description);
+ family = family ? family : "";
+ name = g_utf8_casefold (family, -1);
font_family = g_hash_table_lookup (atsuifontmap->families, name);
g_free (name);
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 833219a9..360ec03f 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -618,13 +618,15 @@ pango_win32_font_map_load_font (PangoFontMap *fontmap,
PangoWin32Family *win32family;
PangoFont *result = NULL;
GSList *tmp_list;
+ const char *family;
g_return_val_if_fail (description != NULL, NULL);
- PING (("name=%s", pango_font_description_get_family (description)));
+ family = pango_font_description_get_family (description);
+ family = family ? family : "";
+ PING (("name=%s", family))
- win32family = g_hash_table_lookup (win32fontmap->families,
- pango_font_description_get_family (description));
+ win32family = g_hash_table_lookup (win32fontmap->families, family);
if (win32family)
{
PangoWin32Face *best_match = NULL;
diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c
index 9303334b..6d5e547e 100644
--- a/pango/pangox-fontmap.c
+++ b/pango/pangox-fontmap.c
@@ -466,12 +466,14 @@ pango_x_font_map_load_font (PangoFontMap *fontmap,
PangoXFamily *font_family;
PangoFont *result = NULL;
GSList *tmp_list;
+ const gchar *family;
gchar *name;
gint size;
g_return_val_if_fail (description != NULL, NULL);
- name = g_ascii_strdown (pango_font_description_get_family (description), -1);
+ family = pango_font_description_get_family (description);
+ name = g_ascii_strdown (family ? family : "", -1);
size = pango_font_description_get_size (description);
if (size < 0)