| 1 |
Description: Better error reporting |
| 2 |
Introduced in 2.0.11-2 (Sat, 03 Mar 2012). |
| 3 |
. |
| 4 |
Applied Upstream: http://hg.libsdl.org/SDL_ttf/rev/b09799bf8dff |
| 5 |
Author: Kevin Locke <[email protected]> |
| 6 |
Last-Update: 2012-03-03 |
| 7 |
Bug-Debian: http://bugs.debian.org/405378 |
| 8 |
Forwarded: http://bugzilla.libsdl.org/show_bug.cgi?id=1400 |
| 9 |
|
| 10 |
# HG changeset patch |
| 11 |
# User Sam Lantinga <[email protected]> |
| 12 |
# Date 1327764534 18000 |
| 13 |
# Node ID b09799bf8dff36eca61ecc5272cfdcce39b6b186 |
| 14 |
# Parent 077db903bfdf89f6cb9a32e8be1f3e5c95d429b4 |
| 15 |
Fixed bug 1400 - Lack of error reporting for glyph rendering errors |
| 16 |
|
| 17 |
I was just bitten by bug 374062 (any word if this will be fixed for |
| 18 |
etch given that it is fixed upstream?), and found that there is no |
| 19 |
error message set by sdl-ttf when it is unable to render a glyph, |
| 20 |
which makes bugs like this a bit more difficult to track down. I |
| 21 |
would really appreciate it if TTF_GetError() could return a useful |
| 22 |
message in such situations. The attached patch does just that by |
| 23 |
duplicating the existing error reporting for calls to Find_Glyph() |
| 24 |
into the places where it is missing, although it might be nice to know |
| 25 |
which glyph it was that could not be found... |
| 26 |
|
| 27 |
--- a/SDL_ttf.c |
| 28 |
+++ b/SDL_ttf.c |
| 29 |
@@ -1155,6 +1155,7 @@ |
| 30 |
|
| 31 |
error = Find_Glyph(font, c, CACHED_METRICS); |
| 32 |
if ( error ) { |
| 33 |
+ TTF_SetFTError("Couldn't find glyph", error); |
| 34 |
return -1; |
| 35 |
} |
| 36 |
glyph = font->current; |
| 37 |
@@ -1364,6 +1365,7 @@ |
| 38 |
|
| 39 |
error = Find_Glyph(font, c, CACHED_METRICS|CACHED_BITMAP); |
| 40 |
if( error ) { |
| 41 |
+ TTF_SetFTError("Couldn't find glyph", error); |
| 42 |
SDL_FreeSurface( textbuf ); |
| 43 |
return NULL; |
| 44 |
} |
| 45 |
@@ -1438,6 +1440,7 @@ |
| 46 |
/* Get the glyph itself */ |
| 47 |
error = Find_Glyph(font, ch, CACHED_METRICS|CACHED_BITMAP); |
| 48 |
if ( error ) { |
| 49 |
+ TTF_SetFTError("Couldn't find glyph", error); |
| 50 |
return(NULL); |
| 51 |
} |
| 52 |
glyph = font->current; |
| 53 |
@@ -1630,6 +1633,7 @@ |
| 54 |
|
| 55 |
error = Find_Glyph(font, c, CACHED_METRICS|CACHED_PIXMAP); |
| 56 |
if( error ) { |
| 57 |
+ TTF_SetFTError("Couldn't find glyph", error); |
| 58 |
SDL_FreeSurface( textbuf ); |
| 59 |
return NULL; |
| 60 |
} |
| 61 |
@@ -1711,6 +1715,7 @@ |
| 62 |
/* Get the glyph itself */ |
| 63 |
error = Find_Glyph(font, ch, CACHED_METRICS|CACHED_PIXMAP); |
| 64 |
if( error ) { |
| 65 |
+ TTF_SetFTError("Couldn't find glyph", error); |
| 66 |
return NULL; |
| 67 |
} |
| 68 |
glyph = font->current; |
| 69 |
@@ -1887,6 +1892,7 @@ |
| 70 |
} |
| 71 |
error = Find_Glyph(font, c, CACHED_METRICS|CACHED_PIXMAP); |
| 72 |
if( error ) { |
| 73 |
+ TTF_SetFTError("Couldn't find glyph", error); |
| 74 |
SDL_FreeSurface( textbuf ); |
| 75 |
return NULL; |
| 76 |
} |
| 77 |
@@ -1967,6 +1973,7 @@ |
| 78 |
/* Get the glyph itself */ |
| 79 |
error = Find_Glyph(font, ch, CACHED_METRICS|CACHED_PIXMAP); |
| 80 |
if ( error ) { |
| 81 |
+ TTF_SetFTError("Couldn't find glyph", error); |
| 82 |
return(NULL); |
| 83 |
} |
| 84 |
glyph = font->current; |