ReactOS 0.4.15-dev-5667-ged97270
pfrsbit.c File Reference
#include "pfrsbit.h"
#include "pfrload.h"
#include "pfrerror.h"
Include dependency graph for pfrsbit.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PFR_BitWriter_
 

Macros

#define FT_COMPONENT   trace_pfr
 

Typedefs

typedef struct PFR_BitWriter_ PFR_BitWriterRec
 
typedef struct PFR_BitWriter_PFR_BitWriter
 

Functions

static void pfr_bitwriter_init (PFR_BitWriter writer, FT_Bitmap *target, FT_Bool decreasing)
 
static void pfr_bitwriter_decode_bytes (PFR_BitWriter writer, FT_Byte *p, FT_Byte *limit)
 
static void pfr_bitwriter_decode_rle1 (PFR_BitWriter writer, FT_Byte *p, FT_Byte *limit)
 
static void pfr_bitwriter_decode_rle2 (PFR_BitWriter writer, FT_Byte *p, FT_Byte *limit)
 
static void pfr_lookup_bitmap_data (FT_Byte *base, FT_Byte *limit, FT_UInt count, FT_UInt *flags, FT_UInt char_code, FT_ULong *found_offset, FT_ULong *found_size)
 
static FT_Error pfr_load_bitmap_metrics (FT_Byte **pdata, FT_Byte *limit, FT_Long scaled_advance, FT_Long *axpos, FT_Long *aypos, FT_UInt *axsize, FT_UInt *aysize, FT_Long *aadvance, FT_UInt *aformat)
 
static FT_Error pfr_load_bitmap_bits (FT_Byte *p, FT_Byte *limit, FT_UInt format, FT_Bool decreasing, FT_Bitmap *target)
 
 pfr_slot_load_bitmap (PFR_Slot glyph, PFR_Size size, FT_UInt glyph_index, FT_Bool metrics_only)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_pfr

Definition at line 27 of file pfrsbit.c.

Typedef Documentation

◆ PFR_BitWriter

◆ PFR_BitWriterRec

Function Documentation

◆ pfr_bitwriter_decode_bytes()

static void pfr_bitwriter_decode_bytes ( PFR_BitWriter  writer,
FT_Byte p,
FT_Byte limit 
)
static

Definition at line 69 of file pfrsbit.c.

72 {
73 FT_UInt n, reload;
74 FT_UInt left = writer->width;
75 FT_Byte* cur = writer->line;
76 FT_UInt mask = 0x80;
77 FT_UInt val = 0;
78 FT_UInt c = 0;
79
80
81 n = (FT_UInt)( limit - p ) * 8;
82 if ( n > writer->total )
83 n = writer->total;
84
85 reload = n & 7;
86
87 for ( ; n > 0; n-- )
88 {
89 if ( ( n & 7 ) == reload )
90 val = *p++;
91
92 if ( val & 0x80 )
93 c |= mask;
94
95 val <<= 1;
96 mask >>= 1;
97
98 if ( --left <= 0 )
99 {
100 cur[0] = (FT_Byte)c;
101 left = writer->width;
102 mask = 0x80;
103
104 writer->line += writer->pitch;
105 cur = writer->line;
106 c = 0;
107 }
108 else if ( mask == 0 )
109 {
110 cur[0] = (FT_Byte)c;
111 mask = 0x80;
112 c = 0;
113 cur++;
114 }
115 }
116
117 if ( mask != 0x80 )
118 cur[0] = (FT_Byte)c;
119 }
unsigned char FT_Byte
Definition: fttypes.h:154
unsigned int FT_UInt
Definition: fttypes.h:231
FxCollectionEntry * cur
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLenum GLint GLuint mask
Definition: glext.h:6028
GLint limit
Definition: glext.h:10326
GLint left
Definition: glext.h:7726
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902
FT_UInt total
Definition: pfrsbit.c:44
FT_Byte * line
Definition: pfrsbit.c:40
FT_Int pitch
Definition: pfrsbit.c:41
FT_UInt width
Definition: pfrsbit.c:42

