20 #include FT_INTERNAL_DEBUG_H
21 #include FT_INTERNAL_STREAM_H
22 #include FT_TRUETYPE_TAGS_H
28 #ifndef FT_CONFIG_OPTION_OLD_INTERNALS
35 #include FT_INTERNAL_DEBUG_H
36 #include FT_INTERNAL_STREAM_H
37 #include FT_TRUETYPE_TAGS_H
50 #define FT_COMPONENT trace_ttsbit
99 line_incr = target->
pitch;
100 line_buff = target->
buffer;
103 line_buff -= line_incr * ( target->
rows - 1 );
105 line_buff += ( x_offset >> 3 ) + y_offset * line_incr;
121 for ( height = source_height; height > 0; height-- )
150 cur[0] |= (
FT_Byte)( val >> shift );
151 cur[1] |= (
FT_Byte)( val << space );
161 }
while ( count >= 0 );
183 cur[0] |= (
FT_Byte)( val >> shift );
186 cur[1] |= (
FT_Byte)( val << space );
199 line_buff += line_incr;
207 #define FT_STRUCTURE TT_SBit_MetricsRec
303 for ( n = 0; n <
count; n++ )
356 error = SFNT_Err_Invalid_File_Format;
364 size_elem = large ? 4 : 2;
370 for ( n = 0; n < num_glyphs; n++ )
379 error = Load_SBit_Const_Metrics( range, stream );
383 error = Load_SBit_Range_Codes( range, stream, 1 );
387 error = Load_SBit_Const_Metrics( range, stream );
389 error = Load_SBit_Range_Codes( range, stream, 0 );
393 error = SFNT_Err_Invalid_File_Format;
430 #define FT_STRUCTURE TT_SBit_LineMetricsRec
453 #define FT_STRUCTURE TT_SBit_StrikeRec
476 face->num_sbit_strikes = 0;
479 error = face->goto_table( face,
TTAG_EBLC, stream, 0 );
481 error = face->goto_table( face,
TTAG_bloc, stream, 0 );
495 if ( version != 0x00020000L ||
496 num_strikes >= 0x10000L )
498 FT_ERROR((
"tt_face_load_sbit_strikes: invalid table version\n" ));
499 error = SFNT_Err_Invalid_File_Format;
508 face->num_sbit_strikes = num_strikes;
583 error = Load_SBit_Range( range, stream );
622 for ( ; strike < strike_limit; strike++ )
630 for ( ; range < range_limit; range++ )
643 face->num_sbit_strikes = 0;
664 if ( strike_index >= face->num_sbit_strikes )
665 return SFNT_Err_Invalid_Argument;
667 strike = face->sbit_strikes + strike_index;
670 metrics->y_ppem = strike->
y_ppem;
680 metrics->height = metrics->ascender - metrics->descender;
709 find_sbit_range(
FT_UInt glyph_index,
729 for ( ; range < range_limit; range++ )
785 return SFNT_Err_Invalid_Argument;
818 tt_find_sbit_image(
TT_Face face,
829 if ( !face->sbit_strikes ||
830 ( face->num_sbit_strikes <= strike_index ) )
833 strike = &face->sbit_strikes[strike_index];
835 error = find_sbit_range( glyph_index, strike,
836 arange, aglyph_offset );
850 return SFNT_Err_Invalid_Argument;
889 switch ( range->image_format )
901 #define FT_STRUCTURE TT_SBit_SmallMetricsRec
918 metrics->height = smetrics.
height;
919 metrics->width = smetrics.
width;
920 metrics->horiBearingX = smetrics.
bearingX;
921 metrics->horiBearingY = smetrics.
bearingY;
922 metrics->horiAdvance = smetrics.
advance;
926 metrics->vertBearingX = 0;
927 metrics->vertBearingY = 0;
928 metrics->vertAdvance = 0;
942 if ( range->index_format == 2 || range->index_format == 5 )
943 *metrics = range->metrics;
945 return SFNT_Err_Invalid_File_Format;
1001 line_len = map->
pitch;
1004 for ( count = 0; count < rows; count++ )
1010 for ( ; cur <
limit; cur++ )
1020 if ( count >= rows )
1029 ( rows - count ) * line_len );
1047 for ( count = 0; count < rows; count++ )
1050 FT_Byte* limit = line + line_len;
1053 for ( ; cur <
limit; cur++ )
1080 limit = line + rows * line_len;
1082 for ( ; line <
limit; line += line_len )
1083 if ( line[0] & 0x80 )
1088 limit = line + rows * line_len;
1090 for ( ; line <
limit; line += line_len )
1098 for ( n = 8; n <
width; n += 8 )
1104 cur[0] = (
FT_Byte)( old | ( val >> 7 ) );
1116 }
while ( map->
width > 0 );
1133 limit = line + rows * line_len;
1134 mask = (
FT_Byte)( 0x80 >> ( right & 7 ) );
1136 for ( ; line <
limit; line += line_len )
1137 if ( line[0] & mask )
1144 }
while ( map->
width > 0 );
1171 if ( x_offset < 0 || x_offset + metrics->width > map->
width ||
1172 y_offset < 0 || y_offset + metrics->height > map->
rows )
1174 error = SFNT_Err_Invalid_Argument;
1183 FT_Int line_bits = pix_bits * glyph_width;
1188 switch ( image_format )
1199 line_length = ( glyph_width + 7 ) >> 3;
1202 line_length = ( glyph_width + 3 ) >> 2;
1205 line_length = ( glyph_width + 1 ) >> 1;
1208 line_length = glyph_width;
1211 glyph_size = glyph_height * line_length;
1219 line_bits = glyph_width * pix_bits;
1220 glyph_size = ( glyph_height * line_bits + 7 ) >> 3;
1224 return SFNT_Err_Invalid_File_Format;
1234 blit_sbit( map, (
FT_Byte*)stream->
cursor, line_bits, pad_bytes,
1235 x_offset * pix_bits, y_offset, metrics->
height );
1266 error = tt_load_sbit_metrics( stream, range, metrics );
1304 return SFNT_Err_Invalid_File_Format;
1325 return Load_SBit_Single( map, x_offset, y_offset, strike->
bit_depth,
1331 error = SFNT_Err_Invalid_Stream_Skip;
1340 return SFNT_Err_Invalid_File_Format;
1355 count = num_components;
1360 for ( comp = components; count > 0; count--, comp++ )
1370 count = num_components;
1372 for ( ; count > 0; count--, comp++ )
1388 error = Load_SBit_Image( strike,
1461 error = tt_find_sbit_image( face, glyph_index, strike_index,
1462 &range, &strike, &glyph_offset );
1468 error = face->goto_table( face,
TTAG_EBDT, stream, 0 );
1470 error = face->goto_table( face,
TTAG_bdat, stream, 0 );
1476 error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset,
1477 face->root.glyph, 0, 0, stream, metrics, 0 );
1482 if ( strike->
flags & 1 )
1492 metrics->vertBearingX = (
FT_Char)(-metrics->width / 2 );
1493 metrics->vertBearingY = (
FT_Char)( ( advance - metrics->height ) / 2 );
1494 metrics->vertAdvance = (
FT_Char)( advance * 12 / 10 );
1499 crop_bitmap( map, metrics );
GLuint const GLfloat * val
GLuint GLsizei GLsizei GLfloat * metrics
EGLSurface EGLint EGLint EGLint EGLint height
tt_face_set_sbit_strike(TT_Face face, FT_Size_Request req, FT_ULong *astrike_index)
#define FT_READ_USHORT(var)
static int comp(const void *a, const void *b)
TT_SBit_LineMetricsRec hori
tt_face_load_sbit_image(TT_Face face, FT_ULong strike_index, FT_UInt glyph_index, FT_UInt load_flags, FT_Stream stream, FT_Bitmap *map, TT_SBit_MetricsRec *metrics)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
#define FT_ERROR(varformat)
TT_SBit_LineMetricsRec vert
EGLContext EGLenum target
#define FT_STREAM_READ_FIELDS(fields, object)
FT_Match_Size(FT_Face face, FT_Size_Request req, FT_Bool ignore_width, FT_ULong *size_index)
#define FT_STREAM_SKIP(distance)
#define FT_FRAME_USHORT(f)
#define FT_LOAD_CROP_BITMAP
EGLSurface EGLint EGLint EGLint width
ft_glyphslot_alloc_bitmap(FT_GlyphSlot slot, FT_ULong size)
#define FT_READ_ULONG(var)
TT_SBit_MetricsRec metrics
GLint GLenum GLsizei GLsizei GLsizei depth
FT_BEGIN_HEADER tt_face_load_eblc(TT_Face face, FT_Stream stream)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
#define FT_NEW_ARRAY(ptr, count)
#define FT_STREAM_SEEK(position)
TT_SBit_Range sbit_ranges
#define FT_FRAME_ULONG(f)
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
#define FT_FRAME_SKIP_LONG
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
tt_face_free_eblc(TT_Face face)
GLenum GLenum GLuint components
#define FT_FRAME_ENTER(size)
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
#define FT_MEM_MOVE(dest, source, count)
GLsizei GLsizei GLchar * source
#define FT_FRAME_START(size)
tt_face_load_strike_metrics(TT_Face face, FT_ULong strike_index, FT_Size_Metrics *metrics)