* src/truetype/ttpload.c (tt_face_load_hdmx): Added comments.

This commit is contained in:
Alexei Podtelezhnikov 2021-11-26 09:15:46 -05:00
parent 32f13c11a4
commit 36a905e174
1 changed files with 8 additions and 5 deletions

View File

@ -555,7 +555,7 @@
if ( record_size >= 0xFFFF0000UL ) if ( record_size >= 0xFFFF0000UL )
record_size &= 0xFFFFU; record_size &= 0xFFFFU;
FT_TRACE2(( "Hdmx ", num_records, record_size )); FT_TRACE2(( "Hdmx " ));
/* The limit for `num_records' is a heuristic value. */ /* The limit for `num_records' is a heuristic value. */
if ( num_records > 255 || num_records == 0 ) if ( num_records > 255 || num_records == 0 )
@ -564,18 +564,21 @@
goto Fail; goto Fail;
} }
/* Out-of-spec tables are rejected. */ /* Out-of-spec tables are rejected. The record size must be */
if ( (FT_Long)record_size != ( ( face->root.num_glyphs + 5 ) & ~3 ) ) /* equal to the number of glyphs + 2 + 32-bit padding. */
if ( (FT_Long)record_size != ( ( face->root.num_glyphs + 2 + 3 ) & ~3 ) )
{ {
FT_TRACE2(( "with record size off by %ld bytes rejected\n", FT_TRACE2(( "with record size off by %ld bytes rejected\n",
(FT_Long)record_size - (FT_Long)record_size -
( ( face->root.num_glyphs + 5 ) & ~3 ) )); ( ( face->root.num_glyphs + 2 + 3 ) & ~3 ) ));
goto Fail; goto Fail;
} }
if ( FT_QNEW_ARRAY( face->hdmx_record_sizes, num_records ) ) if ( FT_QNEW_ARRAY( face->hdmx_record_sizes, num_records ) )
goto Fail; goto Fail;
/* XXX: We do not check if the records are sorted by ppem */
/* and cannot use binary search later. */
for ( nn = 0; nn < num_records; nn++ ) for ( nn = 0; nn < num_records; nn++ )
{ {
if ( p + record_size > limit ) if ( p + record_size > limit )