Referenced by pfr_load_bitmap_bits().

◆ pfr_bitwriter_decode_rle1()

static void pfr_bitwriter_decode_rle1 ( PFR_BitWriter  writer,
FT_Byte p,
FT_Byte limit 
)
static

Definition at line 123 of file pfrsbit.c.

126 {
127 FT_Int phase, count, counts[2];
128 FT_UInt n, reload;
129 FT_UInt left = writer->width;
130 FT_Byte* cur = writer->line;
131 FT_UInt mask = 0x80;
132 FT_UInt c = 0;
133
134
135 n = writer->total;
136
137 phase = 1;
138 counts[0] = 0;
139 counts[1] = 0;
140 count = 0;
141 reload = 1;
142
143 for ( ; n > 0; n-- )
144 {
145 if ( reload )
146 {
147 do
148 {
149 if ( phase )
150 {
151 FT_Int v;
152
153
154 if ( p >= limit )
155 break;
156
157 v = *p++;
158 counts[0] = v >> 4;
159 counts[1] = v & 15;
160 phase = 0;
161 count = counts[0];
162 }
163 else
164 {
165 phase = 1;
166 count = counts[1];
167 }
168
169 } while ( count == 0 );
170 }
171
172 if ( phase )
173 c |= mask;
174
175 mask >>= 1;
176
177 if ( --left <= 0 )
178 {
179 cur[0] = (FT_Byte)c;
180 left = writer->width;
181 mask = 0x80;
182
183 writer->line += writer->pitch;
184 cur = writer->line;
185 c = 0;
186 }
187 else if ( mask == 0 )
188 {
189 cur[0] = (FT_Byte)c;
190 mask = 0x80;
191 c = 0;
192 cur++;
193 }
194
195 reload = ( --count <= 0 );
196 }
197
198 if ( mask != 0x80 )
199 cur[0] = (FT_Byte) c;
200 }
signed int FT_Int
Definition: fttypes.h:220
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by pfr_load_bitmap_bits().

◆ pfr_bitwriter_decode_rle2()

static void pfr_bitwriter_decode_rle2 ( PFR_BitWriter  writer,
FT_Byte p,
FT_Byte limit 
)
static

Definition at line 204 of file pfrsbit.c.

207 {
208 FT_Int phase, count;
209 FT_UInt n, reload;
210 FT_UInt left = writer->width;
211 FT_Byte* cur = writer->line;
212 FT_UInt mask = 0x80;
213 FT_UInt c = 0;
214
215
216 n = writer->total;
217
218 phase = 1;
219 count = 0;
220 reload = 1;
221
222 for ( ; n > 0; n-- )
223 {
224 if ( reload )
225 {
226 do
227 {
228 if ( p >= limit )
229 break;
230
231 count = *p++;
232 phase = phase ^ 1;
233
234 } while ( count == 0 );
235 }
236
237 if ( phase )
238 c |= mask;
239
240 mask >>= 1;
241
242 if ( --left <= 0 )
243 {
244 cur[0] = (FT_Byte)c;
245 c = 0;
246 mask = 0x80;
247 left = writer->width;
248
249 writer->line += writer->pitch;
250 cur = writer->line;
251 }
252 else if ( mask == 0 )
253 {
254 cur[0] = (FT_Byte)c;
255 c = 0;
256 mask = 0x80;
257 cur++;
258 }
259
260 reload = ( --count <= 0 );
261 }
262
263 if ( mask != 0x80 )
264 cur[0] = (FT_Byte) c;
265 }

Referenced by pfr_load_bitmap_bits().

◆ pfr_bitwriter_init()

static void pfr_bitwriter_init ( PFR_BitWriter  writer,
FT_Bitmap target,
FT_Bool  decreasing 
)
static

Definition at line 50 of file pfrsbit.c.

53 {
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;
59
60 if ( !decreasing )
61 {
62 writer->line += writer->pitch * (FT_Int)( target->rows - 1 );
63 writer->pitch = -writer->pitch;
64 }
65 }
GLenum target
Definition: glext.h:7315
FT_UInt rows
Definition: pfrsbit.c:43

