21 #include FT_INTERNAL_DEBUG_H 22 #include FT_INTERNAL_STREAM_H 27 #define FT_COMPONENT trace_pfr 38 typedef struct PFR_BitWriter_
54 writer->line = target->
buffer;
55 writer->pitch = target->
pitch;
56 writer->width = target->
width;
57 writer->rows = target->
rows;
58 writer->total = writer->width * writer->rows;
62 writer->line += writer->pitch * ( target->
rows-1 );
63 writer->pitch = -writer->pitch;
82 if ( n > writer->total )
89 if ( ( n & 7 ) == reload )
101 left = writer->width;
104 writer->line += writer->pitch;
108 else if ( mask == 0 )
168 }
while ( count == 0 );
179 left = writer->width;
182 writer->line += writer->pitch;
186 else if ( mask == 0 )
194 reload = ( --count <= 0 );
232 }
while ( count == 0 );
245 left = writer->width;
247 writer->line += writer->pitch;
250 else if ( mask == 0 )
258 reload = ( --count <= 0 );
275 pfr_lookup_bitmap_data(
FT_Byte* base,
289 if ( two ) char_len += 1;
290 if (
flags & 2 ) char_len += 1;
291 if (
flags & 4 ) char_len += 1;
296 while ( left < right )
301 middle = ( left +
right ) >> 1;
302 buff = base + middle * char_len;
306 if ( buff + char_len >
limit )
314 if ( code == char_code )
317 if ( code < char_code )
346 pfr_load_bitmap_metrics(
FT_Byte** pdata,
379 ypos = ( (
FT_Char)( b << 4 ) ) >> 4;
416 xsize = ( b >> 4 ) & 0xF;
440 advance = scaled_advance;
467 *aformat = flags >> 2;
475 FT_ERROR((
"pfr_load_bitmap_metrics: invalid glyph data\n" ));
491 if ( target->
rows > 0 && target->
width > 0 )
493 pfr_bitwriter_init( &writer, target, decreasing );
498 pfr_bitwriter_decode_bytes( &writer,
p,
limit );
502 pfr_bitwriter_decode_rle1( &writer,
p,
limit );
506 pfr_bitwriter_decode_rle2( &writer,
p,
limit );
510 FT_ERROR((
"pfr_read_bitmap_data: invalid image type\n" ));
511 error =
FT_THROW( Invalid_File_Format );
542 character = &phys->chars[glyph_index];
550 strike = phys->strikes;
551 for (
n = 0;
n < phys->num_strikes;
n++ )
553 if ( strike->x_ppm == (
FT_UInt)
size->root.metrics.x_ppem &&
554 strike->y_ppm == (
FT_UInt)
size->root.metrics.y_ppem )
563 return FT_THROW( Invalid_Argument );
574 if ( strike->flags & 1 ) char_len += 1;
575 if ( strike->flags & 2 ) char_len += 1;
576 if ( strike->flags & 4 ) char_len += 1;
583 pfr_lookup_bitmap_data(
stream->cursor,
587 character->char_code,
603 FT_Long xpos = 0, ypos = 0, advance = 0;
609 advance = character->advance;
610 if ( phys->metrics_resolution != phys->outline_resolution )
612 phys->outline_resolution,
613 phys->metrics_resolution );
615 glyph->root.linearHoriAdvance = advance;
621 phys->metrics_resolution );
628 error = pfr_load_bitmap_metrics( &p,
stream->limit,
642 FT_TRACE1((
"huge bitmap glyph %dx%d over FT_GlyphSlot\n",
649 glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
654 glyph->root.bitmap.width = (
FT_Int)xsize;
655 glyph->root.bitmap.rows = (
FT_Int)ysize;
656 glyph->root.bitmap.pitch = (
FT_Int)( xsize + 7 ) >> 3;
660 glyph->root.metrics.width = (
FT_Pos)xsize << 6;
661 glyph->root.metrics.height = (
FT_Pos)ysize << 6;
662 glyph->root.metrics.horiBearingX = xpos << 6;
663 glyph->root.metrics.horiBearingY = ypos << 6;
664 glyph->root.metrics.horiAdvance =
FT_PIX_ROUND( ( advance >> 2 ) );
665 glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;
666 glyph->root.metrics.vertBearingY = 0;
667 glyph->root.metrics.vertAdvance =
size->root.metrics.height;
670 glyph->root.bitmap_left = (
FT_Int)xpos;
671 glyph->root.bitmap_top = (
FT_Int)(ypos + ysize);
681 error = pfr_load_bitmap_bits(
686 &glyph->root.bitmap );
for(n=1;n< outline->n_points;n++)
FT_BEGIN_HEADER typedef signed long FT_Pos
return FT_THROW(Missing_Property)
pfr_slot_load_bitmap(PFR_Slot glyph, PFR_Size size, FT_UInt glyph_index)
GLint GLint GLsizei width
GLboolean GLboolean GLboolean b
FT_BEGIN_HEADER typedef unsigned char FT_Bool
#define FT_TRACE1(varformat)
GLenum GLuint GLint GLenum face
#define FT_ERROR(varformat)
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
ft_glyphslot_alloc_bitmap(FT_GlyphSlot slot, FT_ULong size)
#define FT_STREAM_SEEK(position)
struct PFR_BitWriter_ * PFR_BitWriter
struct PFR_BitWriter_ PFR_BitWriterRec
typedefFT_BEGIN_HEADER struct PFR_FaceRec_ * PFR_Face
GLuint GLuint GLsizei count
#define FT_FRAME_ENTER(size)
#define PFR_NEXT_USHORT(p)
#define PFR_NEXT_ULONG(p)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define PFR_NEXT_SHORT(p)