15 |
/* */ |
/* */ |
16 |
/***************************************************************************/ |
/***************************************************************************/ |
17 |
|
|
18 |
|
#include <ft2build.h> |
19 |
|
#include FT_INTERNAL_DEBUG_H |
20 |
|
#include FT_INTERNAL_STREAM_H |
21 |
|
#include FT_TRUETYPE_TAGS_H |
22 |
|
|
23 |
|
#ifdef FT_OPTIMIZE_MEMORY |
24 |
|
#include "ttsbit0.c" |
25 |
|
#else /* !OPTIMIZE_MEMORY */ |
26 |
|
|
27 |
#include <ft2build.h> |
#include <ft2build.h> |
28 |
#include FT_INTERNAL_DEBUG_H |
#include FT_INTERNAL_DEBUG_H |
415 |
FT_ULong num_strikes; |
FT_ULong num_strikes; |
416 |
FT_ULong table_base; |
FT_ULong table_base; |
417 |
|
|
418 |
const FT_Frame_Field sbit_line_metrics_fields[] = |
static const FT_Frame_Field sbit_line_metrics_fields[] = |
419 |
{ |
{ |
420 |
#undef FT_STRUCTURE |
#undef FT_STRUCTURE |
421 |
#define FT_STRUCTURE TT_SBit_LineMetricsRec |
#define FT_STRUCTURE TT_SBit_LineMetricsRec |
438 |
FT_FRAME_END |
FT_FRAME_END |
439 |
}; |
}; |
440 |
|
|
441 |
const FT_Frame_Field strike_start_fields[] = |
static const FT_Frame_Field strike_start_fields[] = |
442 |
{ |
{ |
443 |
#undef FT_STRUCTURE |
#undef FT_STRUCTURE |
444 |
#define FT_STRUCTURE TT_SBit_StrikeRec |
#define FT_STRUCTURE TT_SBit_StrikeRec |
451 |
FT_FRAME_END |
FT_FRAME_END |
452 |
}; |
}; |
453 |
|
|
454 |
const FT_Frame_Field strike_end_fields[] = |
static const FT_Frame_Field strike_end_fields[] = |
455 |
{ |
{ |
456 |
/* no FT_FRAME_START */ |
/* no FT_FRAME_START */ |
457 |
FT_FRAME_USHORT( start_glyph ), |
FT_FRAME_USHORT( start_glyph ), |
584 |
} |
} |
585 |
} |
} |
586 |
|
|
587 |
|
/* now set up the root fields to indicate the strikes |
588 |
|
*/ |
589 |
|
if ( face->num_sbit_strikes ) |
590 |
|
{ |
591 |
|
FT_ULong n; |
592 |
|
FT_Face root = FT_FACE(face); |
593 |
|
|
594 |
|
|
595 |
|
if ( FT_NEW_ARRAY( root->available_sizes, face->num_sbit_strikes ) ) |
596 |
|
goto Exit; |
597 |
|
|
598 |
|
for ( n = 0 ; n < face->num_sbit_strikes ; n++ ) |
599 |
|
{ |
600 |
|
FT_Bitmap_Size* bsize = root->available_sizes + n; |
601 |
|
TT_SBit_Strike strike = face->sbit_strikes + n; |
602 |
|
FT_UShort fupem = face->header.Units_Per_EM; |
603 |
|
FT_Short height = (FT_Short)( face->horizontal.Ascender - |
604 |
|
face->horizontal.Descender + |
605 |
|
face->horizontal.Line_Gap ); |
606 |
|
FT_Short avg = face->os2.xAvgCharWidth; |
607 |
|
|
608 |
|
|
609 |
|
/* assume 72dpi */ |
610 |
|
bsize->height = |
611 |
|
(FT_Short)( ( height * strike->y_ppem + fupem/2 ) / fupem ); |
612 |
|
bsize->width = |
613 |
|
(FT_Short)( ( avg * strike->y_ppem + fupem/2 ) / fupem ); |
614 |
|
bsize->size = strike->y_ppem << 6; |
615 |
|
bsize->x_ppem = strike->x_ppem << 6; |
616 |
|
bsize->y_ppem = strike->y_ppem << 6; |
617 |
|
} |
618 |
|
|
619 |
|
root->face_flags |= FT_FACE_FLAG_FIXED_SIZES; |
620 |
|
root->num_fixed_sizes = (FT_Int)face->num_sbit_strikes; |
621 |
|
} |
622 |
|
|
623 |
Exit: |
Exit: |
624 |
return error; |
return error; |
625 |
} |
} |
1516 |
|
|
1517 |
|
|
1518 |
/* END */ |
/* END */ |
1519 |
|
#endif /* !OPTIMIZE_MEMORY */ |