Referenced by pfr_load_bitmap_bits().

◆ pfr_load_bitmap_bits()

static FT_Error pfr_load_bitmap_bits ( FT_Byte p,
FT_Byte limit,
FT_UInt  format,
FT_Bool  decreasing,
FT_Bitmap target 
)
static

Definition at line 533 of file pfrsbit.c.

538 {
540 PFR_BitWriterRec writer;
541
542
543 if ( target->rows > 0 && target->width > 0 )
544 {
545 pfr_bitwriter_init( &writer, target, decreasing );
546
547 switch ( format )
548 {
549 case 0: /* packed bits */
551 break;
552
553 case 1: /* RLE1 */
554 pfr_bitwriter_decode_rle1( &writer, p, limit );
555 break;
556
557 case 2: /* RLE2 */
558 pfr_bitwriter_decode_rle2( &writer, p, limit );
559 break;
560
561 default:
562 ;
563 }
564 }
565
566 return error;
567 }
return FT_Err_Ok
Definition: ftbbox.c:511
int FT_Error
Definition: fttypes.h:300
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define error(str)
Definition: mkdosfs.c:1605
static void pfr_bitwriter_decode_rle2(PFR_BitWriter writer, FT_Byte *p, FT_Byte *limit)
Definition: pfrsbit.c:204
static void pfr_bitwriter_init(PFR_BitWriter writer, FT_Bitmap *target, FT_Bool decreasing)
Definition: pfrsbit.c:50
static void pfr_bitwriter_decode_bytes(PFR_BitWriter writer, FT_Byte *p, FT_Byte *limit)
Definition: pfrsbit.c:69
static void pfr_bitwriter_decode_rle1(PFR_BitWriter writer, FT_Byte *p, FT_Byte *limit)
Definition: pfrsbit.c:123

◆ pfr_load_bitmap_metrics()

static FT_Error pfr_load_bitmap_metrics ( FT_Byte **  pdata,
FT_Byte limit,
FT_Long  scaled_advance,
FT_Long axpos,
FT_Long aypos,
FT_UInt axsize,
FT_UInt aysize,
FT_Long aadvance,
FT_UInt aformat 
)
static

Definition at line 398 of file pfrsbit.c.

