[pango] Allow font_family=NULL in load_font() and load_fontset() methods
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Subject: [pango] Allow font_family=NULL in load_font() and load_fontset() methods
- Date: Tue, 7 Apr 2009 14:34:32 -0400 (EDT)
commit caabe183c7747d7486695071ab592e677bbdce25
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Apr 6 19:45:04 2009 -0400
Allow font_family=NULL in load_font() and load_fontset() methods
---
pango/pango-context.c | 5 +----
pango/pango-fontmap.c | 6 +++---
pango/pangoatsui-fontmap.c | 5 ++++-
pango/pangowin32-fontmap.c | 8 +++++---
pango/pangox-fontmap.c | 4 +++-
5 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 6c40a29..0b70f59 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 a2b1452..13f4263 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 0844e6e..f433440 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 833219a..360ec03 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 9303334..6d5e547 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]