25 #include FT_INTERNAL_DEBUG_H 26 #include FT_TRUETYPE_IDS_H 31 #define FT_COMPONENT trace_pfr 52 memory = pfrface->driver->root.memory;
55 pfrface->family_name =
NULL;
56 pfrface->style_name =
NULL;
62 FT_FREE( pfrface->available_sizes );
100 face->header.log_dir_offset,
105 pfrface->num_faces = num_faces;
108 if ( face_index < 0 )
111 if ( face_index >= pfrface->num_faces )
113 FT_ERROR((
"pfr_face_init: invalid face index\n" ));
121 face->header.log_dir_offset,
122 FT_BOOL(
face->header.phy_font_max_size_high != 0 ) );
128 face->log_font.phys_offset,
129 face->log_font.phys_size );
138 pfrface->face_index = face_index;
139 pfrface->num_glyphs = phy_font->
num_chars + 1;
148 for ( nn = 0; nn < phy_font->
num_chars; nn++ )
155 pfrface->face_flags = 0;
158 FT_ERROR((
"pfr_face_init: font doesn't contain glyphs\n" ));
184 if ( pfrface->family_name ==
NULL )
185 pfrface->family_name = phy_font->
font_id;
192 pfrface->num_fixed_sizes = 0;
193 pfrface->available_sizes = 0;
195 pfrface->bbox = phy_font->
bbox;
200 pfrface->height = (
FT_Short)( ( pfrface->units_per_EM * 12 ) / 10 );
201 if ( pfrface->height < pfrface->ascender - pfrface->descender )
202 pfrface->height = (
FT_Short)(pfrface->ascender - pfrface->descender);
209 FT_Memory memory = pfrface->stream->memory;
215 size = pfrface->available_sizes;
217 for ( n = 0; n <
count; n++, size++, strike++ )
221 size->size = strike->
y_ppm << 6;
222 size->x_ppem = strike->
x_ppm << 6;
223 size->y_ppem = strike->
y_ppm << 6;
225 pfrface->num_fixed_sizes =
count;
238 for ( ; count > 0; count--, gchar++ )
240 if ( max < gchar->advance )
244 pfrface->max_advance_width = (
FT_Short)max;
247 pfrface->max_advance_height = pfrface->height;
249 pfrface->underline_position = (
FT_Short)( -pfrface->units_per_EM / 10 );
250 pfrface->underline_thickness = (
FT_Short)( pfrface->units_per_EM / 30 );
257 charmap.
face = pfrface;
260 charmap.
encoding = FT_ENCODING_UNICODE;
266 if ( pfrface->num_charmaps )
267 pfrface->charmap = pfrface->charmaps[0];
330 if ( !
face || gindex >=
face->phy_font.num_chars )
350 gchar =
face->phy_font.chars + gindex;
352 outline->n_points = 0;
353 outline->n_contours = 0;
354 gps_offset =
face->header.gps_section_offset;
358 gps_offset, gchar->gps_offset, gchar->gps_size );
365 FT_Int em_metrics, em_outline;
377 if ( size && pfrsize->metrics.y_ppem < 24 )
381 metrics->horiAdvance = 0;
382 metrics->vertAdvance = 0;
384 advance = gchar->advance;
385 em_metrics =
face->phy_font.metrics_resolution;
386 em_outline =
face->phy_font.outline_resolution;
388 if ( em_metrics != em_outline )
389 advance =
FT_MulDiv( advance, em_outline, em_metrics );
392 metrics->vertAdvance = advance;
394 metrics->horiAdvance = advance;
396 pfrslot->linearHoriAdvance = metrics->horiAdvance;
397 pfrslot->linearVertAdvance = metrics->vertAdvance;
400 metrics->vertBearingX = 0;
401 metrics->vertBearingY = 0;
412 font_matrix.
xx =
face->log_font.matrix[0] << 8;
413 font_matrix.
yx =
face->log_font.matrix[1] << 8;
414 font_matrix.
xy =
face->log_font.matrix[2] << 8;
415 font_matrix.
yy =
face->log_font.matrix[3] << 8;
425 FT_Fixed x_scale = pfrsize->metrics.x_scale;
426 FT_Fixed y_scale = pfrsize->metrics.y_scale;
431 for ( n = 0; n < outline->n_points; n++, vec++ )
438 metrics->horiAdvance =
FT_MulFix( metrics->horiAdvance, x_scale );
439 metrics->vertAdvance =
FT_MulFix( metrics->vertAdvance, y_scale );
445 metrics->width = cbox.
xMax - cbox.
xMin;
446 metrics->height = cbox.
yMax - cbox.
yMin;
447 metrics->horiBearingX = cbox.
xMin;
448 metrics->horiBearingY = cbox.
yMax - metrics->height;
500 for ( ; item; item = item->
next )
502 if ( pair >= item->
pair1 && pair <= item->pair2 )
527 p = base + extra *
size;
547 while ( probe > size )
pfr_header_load(PFR_Header header, FT_Stream stream)
#define FT_LOAD_SBITS_ONLY
FT_BEGIN_HEADER typedef signed long FT_Pos
pfr_face_get_kerning(FT_Face pfrface, FT_UInt glyph1, FT_UInt glyph2, FT_Vector *kerning)
pfr_slot_init(FT_GlyphSlot pfrslot)
#define FT_FACE_FLAG_SCALABLE
return FT_THROW(Missing_Property)
pfr_slot_load_bitmap(PFR_Slot glyph, PFR_Size size, FT_UInt glyph_index)
pfr_header_check(PFR_Header header)
pfr_slot_load(FT_GlyphSlot pfrslot, FT_Size pfrsize, FT_UInt gindex, FT_Int32 load_flags)
pfr_face_init(FT_Stream stream, FT_Face pfrface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
struct PFR_SizeRec_ * PFR_Size
#define FT_FACE_FLAG_FIXED_SIZES
#define TT_PLATFORM_MICROSOFT
pfr_face_done(FT_Face pfrface)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLenum GLuint GLint GLenum face
pfr_log_font_count(FT_Stream stream, FT_UInt32 section_offset, FT_UInt *acount)
typedefFT_BEGIN_HEADER struct FT_GlyphLoaderRec_ * FT_GlyphLoader
#define FT_ERROR(varformat)
pfr_glyph_done(PFR_Glyph glyph)
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
#define FT_FACE_FLAG_VERTICAL
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
#define FT_FACE_FLAG_FIXED_WIDTH
pfr_phy_font_load(PFR_PhyFont phy_font, FT_Stream stream, FT_UInt32 offset, FT_UInt32 size)
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
#define FT_OUTLINE_HIGH_PRECISION
#define FT_FACE_FLAG_HORIZONTAL
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pfr_cmap_class_rec
#define FT_TRACE2(varformat)
struct PFR_SlotRec_ * PFR_Slot
pfr_log_font_load(PFR_LogFont log_font, FT_Stream stream, FT_UInt idx, FT_UInt32 section_offset, FT_Bool size_increment)
GLsizei const GLfloat * value
pfr_slot_done(FT_GlyphSlot pfrslot)
pfr_glyph_init(PFR_Glyph glyph, FT_GlyphLoader loader)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
#define FT_NEW_ARRAY(ptr, count)
#define FT_STREAM_SEEK(position)
FT_MulFix(FT_Long a, FT_Long b)
if(!abbox) return FT_THROW(Invalid_Argument)
#define FT_FACE_MEMORY(x)
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
GLenum const GLfloat * params
FT_BEGIN_HEADER struct FT_Glyph_Metrics_ FT_Glyph_Metrics
#define PFR_NEXT_KPAIR(p)
#define PFR_KERN_INDEX(g1, g2)
pfr_glyph_load(PFR_Glyph glyph, FT_Stream stream, FT_ULong gps_offset, FT_ULong offset, FT_ULong size)
#define FT_NEXT_ULONG(buffer)
#define FT_FACE_FLAG_KERNING
typedefFT_BEGIN_HEADER struct PFR_FaceRec_ * PFR_Face
GLuint GLuint GLsizei count
#define FT_FRAME_ENTER(size)
#define TT_MS_ID_UNICODE_CS
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
#define FT_LOAD_NO_BITMAP
pfr_phy_font_done(PFR_PhyFont phy_font, FT_Memory memory)
FT_UInt outline_resolution
FT_Module_Constructor FT_GLYPH_FORMAT_OUTLINE
#define FT_OUTLINE_REVERSE_FILL
ft_highpow2(FT_UInt32 value)