407 {
410 FT_Byte b;
411 FT_Byte* p = *pdata;
412 FT_Long xpos, ypos, advance;
413 FT_UInt xsize, ysize;
414
415
416 PFR_CHECK( 1 );
417 flags = PFR_NEXT_BYTE( p );
418
419 xpos = 0;
420 ypos = 0;
421 xsize = 0;
422 ysize = 0;
423 advance = 0;
424
425 switch ( flags & 3 )
426 {
427 case 0:
428 PFR_CHECK( 1 );
429 b = PFR_NEXT_BYTE( p );
430 xpos = (FT_Char)b >> 4;
431 ypos = ( (FT_Char)( b << 4 ) ) >> 4;
432 break;
433
434 case 1:
435 PFR_CHECK( 2 );
436 xpos = PFR_NEXT_INT8( p );
437 ypos = PFR_NEXT_INT8( p );
438 break;
439
440 case 2:
441 PFR_CHECK( 4 );
442 xpos = PFR_NEXT_SHORT( p );
443 ypos = PFR_NEXT_SHORT( p );
444 break;
445
446 case 3:
447 PFR_CHECK( 6 );
448 xpos = PFR_NEXT_LONG( p );
449 ypos = PFR_NEXT_LONG( p );
450 break;
451
452 default:
453 ;
454 }
455
456 flags >>= 2;
457 switch ( flags & 3 )
458 {
459 case 0:
460 /* blank image */
461 xsize = 0;
462 ysize = 0;
463 break;
464
465 case 1:
466 PFR_CHECK( 1 );
467 b = PFR_NEXT_BYTE( p );
468 xsize = ( b >> 4 ) & 0xF;
469 ysize = b & 0xF;
470 break;
471
472 case 2:
473 PFR_CHECK( 2 );
474 xsize = PFR_NEXT_BYTE( p );
475 ysize = PFR_NEXT_BYTE( p );
476 break;
477
478 case 3:
479 PFR_CHECK( 4 );
480 xsize = PFR_NEXT_USHORT( p );
481 ysize = PFR_NEXT_USHORT( p );
482 break;
483
484 default:
485 ;
486 }
487
488 flags >>= 2;
489 switch ( flags & 3 )
490 {
491 case 0:
492 advance = scaled_advance;
493 break;
494
495 case 1:
496 PFR_CHECK( 1 );
497 advance = PFR_NEXT_INT8( p ) * 256;
498 break;
499
500 case 2:
501 PFR_CHECK( 2 );
503 break;
504
505 case 3:
506 PFR_CHECK( 3 );
508 break;
509
510 default:
511 ;
512 }
513
514 *axpos = xpos;
515 *aypos = ypos;
516 *axsize = xsize;
517 *aysize = ysize;
518 *aadvance = advance;
519 *aformat = flags >> 2;
520 *pdata = p;
521
522 Exit:
523 return error;
524
525 Too_Short:
526 error = FT_THROW( Invalid_Table );
527 FT_ERROR(( "pfr_load_bitmap_metrics: invalid glyph data\n" ));
528 goto Exit;
529 }
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
signed char FT_Char
Definition: fttypes.h:143
signed long FT_Long
Definition: fttypes.h:242
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLbitfield flags
Definition: glext.h:7161
#define b
Definition: ke_i.h:79
static PROTOCOLDATA * pdata
Definition: protocol.c:158
#define PFR_NEXT_INT8(p)
Definition: pfrload.h:44
#define PFR_CHECK
Definition: pfrload.h:40
#define PFR_NEXT_SHORT(p)
Definition: pfrload.h:45
#define PFR_NEXT_LONG(p)
Definition: pfrload.h:47
#define PFR_NEXT_BYTE(p)
Definition: pfrload.h:43
#define PFR_NEXT_USHORT(p)
Definition: pfrload.h:46
static void Exit(void)
Definition: sock.c:1330

◆ pfr_lookup_bitmap_data()

static void pfr_lookup_bitmap_data ( FT_Byte base,
FT_Byte limit,
FT_UInt  count,
FT_UInt flags,
FT_UInt  char_code,
FT_ULong found_offset,
FT_ULong found_size 
)
static

Definition at line 277 of file pfrsbit.c.

