summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-06 18:09:40 -0700
committerMatthias Clasen <mclasen@redhat.com>2019-08-06 18:09:40 -0700
commit17250eefea571ea2d4ec22accd80fe944a52253d (patch)
treec76497d6a4ab0854795de57d5769b63bdc4f2bd4 /pango
parent06b923da6ee5973b7a5828b47e9a2ec8658b9265 (diff)
downloadpango-17250eefea571ea2d4ec22accd80fe944a52253d.tar.gz
Revert no-longer-needed changes
We are now producing an FcFontSet that has only font patterns with supported formats, so we no longer need to skip NULL fonts.
Diffstat (limited to 'pango')
-rw-r--r--pango/pangofc-fontmap.c60
1 files changed, 14 insertions, 46 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 68ab5e45..2bda526e 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -942,24 +942,18 @@ pango_fc_fontset_get_key (PangoFcFontset *fontset)
}
static PangoFont *
-pango_fc_fontset_load_next_font (PangoFcFontset *fontset,
- gboolean *has_more)
+pango_fc_fontset_load_next_font (PangoFcFontset *fontset)
{
FcPattern *pattern, *font_pattern;
PangoFont *font;
gboolean prepare;
- FcResult res;
- const char *s;
pattern = pango_fc_patterns_get_pattern (fontset->patterns);
font_pattern = pango_fc_patterns_get_font_pattern (fontset->patterns,
fontset->patterns_i++,
&prepare);
if (G_UNLIKELY (!font_pattern))
- {
- *has_more = FALSE;
- return NULL;
- }
+ return NULL;
if (prepare)
{
@@ -969,34 +963,26 @@ pango_fc_fontset_load_next_font (PangoFcFontset *fontset,
return NULL;
}
- res = FcPatternGetString (font_pattern, FC_FONTFORMAT, 0, (FcChar8 **)(void*)&s);
- g_assert (res == FcResultMatch);
- if (!pango_fc_is_supported_font_format (s))
- font = NULL;
- else
- font = pango_fc_font_map_new_font (fontset->key->fontmap,
- fontset->key,
- font_pattern);
+ font = pango_fc_font_map_new_font (fontset->key->fontmap,
+ fontset->key,
+ font_pattern);
if (prepare)
FcPatternDestroy (font_pattern);
- *has_more = TRUE;
-
return font;
}
static PangoFont *
pango_fc_fontset_get_font_at (PangoFcFontset *fontset,
- unsigned int i,
- gboolean *has_more)
+ unsigned int i)
{
while (i >= fontset->fonts->len)
{
- PangoFont *font = pango_fc_fontset_load_next_font (fontset, has_more);
+ PangoFont *font = pango_fc_fontset_load_next_font (fontset);
g_ptr_array_add (fontset->fonts, font);
g_ptr_array_add (fontset->coverages, NULL);
- if (!*has_more)
+ if (!font)
return NULL;
}
@@ -1073,20 +1059,11 @@ pango_fc_fontset_get_font (PangoFontset *fontset,
PangoCoverage *coverage;
int result = -1;
unsigned int i;
- gboolean has_more;
- for (i = 0; TRUE; i++)
+ for (i = 0;
+ pango_fc_fontset_get_font_at (fcfontset, i);
+ i++)
{
- font = pango_fc_fontset_get_font_at (fcfontset, i, &has_more);
-
- if (font == NULL)
- {
- if (has_more)
- continue;
- else
- break;
- }
-
coverage = g_ptr_array_index (fcfontset->coverages, i);
if (coverage == NULL)
@@ -1122,21 +1099,12 @@ pango_fc_fontset_foreach (PangoFontset *fontset,
{
PangoFcFontset *fcfontset = PANGO_FC_FONTSET (fontset);
PangoFont *font;
- gboolean has_more;
unsigned int i;
- for (i = 0; TRUE; i++)
+ for (i = 0;
+ (font = pango_fc_fontset_get_font_at (fcfontset, i));
+ i++)
{
- font = pango_fc_fontset_get_font_at (fcfontset, i, &has_more);
-
- if (font == NULL)
- {
- if (has_more)
- continue;
- else
- break;
- }
-
if ((*func) (fontset, font, data))
return;
}