Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug 1400 - Lack of error reporting for glyph rendering errors
  I was just bitten by bug 374062 (any word if this will be fixed for
  etch given that it is fixed upstream?), and found that there is no
  error message set by sdl-ttf when it is unable to render a glyph,
  which makes bugs like this a bit more difficult to track down.  I
  would really appreciate it if TTF_GetError() could return a useful
  message in such situations.  The attached patch does just that by
  duplicating the existing error reporting for calls to Find_Glyph()
  into the places where it is missing, although it might be nice to know
  which glyph it was that could not be found...
  • Loading branch information
slouken committed Jan 28, 2012
1 parent 030a2c9 commit 467f85d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SDL_ttf.c
Expand Up @@ -1155,6 +1155,7 @@ int TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h)

error = Find_Glyph(font, c, CACHED_METRICS);
if ( error ) {
TTF_SetFTError("Couldn't find glyph", error);
return -1;
}
glyph = font->current;
Expand Down Expand Up @@ -1364,6 +1365,7 @@ SDL_Surface *TTF_RenderUNICODE_Solid(TTF_Font *font,

error = Find_Glyph(font, c, CACHED_METRICS|CACHED_BITMAP);
if( error ) {
TTF_SetFTError("Couldn't find glyph", error);
SDL_FreeSurface( textbuf );
return NULL;
}
Expand Down Expand Up @@ -1438,6 +1440,7 @@ SDL_Surface *TTF_RenderGlyph_Solid(TTF_Font *font, Uint16 ch, SDL_Color fg)
/* Get the glyph itself */
error = Find_Glyph(font, ch, CACHED_METRICS|CACHED_BITMAP);
if ( error ) {
TTF_SetFTError("Couldn't find glyph", error);
return(NULL);
}
glyph = font->current;
Expand Down Expand Up @@ -1630,6 +1633,7 @@ SDL_Surface* TTF_RenderUNICODE_Shaded( TTF_Font* font,

error = Find_Glyph(font, c, CACHED_METRICS|CACHED_PIXMAP);
if( error ) {
TTF_SetFTError("Couldn't find glyph", error);
SDL_FreeSurface( textbuf );
return NULL;
}
Expand Down Expand Up @@ -1711,6 +1715,7 @@ SDL_Surface* TTF_RenderGlyph_Shaded( TTF_Font* font,
/* Get the glyph itself */
error = Find_Glyph(font, ch, CACHED_METRICS|CACHED_PIXMAP);
if( error ) {
TTF_SetFTError("Couldn't find glyph", error);
return NULL;
}
glyph = font->current;
Expand Down Expand Up @@ -1887,6 +1892,7 @@ SDL_Surface *TTF_RenderUNICODE_Blended(TTF_Font *font,
}
error = Find_Glyph(font, c, CACHED_METRICS|CACHED_PIXMAP);
if( error ) {
TTF_SetFTError("Couldn't find glyph", error);
SDL_FreeSurface( textbuf );
return NULL;
}
Expand Down Expand Up @@ -1967,6 +1973,7 @@ SDL_Surface *TTF_RenderGlyph_Blended(TTF_Font *font, Uint16 ch, SDL_Color fg)
/* Get the glyph itself */
error = Find_Glyph(font, ch, CACHED_METRICS|CACHED_PIXMAP);
if ( error ) {
TTF_SetFTError("Couldn't find glyph", error);
return(NULL);
}
glyph = font->current;
Expand Down

0 comments on commit 467f85d

Please sign in to comment.