284 {
285 FT_UInt min, max, char_len;
287 FT_Byte* buff;
288
289
290 char_len = 4;
291 if ( two )
292 char_len += 1;
294 char_len += 1;
296 char_len += 1;
297
299 {
300 FT_Byte* p;
301 FT_Byte* lim;
303 FT_Long prev_code;
304
305
307 prev_code = -1;
308 lim = base + count * char_len;
309
310 if ( lim > limit )
311 {
312 FT_TRACE0(( "pfr_lookup_bitmap_data:"
313 " number of bitmap records too large,\n"
314 " "
315 " thus ignoring all bitmaps in this strike\n" ));
316 *flags &= ~PFR_BITMAP_VALID_CHARCODES;
317 }
318 else
319 {
320 /* check whether records are sorted by code */
321 for ( p = base; p < lim; p += char_len )
322 {
323 if ( two )
324 code = FT_PEEK_USHORT( p );
325 else
326 code = *p;
327
328 if ( (FT_Long)code <= prev_code )
329 {
330 FT_TRACE0(( "pfr_lookup_bitmap_data:"
331 " bitmap records are not sorted,\n"
332 " "
333 " thus ignoring all bitmaps in this strike\n" ));
334 *flags &= ~PFR_BITMAP_VALID_CHARCODES;
335 break;
336 }
337
338 prev_code = code;
339 }
340 }
341
343 }
344
345 /* ignore bitmaps in case table is not valid */
346 /* (this might be sanitized, but PFR is dead...) */
347 if ( !( *flags & PFR_BITMAP_VALID_CHARCODES ) )
348 goto Fail;
349
350 min = 0;
351 max = count;
352
353 /* binary search */
354 while ( min < max )
355 {
356 FT_UInt mid, code;
357
358
359 mid = ( min + max ) >> 1;
360 buff = base + mid * char_len;
361
362 if ( two )
364 else
366
367 if ( char_code < code )
368 max = mid;
369 else if ( char_code > code )
370 min = mid + 1;
371 else
372 goto Found_It;
373 }
374
375 Fail:
376 /* Not found */
377 *found_size = 0;
378 *found_offset = 0;
379 return;
380
381 Found_It:
383 *found_size = PFR_NEXT_USHORT( buff );
384 else
385 *found_size = PFR_NEXT_BYTE( buff );
386
388 *found_offset = PFR_NEXT_ULONG( buff );
389 else
390 *found_offset = PFR_NEXT_USHORT( buff );
391 }
int Fail
Definition: ehthrow.cxx:24
static unsigned char buff[32768]
Definition: fatten.c:17
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
#define FT_PEEK_USHORT(p)
Definition: ftstream.h:171
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_BOOL(x)
Definition: fttypes.h:578
static double two
Definition: jn_yn.c:52
#define min(a, b)
Definition: monoChain.cc:55
#define PFR_NEXT_ULONG(p)
Definition: pfrload.h:48
#define PFR_BITMAP_VALID_CHARCODES
Definition: pfrtypes.h:115
#define PFR_BITMAP_2BYTE_CHARCODE
Definition: pfrtypes.h:109
#define PFR_BITMAP_2BYTE_SIZE
Definition: pfrtypes.h:110
#define PFR_BITMAP_3BYTE_OFFSET
Definition: pfrtypes.h:111
#define PFR_BITMAP_CHARCODES_VALIDATED
Definition: pfrtypes.h:114
Definition: inflate.c:139
#define max(a, b)
Definition: svc.c:63

◆ pfr_slot_load_bitmap()

pfr_slot_load_bitmap ( PFR_Slot  glyph,
PFR_Size  size,
FT_UInt  glyph_index,
FT_Bool  metrics_only 
)

Definition at line 579 of file pfrsbit.c.

