diff options
author | Noah Levitt <nlevitt@columbia.edu> | 2004-02-23 21:38:35 +0000 |
---|---|---|
committer | Noah Levitt <nlevitt@src.gnome.org> | 2004-02-23 21:38:35 +0000 |
commit | d234d2a87811f893069d383f45b6365030aa2188 (patch) | |
tree | 1ac57f63d51bb4388f6fbc650cab69c537021d1f | |
parent | 87eb95a56174cf5ed182f480f5ec1f7196f11da2 (diff) | |
download | pango-d234d2a87811f893069d383f45b6365030aa2188.tar.gz |
Handle NULL for sizes and n_sizes.
2003-02-23 Noah Levitt <nlevitt@columbia.edu>
* pango/fonts.c (pango_font_face_list_sizes):
* pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle
NULL for sizes and n_sizes.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 6 | ||||
-rw-r--r-- | pango/fonts.c | 12 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 26 |
7 files changed, 56 insertions, 12 deletions
@@ -1,3 +1,9 @@ +2003-02-23 Noah Levitt <nlevitt@columbia.edu> + + * pango/fonts.c (pango_font_face_list_sizes): + * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle + NULL for sizes and n_sizes. + 2003-02-22 Noah Levitt <nlevitt@columbia.edu> * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 0b1a9a12..5b105e00 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,9 @@ +2003-02-23 Noah Levitt <nlevitt@columbia.edu> + + * pango/fonts.c (pango_font_face_list_sizes): + * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle + NULL for sizes and n_sizes. + 2003-02-22 Noah Levitt <nlevitt@columbia.edu> * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 0b1a9a12..5b105e00 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,9 @@ +2003-02-23 Noah Levitt <nlevitt@columbia.edu> + + * pango/fonts.c (pango_font_face_list_sizes): + * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle + NULL for sizes and n_sizes. + 2003-02-22 Noah Levitt <nlevitt@columbia.edu> * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 0b1a9a12..5b105e00 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,9 @@ +2003-02-23 Noah Levitt <nlevitt@columbia.edu> + + * pango/fonts.c (pango_font_face_list_sizes): + * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle + NULL for sizes and n_sizes. + 2003-02-22 Noah Levitt <nlevitt@columbia.edu> * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 0b1a9a12..5b105e00 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,9 @@ +2003-02-23 Noah Levitt <nlevitt@columbia.edu> + + * pango/fonts.c (pango_font_face_list_sizes): + * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle + NULL for sizes and n_sizes. + 2003-02-22 Noah Levitt <nlevitt@columbia.edu> * pango/pangofc-fontmap.c (pango_fc_face_list_sizes): Handle diff --git a/pango/fonts.c b/pango/fonts.c index ea5dc406..b6515fca 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -1448,11 +1448,15 @@ pango_font_face_get_face_name (PangoFontFace *face) * Since: 1.4 **/ void -pango_font_face_list_sizes (PangoFontFace *face, - int **sizes, - int *n_sizes) +pango_font_face_list_sizes (PangoFontFace *face, + int **sizes, + int *n_sizes) { - g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL); + g_return_if_fail (PANGO_IS_FONT_FACE (face)); + g_return_if_fail (sizes == NULL || n_sizes != NULL); + + if (n_sizes == NULL) + return; if (PANGO_FONT_FACE_GET_CLASS (face)->list_sizes != NULL) PANGO_FONT_FACE_GET_CLASS (face)->list_sizes (face, sizes, n_sizes); diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index a1b44285..47abfaff 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -1173,7 +1173,7 @@ pango_fc_face_list_sizes (PangoFontFace *face, { GArray *size_array; double size, dpi = -1.0; - int i; + int i, size_i; size_array = g_array_new (FALSE, FALSE, sizeof (int)); @@ -1186,12 +1186,15 @@ pango_fc_face_list_sizes (PangoFontFace *face, FcPattern *tmp = FcPatternDuplicate (fontset->fonts[i]); pango_fc_default_substitute (fcface->family->fontmap, tmp); if (FcPatternGetDouble (tmp, FC_DPI, 0, &dpi) != FcResultMatch) - dpi = 72.0; + { + g_warning ("Error getting DPI from fontconfig, using 72.0"); + dpi = 72.0; + } FcPatternDestroy (tmp); } - int sizi = (int) (PANGO_SCALE * size * 72.0 / dpi); - g_array_append_val (size_array, sizi); + size_i = (int) (PANGO_SCALE * size * 72.0 / dpi); + g_array_append_val (size_array, size_i); } } @@ -1199,23 +1202,30 @@ pango_fc_face_list_sizes (PangoFontFace *face, if (size_array->len == 0) { - *sizes = NULL; *n_sizes = 0; + if (sizes) + *sizes = NULL; g_array_free (size_array, TRUE); } else { *n_sizes = size_array->len; - *sizes = (int *) size_array->data; - g_array_free (size_array, FALSE); + if (sizes) + { + *sizes = (int *) size_array->data; + g_array_free (size_array, FALSE); + } + else + g_array_free (size_array, TRUE); } FcFontSetDestroy (fontset); } else { - *sizes = NULL; *n_sizes = 0; + if (sizes) + *sizes = NULL; } FcPatternDestroy (pattern); |