[sfnt] Improve embedded bitmap tracing. * src/base/ftobjs.c (FT_Request_Size): Move trace message regarding bitmap strike match to... (FT_Match_Size): This function. * src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics, tt_sbit_decoder_load_byte_aligned, tt_sbit_decoder_load_bit_aligned, tt_sbit_decoder_load_compound, tt_sbit_decoder_load_png, tt_sbit_decoder_load_image): Decorate with tracing messages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
diff --git a/ChangeLog b/ChangeLog
index 653ca42..d9edc2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2013-06-10 Werner Lemberg <wl@gnu.org>
+ [sfnt] Improve embedded bitmap tracing.
+
+ * src/base/ftobjs.c (FT_Request_Size): Move trace message regarding
+ bitmap strike match to...
+ (FT_Match_Size): This function.
+
+ * src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics,
+ tt_sbit_decoder_load_byte_aligned, tt_sbit_decoder_load_bit_aligned,
+ tt_sbit_decoder_load_compound, tt_sbit_decoder_load_png,
+ tt_sbit_decoder_load_image): Decorate with tracing messages.
+
+2013-06-10 Werner Lemberg <wl@gnu.org>
+
Fix Savannah bug #39160.
* src/truetype/ttinterp.c (Ins_SDPVTL): Set projection vector too
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 401fd64..ac2a39c 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2541,6 +2541,8 @@
if ( w == FT_PIX_ROUND( bsize->x_ppem ) || ignore_width )
{
+ FT_TRACE3(( "FT_Match_Size: bitmap strike %d matches\n", i ));
+
if ( size_index )
*size_index = (FT_ULong)i;
@@ -2897,9 +2899,6 @@
if ( error )
return error;
- FT_TRACE3(( "FT_Request_Size: bitmap strike %lu matched\n",
- strike_index ));
-
return FT_Select_Size( face, (FT_Int)strike_index );
}
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 1c7d76b..cd3e5a4 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -374,6 +374,7 @@
return FT_Err_Ok;
Fail:
+ FT_TRACE1(( "tt_sbit_decoder_load_metrics: broken table" ));
return FT_THROW( Invalid_Argument );
}
@@ -425,12 +426,15 @@
if ( x_pos < 0 || x_pos + width > bit_width ||
y_pos < 0 || y_pos + height > bit_height )
{
+ FT_TRACE1(( "tt_sbit_decoder_load_byte_aligned:"
+ " invalid bitmap dimensions\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
if ( p + ( ( line_bits + 7 ) >> 3 ) * height > limit )
{
+ FT_TRACE1(( "tt_sbit_decoder_load_byte_aligned: broken bitmap\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -491,6 +495,8 @@
}
Exit:
+ if ( !error )
+ FT_TRACE3(( "tt_sbit_decoder_load_byte_aligned: loaded\n" ));
return error;
}
@@ -562,12 +568,15 @@
if ( x_pos < 0 || x_pos + width > bit_width ||
y_pos < 0 || y_pos + height > bit_height )
{
+ FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned:"
+ " invalid bitmap dimensions\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
if ( p + ( ( line_bits * height + 7 ) >> 3 ) > limit )
{
+ FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned: broken bitmap\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -647,6 +656,8 @@
}
Exit:
+ if ( !error )
+ FT_TRACE3(( "tt_sbit_decoder_load_bit_aligned: loaded\n" ));
return error;
}
@@ -675,7 +686,13 @@
num_components = FT_NEXT_USHORT( p );
if ( p + 4 * num_components > limit )
+ {
+ FT_TRACE1(( "tt_sbit_decoder_load_compound: broken table\n" ));
goto Fail;
+ }
+
+ FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n",
+ num_components ));
for ( nn = 0; nn < num_components; nn++ )
{
@@ -691,6 +708,8 @@
break;
}
+ FT_TRACE3(( "tt_sbit_decoder_load_compound: done\n" ));
+
decoder->metrics->horiBearingX = horiBearingX;
decoder->metrics->horiBearingY = horiBearingY;
decoder->metrics->horiAdvance = horiAdvance;
@@ -727,6 +746,7 @@
if ( limit - p < 4 )
{
+ FT_TRACE1(( "tt_sbit_decoder_load_png: broken bitmap\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -734,6 +754,7 @@
png_len = FT_NEXT_ULONG( p );
if ( (FT_ULong)( limit - p ) < png_len )
{
+ FT_TRACE1(( "tt_sbit_decoder_load_png: broken bitmap\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -748,6 +769,8 @@
png_len );
Exit:
+ if ( !error )
+ FT_TRACE3(( "tt_sbit_decoder_load_png: loaded\n" ));
return error;
}
@@ -1096,6 +1119,10 @@
image_end -= image_start;
image_start = image_offset + image_start;
+ FT_TRACE3(( "tt_sbit_decoder_load_image:"
+ " found sbit (format %d) for glyph index %d\n",
+ image_format, glyph_index ));
+
return tt_sbit_decoder_load_bitmap( decoder,
load_flags,
image_format,
@@ -1108,6 +1135,9 @@
return FT_THROW( Invalid_Table );
NoBitmap:
+ FT_TRACE4(( "tt_sbit_decoder_load_image:"
+ " no sbit found for glyph index %d\n", glyph_index ));
+
return FT_THROW( Invalid_Argument );
}