Noisy font-loading msgs can be disabled by commenting out "#define DEBUG_FONTS"

This commit is contained in:
William Kendrick 2005-01-10 00:07:45 +00:00
parent 30ed4b70c6
commit bf825a8330

View file

@ -38,6 +38,7 @@
/* #define DEBUG */ /* #define DEBUG */
/* #define DEBUG_MALLOC */ /* #define DEBUG_MALLOC */
#define DEBUG_FONTS
/* #define LOW_QUALITY_THUMBNAILS */ /* #define LOW_QUALITY_THUMBNAILS */
/* #define LOW_QUALITY_COLOR_SELECTOR */ /* #define LOW_QUALITY_COLOR_SELECTOR */
/* #define LOW_QUALITY_STAMP_OUTLINE */ /* #define LOW_QUALITY_STAMP_OUTLINE */
@ -1705,7 +1706,9 @@ static void parse_font_style(style_info *si)
if(!stumped) if(!stumped)
{ {
stumped=1; stumped=1;
#ifdef DEBUG_FONTS
printf("Font style parser stumped by \"%s\".\n", si->style); printf("Font style parser stumped by \"%s\".\n", si->style);
#endif
} }
sp++; // bad: an unknown character sp++; // bad: an unknown character
} }
@ -1729,6 +1732,7 @@ static void groupfonts_range(style_info **base, int count)
int boldmap[4] = {-1,-1,-1,-1}; int boldmap[4] = {-1,-1,-1,-1};
int i; int i;
#ifdef DEBUG_FONTS
if(count<1 || count>4) if(count<1 || count>4)
{ {
printf("\n::::::: %d styles in %s:\n",count, base[0]->family); printf("\n::::::: %d styles in %s:\n",count, base[0]->family);
@ -1738,6 +1742,7 @@ while(i--)
printf(" %s\n", base[i]->style); printf(" %s\n", base[i]->style);
} }
} }
#endif
i = count; i = count;
while(i--) while(i--)
@ -1840,16 +1845,20 @@ printf(" %s\n", base[i]->style);
int b = boldmap[base[i]->boldness]; int b = boldmap[base[i]->boldness];
if(b==-1) if(b==-1)
{ {
#ifdef DEBUG_FONTS
printf("too many boldness levels, discarding: %s, %s\n", base[i]->family, base[i]->style); printf("too many boldness levels, discarding: %s, %s\n", base[i]->family, base[i]->style);
#endif
continue; continue;
} }
int spot = b ? TTF_STYLE_BOLD : 0; int spot = b ? TTF_STYLE_BOLD : 0;
spot += base[i]->italic ? TTF_STYLE_ITALIC : 0; spot += base[i]->italic ? TTF_STYLE_ITALIC : 0;
if(fi->filename[spot]) if(fi->filename[spot])
{ {
#ifdef DEBUG_FONTS
printf("duplicates, discarding: %s, %s\n", base[i]->family, base[i]->style); printf("duplicates, discarding: %s, %s\n", base[i]->family, base[i]->style);
printf("b %d, spot %d\n", b, spot); printf("b %d, spot %d\n", b, spot);
printf("occupancy %p %p %p %p\n", fi->filename[0], fi->filename[1], fi->filename[2], fi->filename[3]); printf("occupancy %p %p %p %p\n", fi->filename[0], fi->filename[1], fi->filename[2], fi->filename[3]);
#endif
continue; continue;
} }
fi->filename[spot] = strdup(base[i]->filename); fi->filename[spot] = strdup(base[i]->filename);
@ -1952,9 +1961,13 @@ static void groupfonts(void)
low = high; low = high;
} }
qsort(user_font_families, num_font_families, sizeof user_font_families[0], compar_fontscore); qsort(user_font_families, num_font_families, sizeof user_font_families[0], compar_fontscore);
#ifdef DEBUG_FONTS
if(user_font_families[0]->score < 0) if(user_font_families[0]->score < 0)
printf("sorted the wrong way, or all fonts were crap\n"); printf("sorted the wrong way, or all fonts were crap\n");
printf("Trim starting with %d families\n", num_font_families); printf("Trim starting with %d families\n", num_font_families);
#endif
while(num_font_families>1 && user_font_families[num_font_families-1]->score < 0) while(num_font_families>1 && user_font_families[num_font_families-1]->score < 0)
{ {
i = --num_font_families; i = --num_font_families;
@ -1972,7 +1985,10 @@ static void groupfonts(void)
free(user_font_families[i]); free(user_font_families[i]);
user_font_families[i] = NULL; user_font_families[i] = NULL;
} }
#ifdef DEBUG_FONTS
printf("Trim ending with %d families\n", num_font_families); printf("Trim ending with %d families\n", num_font_families);
#endif
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -14447,12 +14463,16 @@ static void loadfonts(const char * const dir, int fatal)
} }
else else
{ {
#ifdef DEBUG_FONTS
printf("Bad font, 'a' and 'z' match: %s, %s, %s\n", filename, family, style); printf("Bad font, 'a' and 'z' match: %s, %s, %s\n", filename, family, style);
#endif
} }
} }
else else
{ {
#ifdef DEBUG_FONTS
printf("could not render %s, %s, %s\n", filename, family, style); printf("could not render %s, %s, %s\n", filename, family, style);
#endif
} }
if(tmp_surf_a) if(tmp_surf_a)
SDL_FreeSurface(tmp_surf_a); SDL_FreeSurface(tmp_surf_a);
@ -14463,7 +14483,9 @@ static void loadfonts(const char * const dir, int fatal)
} }
else else
{ {
#ifdef DEBUG_FONTS
printf("could not open %s\n", filename); printf("could not open %s\n", filename);
#endif
} }
show_progress_bar(); show_progress_bar();
} }