* src/*: Don't use more than one '\n' in FT_TRACE and FT_ERROR.

This ensures good logging output, with all lines having a proper
prefix (if requested).

This is a continuation of a similar patch from 2020-12-02, which
missed some locations.
This commit is contained in:
Werner Lemberg 2021-02-04 07:44:06 +01:00
parent fd7f92b6f0
commit d924a66a5c
19 changed files with 107 additions and 78 deletions

View File

@ -1,3 +1,13 @@
2021-02-04 Werner Lemberg <wl@gnu.org>
* src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.
This ensures good logging output, with all lines having a proper
prefix (if requested).
This is a continuation of a similar patch from 2020-12-02, which
missed some locations.
2021-02-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/unix/configure.raw [mmap]: Restore default path.

10
src/cache/ftcbasic.c vendored
View File

@ -108,12 +108,16 @@
if ( error || !face )
return result;
#ifdef FT_DEBUG_LEVEL_TRACE
if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
{
FT_TRACE1(( "ftc_basic_family_get_count:"
" the number of glyphs in this face is %ld,\n"
" "
" which is too much and thus truncated\n",
" the number of glyphs in this face is %ld,\n",
face->num_glyphs ));
FT_TRACE1(( " "
" which is too much and thus truncated\n" ));
}
#endif
if ( !error )
result = (FT_UInt)face->num_glyphs;

View File

@ -345,8 +345,8 @@
else
{
FT_ERROR(( "cff_get_glyph_name:"
" cannot get glyph name from a CFF2 font\n"
" "
" cannot get glyph name from a CFF2 font\n" ));
FT_ERROR(( " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@ -356,8 +356,8 @@
if ( !font->psnames )
{
FT_ERROR(( "cff_get_glyph_name:"
" cannot get glyph name from CFF & CEF fonts\n"
" "
" cannot get glyph name from CFF & CEF fonts\n" ));
FT_ERROR(( " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@ -412,8 +412,8 @@
else
{
FT_ERROR(( "cff_get_name_index:"
" cannot get glyph index from a CFF2 font\n"
" "
" cannot get glyph index from a CFF2 font\n" ));
FT_ERROR(( " "
" without the `psnames' module\n" ));
return 0;
}

View File

@ -2361,8 +2361,8 @@
if ( font->name_index.count > 1 )
{
FT_ERROR(( "cff_font_load:"
" invalid CFF font with multiple subfonts\n"
" "
" invalid CFF font with multiple subfonts\n" ));
FT_ERROR(( " "
" in SFNT wrapper\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;

View File

@ -659,8 +659,8 @@
if ( dict->cid_registry == 0xFFFFU && !psnames )
{
FT_ERROR(( "cff_face_init:"
" cannot open CFF & CEF fonts\n"
" "
" cannot open CFF & CEF fonts\n" ));
FT_ERROR(( " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;

View File

@ -713,9 +713,10 @@
( max_scaling - min_scaling ) > 9 )
{
FT_TRACE1(( "cff_parse_font_matrix:"
" strange scaling values (minimum %ld, maximum %ld),\n"
" "
" using default matrix\n", min_scaling, max_scaling ));
" strange scaling values (minimum %ld, maximum %ld),\n",
min_scaling, max_scaling ));
FT_TRACE1(( " "
" using default matrix\n" ));
goto Unlikely;
}

View File

@ -843,8 +843,8 @@
if ( cid->fd_bytes > 4 || cid->gd_bytes > 4 )
{
FT_ERROR(( "cid_face_open:"
" Values of `FDBytes' or `GDBytes' larger than 4\n"
" "
" Values of `FDBytes' or `GDBytes' larger than 4\n" ));
FT_ERROR(( " "
" are not supported\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;

View File

@ -1087,8 +1087,8 @@ THE SOFTWARE.
if ( defaultCharEncodingOffset == 0xFFFF )
{
FT_TRACE0(( "pcf_get_encodings:"
" No glyph for default character,\n"
" "
" No glyph for default character,\n" ));
FT_TRACE0(( " "
" setting it to the first glyph of the font\n" ));
defaultCharEncodingOffset = 1;
}
@ -1099,8 +1099,8 @@ THE SOFTWARE.
if ( defaultCharEncodingOffset >= face->nmetrics )
{
FT_TRACE0(( "pcf_get_encodings:"
" Invalid glyph index for default character,\n"
" "
" Invalid glyph index for default character,\n" ));
FT_TRACE0(( " "
" setting it to the first glyph of the font\n" ));
defaultCharEncodingOffset = 1;
}
@ -1232,16 +1232,16 @@ THE SOFTWARE.
}
FT_TRACE5(( " noOverlap=%s, constantMetrics=%s,"
" terminalFont=%s, constantWidth=%s\n"
" inkInside=%s, inkMetrics=%s, drawDirection=%s\n"
" fontAscent=%ld, fontDescent=%ld, maxOverlap=%ld\n",
" terminalFont=%s, constantWidth=%s\n",
accel->noOverlap ? "yes" : "no",
accel->constantMetrics ? "yes" : "no",
accel->terminalFont ? "yes" : "no",
accel->constantWidth ? "yes" : "no",
accel->constantWidth ? "yes" : "no" ));
FT_TRACE5(( " inkInside=%s, inkMetrics=%s, drawDirection=%s\n",
accel->inkInside ? "yes" : "no",
accel->inkMetrics ? "yes" : "no",
accel->drawDirection ? "RTL" : "LTR",
accel->drawDirection ? "RTL" : "LTR" ));
FT_TRACE5(( " fontAscent=%ld, fontDescent=%ld, maxOverlap=%ld\n",
accel->fontAscent,
accel->fontDescent,
accel->maxOverlap ));

View File

@ -310,8 +310,8 @@
if ( lim > limit )
{
FT_TRACE0(( "pfr_lookup_bitmap_data:"
" number of bitmap records too large,\n"
" "
" number of bitmap records too large,\n" ));
FT_TRACE0(( " "
" thus ignoring all bitmaps in this strike\n" ));
*flags &= ~PFR_BITMAP_VALID_CHARCODES;
}
@ -328,8 +328,8 @@
if ( (FT_Long)code <= prev_code )
{
FT_TRACE0(( "pfr_lookup_bitmap_data:"
" bitmap records are not sorted,\n"
" "
" bitmap records are not sorted,\n" ));
FT_TRACE0(( " "
" thus ignoring all bitmaps in this strike\n" ));
*flags &= ~PFR_BITMAP_VALID_CHARCODES;
break;

View File

@ -1022,10 +1022,17 @@
}
}
FT_TRACE6(( "%s\n", initialMap ? "flags: [p]air [g]host [t]op"
" [b]ottom [L]ocked [S]ynthetic\n"
"Initial hintmap"
: "Hints:" ));
#ifdef FT_DEBUG_LEVEL_TRACE
if ( initialMap )
{
FT_TRACE6(( "flags: [p]air [g]host [t]op"
" [b]ottom [L]ocked [S]ynthetic\n" ));
FT_TRACE6(( "Initial hintmap" ));
}
else
FT_TRACE6(( "Hints:" ));
#endif
cf2_hintmap_dump( hintmap );
/*

View File

@ -595,10 +595,10 @@
if ( cur < limit && cur == parser->cursor )
{
FT_ERROR(( "ps_parser_skip_PS_token:"
" current token is `%c' which is self-delimiting\n"
" "
" but invalid at this point\n",
" current token is `%c' which is self-delimiting\n",
*cur ));
FT_ERROR(( " "
" but invalid at this point\n" ));
error = FT_THROW( Invalid_File_Format );
}
@ -1175,8 +1175,8 @@
else
{
FT_ERROR(( "ps_parser_load_field:"
" expected a name or string\n"
" "
" expected a name or string\n" ));
FT_ERROR(( " "
" but found token of type %d instead\n",
token.type ));
error = FT_THROW( Invalid_File_Format );
@ -1258,14 +1258,14 @@
if ( result < 0 || (FT_UInt)result < max_objects )
{
FT_ERROR(( "ps_parser_load_field:"
" expected %d integer%s in the %s subarray\n"
" "
" of /FontBBox in the /Blend dictionary\n",
" expected %d integer%s in the %s subarray\n",
max_objects, max_objects > 1 ? "s" : "",
i == 0 ? "first"
: ( i == 1 ? "second"
: ( i == 2 ? "third"
: "fourth" ) ) ));
FT_ERROR(( " "
" of /FontBBox in the /Blend dictionary\n" ));
error = FT_THROW( Invalid_File_Format );
FT_FREE( temp );

View File

@ -868,8 +868,8 @@
result[len] = '\0';
FT_TRACE0(( "sfnt_get_var_ps_name:"
" Shortening variation PS name prefix\n"
" "
" Shortening variation PS name prefix\n" ));
FT_TRACE0(( " "
" to %d characters\n", len ));
}
@ -920,8 +920,8 @@
if ( !subfamily_name )
{
FT_TRACE1(( "sfnt_get_var_ps_name:"
" can't construct named instance PS name;\n"
" "
" can't construct named instance PS name;\n" ));
FT_TRACE1(( " "
" trying to construct normal instance PS name\n" ));
goto construct_instance_name;
}

View File

@ -795,8 +795,8 @@
if ( maxProfile->maxTwilightPoints > ( 0xFFFFU - 4 ) )
{
FT_TRACE0(( "tt_face_load_maxp:"
" too much twilight points in `maxp' table;\n"
" "
" too much twilight points in `maxp' table;\n" ));
FT_TRACE0(( " "
" some glyphs might be rendered incorrectly\n" ));
maxProfile->maxTwilightPoints = 0xFFFFU - 4;

View File

@ -172,13 +172,17 @@
goto Exit;
}
#ifdef FT_DEBUG_LEVEL_TRACE
/* we currently don't support bit 1; however, it is better to */
/* draw at least something... */
if ( flags == 3 )
{
FT_TRACE1(( "tt_face_load_sbit_strikes:"
" sbix overlay not supported yet\n"
" "
" sbix overlay not supported yet\n" ));
FT_TRACE1(( " "
" expect bad rendering results\n" ));
}
#endif
/*
* Count the number of strikes available in the table. We are a bit
@ -240,8 +244,8 @@
if ( !face->ebdt_size )
{
FT_TRACE2(( "tt_face_load_sbit_strikes:"
" no embedded bitmap data table found;\n"
" "
" no embedded bitmap data table found;\n" ));
FT_TRACE2(( " "
" resetting number of strikes to zero\n" ));
face->sbit_num_strikes = 0;
}
@ -345,8 +349,8 @@
if ( metrics->ascender == 0 )
{
FT_TRACE2(( "tt_face_load_strike_metrics:"
" sanitizing invalid ascender and descender\n"
" "
" sanitizing invalid ascender and descender\n" ));
FT_TRACE2(( " "
" values for strike %ld (%dppem, %dppem)\n",
strike_index,
metrics->x_ppem, metrics->y_ppem ));
@ -374,8 +378,8 @@
if ( metrics->height == 0 )
{
FT_TRACE2(( "tt_face_load_strike_metrics:"
" sanitizing invalid height value\n"
" "
" sanitizing invalid height value\n" ));
FT_TRACE2(( " "
" for strike (%d, %d)\n",
metrics->x_ppem, metrics->y_ppem ));
metrics->height = metrics->y_ppem * 64;

View File

@ -487,8 +487,8 @@
if ( itemStore->axisCount != (FT_Long)blend->mmvar->num_axis )
{
FT_TRACE2(( "ft_var_load_item_variation_store:"
" number of axes in item variation store\n"
" "
" number of axes in item variation store\n" ));
FT_TRACE2(( " "
" and `fvar' table are different\n" ));
error = FT_THROW( Invalid_Table );
goto Exit;

View File

@ -712,8 +712,8 @@
tt_check_single_notdef( ttface ) )
{
FT_TRACE5(( "tt_face_init:"
" Only the `.notdef' glyph has an outline.\n"
" "
" Only the `.notdef' glyph has an outline.\n" ));
FT_TRACE5(( " "
" Resetting scalable flag to FALSE.\n" ));
ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;

View File

@ -237,10 +237,11 @@
if ( pos1 > face->glyf_len )
{
FT_TRACE1(( "tt_face_get_location:"
" too large offset (0x%08lx) found for glyph index %d,\n"
" "
" too large offset (0x%08lx) found for glyph index %d,\n",
pos1, gindex ));
FT_TRACE1(( " "
" exceeding the end of `glyf' table (0x%08lx)\n",
pos1, gindex, face->glyf_len ));
face->glyf_len ));
*asize = 0;
return 0;
}
@ -251,19 +252,21 @@
if ( gindex == face->num_locations - 2 )
{
FT_TRACE1(( "tt_face_get_location:"
" too large size (%ld bytes) found for glyph index %d,\n"
" "
" too large size (%ld bytes) found for glyph index %d,\n",
pos2 - pos1, gindex ));
FT_TRACE1(( " "
" truncating at the end of `glyf' table to %ld bytes\n",
pos2 - pos1, gindex, face->glyf_len - pos1 ));
face->glyf_len - pos1 ));
pos2 = face->glyf_len;
}
else
{
FT_TRACE1(( "tt_face_get_location:"
" too large offset (0x%08lx) found for glyph index %d,\n"
" "
" too large offset (0x%08lx) found for glyph index %d,\n",
pos2, gindex + 1 ));
FT_TRACE1(( " "
" exceeding the end of `glyf' table (0x%08lx)\n",
pos2, gindex + 1, face->glyf_len ));
face->glyf_len ));
*asize = 0;
return 0;
}

View File

@ -1122,8 +1122,8 @@
else if ( blend->num_designs != (FT_UInt)num_designs )
{
FT_ERROR(( "parse_weight_vector:"
" /BlendDesignPosition and /WeightVector have\n"
" "
" /BlendDesignPosition and /WeightVector have\n" ));
FT_ERROR(( " "
" different number of elements\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
@ -1307,9 +1307,9 @@
else
{
FT_TRACE1(( "t1_load_keyword: ignoring keyword `%s'"
" which is not valid at this point\n"
" (probably due to missing keywords)\n",
" which is not valid at this point\n",
field->ident ));
FT_TRACE1(( " (probably due to missing keywords)\n" ));
error = FT_Err_Ok;
}

View File

@ -420,12 +420,12 @@
goto Exit;
FT_TRACE2(( "magic %04lx, machine %02x, number_of_sections %u, "
"size_of_optional_header %02x\n"
"magic32 %02x, rsrc_virtual_address %04lx, "
"rsrc_size %04lx\n",
"size_of_optional_header %02x\n",
pe32_header.magic, pe32_header.machine,
pe32_header.number_of_sections,
pe32_header.size_of_optional_header,
pe32_header.size_of_optional_header ));
FT_TRACE2(( "magic32 %02x, rsrc_virtual_address %04lx, "
"rsrc_size %04lx\n",
pe32_header.magic32, pe32_header.rsrc_virtual_address,
pe32_header.rsrc_size ));