583 {
585 PFR_Face face = (PFR_Face) glyph->root.face;
586 FT_Stream stream = face->root.stream;
587 PFR_PhyFont phys = &face->phy_font;
588 FT_ULong gps_offset;
589 FT_ULong gps_size;
590 PFR_Char character;
591 PFR_Strike strike;
592
593
594 character = &phys->chars[glyph_index];
595
596 /* look up a bitmap strike corresponding to the current */
597 /* character dimensions */
598 {
599 FT_UInt n;
600
601
602 strike = phys->strikes;
603 for ( n = 0; n < phys->num_strikes; n++ )
604 {
605 if ( strike->x_ppm == (FT_UInt)size->root.metrics.x_ppem &&
606 strike->y_ppm == (FT_UInt)size->root.metrics.y_ppem )
607 goto Found_Strike;
608
609 strike++;
610 }
611
612 /* couldn't find it */
613 return FT_THROW( Invalid_Argument );
614 }
615
616 Found_Strike:
617
618 /* now look up the glyph's position within the file */
619 {
620 FT_UInt char_len;
621
622
623 char_len = 4;
624 if ( strike->flags & PFR_BITMAP_2BYTE_CHARCODE )
625 char_len += 1;
626 if ( strike->flags & PFR_BITMAP_2BYTE_SIZE )
627 char_len += 1;
628 if ( strike->flags & PFR_BITMAP_3BYTE_OFFSET )
629 char_len += 1;
630
631 /* access data directly in the frame to speed lookups */
632 if ( FT_STREAM_SEEK( phys->bct_offset + strike->bct_offset ) ||
633 FT_FRAME_ENTER( char_len * strike->num_bitmaps ) )
634 goto Exit;
635
637 stream->limit,
638 strike->num_bitmaps,
639 &strike->flags,
640 character->char_code,
641 &gps_offset,
642 &gps_size );
643
645
646 if ( gps_size == 0 )
647 {
648 /* could not find a bitmap program string for this glyph */
649 error = FT_THROW( Invalid_Argument );
650 goto Exit;
651 }
652 }
653
654 /* get the bitmap metrics */
655 {
656 FT_Long xpos = 0, ypos = 0, advance = 0;
657 FT_UInt xsize = 0, ysize = 0, format = 0;
658 FT_Byte* p;
659
660
661 /* compute linear advance */
662 advance = character->advance;
663 if ( phys->metrics_resolution != phys->outline_resolution )
665 (FT_Long)phys->outline_resolution,
666 (FT_Long)phys->metrics_resolution );
667
669
670 /* compute default advance, i.e., scaled advance; this can be */
671 /* overridden in the bitmap header of certain glyphs */
672 advance = FT_MulDiv( (FT_Fixed)size->root.metrics.x_ppem << 8,
673 character->advance,
674 (FT_Long)phys->metrics_resolution );
675
676 if ( FT_STREAM_SEEK( face->header.gps_section_offset + gps_offset ) ||
677 FT_FRAME_ENTER( gps_size ) )
678 goto Exit;
679
680 p = stream->cursor;
682 advance,
683 &xpos, &ypos,
684 &xsize, &ysize,
685 &advance, &format );
686 if ( error )
687 goto Exit1;
688
689 /*
690 * Before allocating the target bitmap, we check whether the given
691 * bitmap dimensions are valid, depending on the image format.
692 *
693 * Format 0: We have a stream of pixels (with 8 pixels per byte).
694 *
695 * (xsize * ysize + 7) / 8 <= gps_size
696 *
697 * Format 1: Run-length encoding; the high nibble holds the number of
698 * white bits, the low nibble the number of black bits. In
699 * other words, a single byte can represent at most 15
700 * pixels.
701 *
702 * xsize * ysize <= 15 * gps_size
703 *
704 * Format 2: Run-length encoding; the high byte holds the number of
705 * white bits, the low byte the number of black bits. In
706 * other words, two bytes can represent at most 255 pixels.
707 *
708 * xsize * ysize <= 255 * (gps_size + 1) / 2
709 */
710 switch ( format )
711 {
712 case 0:
713 if ( ( (FT_ULong)xsize * ysize + 7 ) / 8 > gps_size )
714 error = FT_THROW( Invalid_Table );
715 break;
716 case 1:
717 if ( (FT_ULong)xsize * ysize > 15 * gps_size )
718 error = FT_THROW( Invalid_Table );
719 break;
720 case 2:
721 if ( (FT_ULong)xsize * ysize > 255 * ( ( gps_size + 1 ) / 2 ) )
722 error = FT_THROW( Invalid_Table );
723 break;
724 default:
725 FT_ERROR(( "pfr_slot_load_bitmap: invalid image type\n" ));
726 error = FT_THROW( Invalid_Table );
727 }
728
729 if ( error )
730 {
731 if ( FT_ERR_EQ( error, Invalid_Table ) )
732 FT_ERROR(( "pfr_slot_load_bitmap: invalid bitmap dimensions\n" ));
733 goto Exit1;
734 }
735
736 /*
737 * XXX: on 16bit systems we return an error for huge bitmaps
738 * that cause size truncation, because truncated
739 * size properties make bitmap glyphs broken.
740 */
741 if ( xpos > FT_INT_MAX ||
742 xpos < FT_INT_MIN ||
743 ysize > FT_INT_MAX ||
744 ypos > FT_INT_MAX - (FT_Long)ysize ||
745 ypos + (FT_Long)ysize < FT_INT_MIN )
746 {
747 FT_TRACE1(( "pfr_slot_load_bitmap:" ));
748 FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n",
749 xpos, ypos ));
750 error = FT_THROW( Invalid_Pixel_Size );
751 }
752
753 if ( !error )
754 {
755 glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
756
757 /* Set up glyph bitmap and metrics */
758
759 /* XXX: needs casts to fit FT_Bitmap.{width|rows|pitch} */
760 glyph->root.bitmap.width = xsize;
761 glyph->root.bitmap.rows = ysize;
762 glyph->root.bitmap.pitch = (FT_Int)( xsize + 7 ) >> 3;
764
765 /* XXX: needs casts to fit FT_Glyph_Metrics.{width|height} */
766 glyph->root.metrics.width = (FT_Pos)xsize << 6;
767 glyph->root.metrics.height = (FT_Pos)ysize << 6;
768 glyph->root.metrics.horiBearingX = xpos * 64;
769 glyph->root.metrics.horiBearingY = ypos * 64;
770 glyph->root.metrics.horiAdvance = FT_PIX_ROUND( ( advance >> 2 ) );
771 glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;
772 glyph->root.metrics.vertBearingY = 0;
773 glyph->root.metrics.vertAdvance = size->root.metrics.height;
774
775 /* XXX: needs casts fit FT_GlyphSlotRec.bitmap_{left|top} */
776 glyph->root.bitmap_left = (FT_Int)xpos;
777 glyph->root.bitmap_top = (FT_Int)( ypos + (FT_Long)ysize );
778
779 if ( metrics_only )
780 goto Exit1;
781
782 /* Allocate and read bitmap data */
783 {
784 FT_ULong len = (FT_ULong)glyph->root.bitmap.pitch * ysize;
785
786
788 if ( !error )
790 p,
791 stream->limit,
792 format,
793 FT_BOOL( face->header.color_flags &
795 &glyph->root.bitmap );
796 }
797 }
798
799 Exit1:
801 }
802
803 Exit:
804 return error;
805 }
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:416
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:183
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
#define FT_PIX_ROUND(x)
Definition: ftobjs.h:93
ft_glyphslot_alloc_bitmap(FT_GlyphSlot slot, FT_ULong size)
Definition: ftobjs.c:478
#define FT_INT_MIN
Definition: ftstdlib.h:64
#define FT_INT_MAX
Definition: ftstdlib.h:63
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:512
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
#define FT_FRAME_EXIT()
Definition: ftstream.h:517
unsigned long FT_ULong
Definition: fttypes.h:253
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:591
signed long FT_Fixed
Definition: fttypes.h:288
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLenum GLsizei len
Definition: glext.h:6722
#define for
Definition: utility.h:88
typedefFT_BEGIN_HEADER struct PFR_FaceRec_ * PFR_Face
Definition: pfrobjs.h:27
static FT_Error pfr_load_bitmap_bits(FT_Byte *p, FT_Byte *limit, FT_UInt format, FT_Bool decreasing, FT_Bitmap *target)
Definition: pfrsbit.c:533
static FT_Error pfr_load_bitmap_metrics(FT_Byte **pdata, FT_Byte *limit, FT_Long scaled_advance, FT_Long *axpos, FT_Long *aypos, FT_UInt *axsize, FT_UInt *aysize, FT_Long *aadvance, FT_UInt *aformat)
Definition: pfrsbit.c:398
static void pfr_lookup_bitmap_data(FT_Byte *base, FT_Byte *limit, FT_UInt count, FT_UInt *flags, FT_UInt char_code, FT_ULong *found_offset, FT_ULong *found_size)
Definition: pfrsbit.c:277
#define PFR_FLAG_INVERT_BITMAP
Definition: pfrtypes.h:73
unsigned int width
Definition: ftimage.h:264
unsigned char pixel_mode
Definition: ftimage.h:268
unsigned int rows
Definition: ftimage.h:263
int pitch
Definition: ftimage.h:265
FT_Int bitmap_top
Definition: freetype.h:1925
FT_Int bitmap_left
Definition: freetype.h:1924
FT_Bitmap bitmap
Definition: freetype.h:1923
FT_Fixed linearHoriAdvance
Definition: freetype.h:1917
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
FT_Glyph_Format format
Definition: freetype.h:1921
FT_GlyphSlotRec root
Definition: pfrobjs.h:53
Definition: parse.h:23

Referenced by pfr_slot_load().