|
|
|
@ -5,7 +5,7 @@ |
|
|
|
|
/* TrueType and OpenType embedded bitmap support (body). */ |
|
|
|
|
/* This is a heap-optimized version. */ |
|
|
|
|
/* */ |
|
|
|
|
/* Copyright 2005, 2006, 2007, 2008 by */ |
|
|
|
|
/* Copyright 2005, 2006, 2007, 2008, 2009 by */ |
|
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
|
|
|
|
/* */ |
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */ |
|
|
|
@ -39,65 +39,16 @@ |
|
|
|
|
#define FT_COMPONENT trace_ttsbit |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const FT_Frame_Field tt_sbit_line_metrics_fields[] = |
|
|
|
|
{ |
|
|
|
|
#undef FT_STRUCTURE |
|
|
|
|
#define FT_STRUCTURE TT_SBit_LineMetricsRec |
|
|
|
|
|
|
|
|
|
/* no FT_FRAME_START */ |
|
|
|
|
FT_FRAME_CHAR( ascender ), |
|
|
|
|
FT_FRAME_CHAR( descender ), |
|
|
|
|
FT_FRAME_BYTE( max_width ), |
|
|
|
|
|
|
|
|
|
FT_FRAME_CHAR( caret_slope_numerator ), |
|
|
|
|
FT_FRAME_CHAR( caret_slope_denominator ), |
|
|
|
|
FT_FRAME_CHAR( caret_offset ), |
|
|
|
|
|
|
|
|
|
FT_FRAME_CHAR( min_origin_SB ), |
|
|
|
|
FT_FRAME_CHAR( min_advance_SB ), |
|
|
|
|
FT_FRAME_CHAR( max_before_BL ), |
|
|
|
|
FT_FRAME_CHAR( min_after_BL ), |
|
|
|
|
FT_FRAME_CHAR( pads[0] ), |
|
|
|
|
FT_FRAME_CHAR( pads[1] ), |
|
|
|
|
FT_FRAME_END |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const FT_Frame_Field tt_strike_start_fields[] = |
|
|
|
|
{ |
|
|
|
|
#undef FT_STRUCTURE |
|
|
|
|
#define FT_STRUCTURE TT_SBit_StrikeRec |
|
|
|
|
|
|
|
|
|
/* no FT_FRAME_START */ |
|
|
|
|
FT_FRAME_ULONG( ranges_offset ), |
|
|
|
|
FT_FRAME_SKIP_LONG, |
|
|
|
|
FT_FRAME_ULONG( num_ranges ), |
|
|
|
|
FT_FRAME_ULONG( color_ref ), |
|
|
|
|
FT_FRAME_END |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const FT_Frame_Field tt_strike_end_fields[] = |
|
|
|
|
{ |
|
|
|
|
/* no FT_FRAME_START */ |
|
|
|
|
FT_FRAME_USHORT( start_glyph ), |
|
|
|
|
FT_FRAME_USHORT( end_glyph ), |
|
|
|
|
FT_FRAME_BYTE ( x_ppem ), |
|
|
|
|
FT_FRAME_BYTE ( y_ppem ), |
|
|
|
|
FT_FRAME_BYTE ( bit_depth ), |
|
|
|
|
FT_FRAME_CHAR ( flags ), |
|
|
|
|
FT_FRAME_END |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error ) |
|
|
|
|
tt_face_load_eblc( TT_Face face, |
|
|
|
|
FT_Stream stream ) |
|
|
|
|
{ |
|
|
|
|
FT_Error error = SFNT_Err_Ok; |
|
|
|
|
FT_Fixed version; |
|
|
|
|
FT_ULong num_strikes, table_size; |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_Byte* p_limit; |
|
|
|
|
FT_UInt count; |
|
|
|
|
FT_Error error = SFNT_Err_Ok; |
|
|
|
|
FT_Fixed version; |
|
|
|
|
FT_ULong num_strikes, table_size; |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_Byte* p_limit; |
|
|
|
|
FT_UInt count; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
face->sbit_num_strikes = 0; |
|
|
|
@ -111,7 +62,7 @@ |
|
|
|
|
|
|
|
|
|
if ( table_size < 8 ) |
|
|
|
|
{ |
|
|
|
|
FT_ERROR(( "%s: table too short!\n", "tt_face_load_sbit_strikes" )); |
|
|
|
|
FT_ERROR(( "tt_face_load_sbit_strikes: table too short!\n" )); |
|
|
|
|
error = SFNT_Err_Invalid_File_Format; |
|
|
|
|
goto Exit; |
|
|
|
|
} |
|
|
|
@ -129,8 +80,7 @@ |
|
|
|
|
|
|
|
|
|
if ( version != 0x00020000UL || num_strikes >= 0x10000UL ) |
|
|
|
|
{ |
|
|
|
|
FT_ERROR(( "%s: invalid table version!\n", |
|
|
|
|
"tt_face_load_sbit_strikes" )); |
|
|
|
|
FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version!\n" )); |
|
|
|
|
error = SFNT_Err_Invalid_File_Format; |
|
|
|
|
goto Fail; |
|
|
|
|
} |
|
|
|
@ -182,7 +132,7 @@ |
|
|
|
|
FT_ULong strike_index, |
|
|
|
|
FT_Size_Metrics* metrics ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte* strike; |
|
|
|
|
FT_Byte* strike; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( strike_index >= (FT_ULong)face->sbit_num_strikes ) |
|
|
|
@ -401,7 +351,7 @@ |
|
|
|
|
|
|
|
|
|
decoder->metrics_loaded = 1; |
|
|
|
|
*pp = p; |
|
|
|
|
return 0; |
|
|
|
|
return SFNT_Err_Ok; |
|
|
|
|
|
|
|
|
|
Fail: |
|
|
|
|
return SFNT_Err_Invalid_Argument; |
|
|
|
@ -507,7 +457,7 @@ |
|
|
|
|
if ( w > 0 ) |
|
|
|
|
wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) ); |
|
|
|
|
|
|
|
|
|
/* all bits read and there are ( x_pos + w ) bits to be written */ |
|
|
|
|
/* all bits read and there are `x_pos + w' bits to be written */ |
|
|
|
|
|
|
|
|
|
write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) ); |
|
|
|
|
|
|
|
|
|