[pfr] Formatting, improving comments.
This commit is contained in:
parent
6a19a7d332
commit
4a3fce93c2
|
@ -130,7 +130,7 @@
|
|||
}
|
||||
|
||||
if ( gchar->char_code < char_code )
|
||||
min = mid+1;
|
||||
min = mid + 1;
|
||||
else
|
||||
max = mid;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
if ( outline->n_contours > 0 )
|
||||
first = outline->contours[outline->n_contours - 1];
|
||||
|
||||
/* if the last point falls on the same location than the first one */
|
||||
/* if the last point falls on the same location as the first one */
|
||||
/* we need to delete it */
|
||||
if ( last > first )
|
||||
{
|
||||
|
@ -215,8 +215,10 @@
|
|||
/* check that there is space for a new contour and a new point */
|
||||
error = FT_GLYPHLOADER_CHECK_POINTS( loader, 1, 1 );
|
||||
if ( !error )
|
||||
{
|
||||
/* add new start point */
|
||||
error = pfr_glyph_line_to( glyph, to );
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -331,8 +333,8 @@
|
|||
mask >>= 1;
|
||||
}
|
||||
|
||||
/* XXX: for now we ignore the secondary stroke and edge definitions */
|
||||
/* since we don't want to support native PFR hinting */
|
||||
/* XXX: we ignore the secondary stroke and edge definitions */
|
||||
/* since we don't support native PFR hinting */
|
||||
/* */
|
||||
if ( flags & PFR_GLYPH_EXTRA_ITEMS )
|
||||
{
|
||||
|
@ -446,7 +448,7 @@
|
|||
FT_TRACE7(( " cx#%d", idx ));
|
||||
break;
|
||||
|
||||
case 1: /* 16-bit value */
|
||||
case 1: /* 16-bit absolute value */
|
||||
PFR_CHECK( 2 );
|
||||
cur->x = PFR_NEXT_SHORT( p );
|
||||
FT_TRACE7(( " x.%d", cur->x ));
|
||||
|
@ -580,7 +582,8 @@
|
|||
if ( flags & PFR_GLYPH_EXTRA_ITEMS )
|
||||
{
|
||||
error = pfr_extra_items_skip( &p, limit );
|
||||
if (error) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* we can't rely on the FT_GlyphLoader to load sub-glyphs, because */
|
||||
|
|
|
@ -75,7 +75,8 @@
|
|||
if ( extra->type == item_type )
|
||||
{
|
||||
error = extra->parser( p, p + item_size, item_data );
|
||||
if ( error ) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -183,6 +184,7 @@
|
|||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -206,7 +208,8 @@
|
|||
FT_UInt result = 0;
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( section_offset ) || FT_READ_USHORT( count ) )
|
||||
if ( FT_STREAM_SEEK( section_offset ) ||
|
||||
FT_READ_USHORT( count ) )
|
||||
goto Exit;
|
||||
|
||||
result = count;
|
||||
|
@ -254,13 +257,14 @@
|
|||
FT_UInt local;
|
||||
|
||||
|
||||
if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( size ) )
|
||||
if ( FT_STREAM_SEEK( offset ) ||
|
||||
FT_FRAME_ENTER( size ) )
|
||||
goto Exit;
|
||||
|
||||
p = stream->cursor;
|
||||
limit = p + size;
|
||||
|
||||
PFR_CHECK(13);
|
||||
PFR_CHECK( 13 );
|
||||
|
||||
log_font->matrix[0] = PFR_NEXT_LONG( p );
|
||||
log_font->matrix[1] = PFR_NEXT_LONG( p );
|
||||
|
@ -308,10 +312,11 @@
|
|||
if ( flags & PFR_LOG_EXTRA_ITEMS )
|
||||
{
|
||||
error = pfr_extra_items_skip( &p, limit );
|
||||
if (error) goto Fail;
|
||||
if ( error )
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
PFR_CHECK(5);
|
||||
PFR_CHECK( 5 );
|
||||
log_font->phys_size = PFR_NEXT_USHORT( p );
|
||||
log_font->phys_offset = PFR_NEXT_ULONG( p );
|
||||
if ( size_increment )
|
||||
|
@ -434,12 +439,12 @@
|
|||
}
|
||||
|
||||
|
||||
/* Load font ID. This is a so-called "unique" name that is rather
|
||||
* long and descriptive (like "Tiresias ScreenFont v7.51").
|
||||
/* Load font ID. This is a so-called `unique' name that is rather
|
||||
* long and descriptive (like `Tiresias ScreenFont v7.51').
|
||||
*
|
||||
* Note that a PFR font's family name is contained in an *undocumented*
|
||||
* string of the "auxiliary data" portion of a physical font record. This
|
||||
* may also contain the "real" style name!
|
||||
* string of the `auxiliary data' portion of a physical font record. This
|
||||
* may also contain the `real' style name!
|
||||
*
|
||||
* If no family name is present, the font ID is used instead for the
|
||||
* family.
|
||||
|
@ -612,7 +617,6 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
static const PFR_ExtraItemRec pfr_phy_font_extra_items[] =
|
||||
{
|
||||
{ 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },
|
||||
|
@ -623,7 +627,8 @@
|
|||
};
|
||||
|
||||
|
||||
/* Loads a name from the auxiliary data. Since this extracts undocumented
|
||||
/*
|
||||
* Load a name from the auxiliary data. Since this extracts undocumented
|
||||
* strings from the font file, we need to be careful here.
|
||||
*/
|
||||
static FT_Error
|
||||
|
@ -729,7 +734,8 @@
|
|||
phy_font->kern_items = NULL;
|
||||
phy_font->kern_items_tail = &phy_font->kern_items;
|
||||
|
||||
if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( size ) )
|
||||
if ( FT_STREAM_SEEK( offset ) ||
|
||||
FT_FRAME_ENTER( size ) )
|
||||
goto Exit;
|
||||
|
||||
phy_font->cursor = stream->cursor;
|
||||
|
@ -797,9 +803,8 @@
|
|||
switch ( type )
|
||||
{
|
||||
case 1:
|
||||
/* this seems to correspond to the font's family name,
|
||||
* padded to 16-bits with one zero when necessary
|
||||
*/
|
||||
/* this seems to correspond to the font's family name, padded to */
|
||||
/* an even number of bytes with a zero byte appended if needed */
|
||||
error = pfr_aux_name_load( q, length - 4U, memory,
|
||||
&phy_font->family_name );
|
||||
if ( error )
|
||||
|
@ -817,9 +822,8 @@
|
|||
break;
|
||||
|
||||
case 3:
|
||||
/* this seems to correspond to the font's style name,
|
||||
* padded to 16-bits with one zero when necessary
|
||||
*/
|
||||
/* this seems to correspond to the font's style name, padded to */
|
||||
/* an even number of bytes with a zero byte appended if needed */
|
||||
error = pfr_aux_name_load( q, length - 4U, memory,
|
||||
&phy_font->style_name );
|
||||
if ( error )
|
||||
|
|
|
@ -118,7 +118,9 @@
|
|||
|
||||
/* load the face */
|
||||
error = pfr_log_font_load(
|
||||
&face->log_font, stream, (FT_UInt)( face_index & 0xFFFF ),
|
||||
&face->log_font,
|
||||
stream,
|
||||
(FT_UInt)( face_index & 0xFFFF ),
|
||||
face->header.log_dir_offset,
|
||||
FT_BOOL( face->header.phy_font_max_size_high != 0 ) );
|
||||
if ( error )
|
||||
|
@ -141,7 +143,7 @@
|
|||
|
||||
pfrface->face_flags |= FT_FACE_FLAG_SCALABLE;
|
||||
|
||||
/* if all characters point to the same gps_offset 0, we */
|
||||
/* if gps_offset == 0 for all characters, we */
|
||||
/* assume that the font only contains bitmaps */
|
||||
{
|
||||
FT_UInt nn;
|
||||
|
@ -164,7 +166,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )
|
||||
if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 )
|
||||
pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
if ( phy_font->flags & PFR_PHY_VERTICAL )
|
||||
|
@ -178,7 +180,7 @@
|
|||
if ( phy_font->num_kern_pairs > 0 )
|
||||
pfrface->face_flags |= FT_FACE_FLAG_KERNING;
|
||||
|
||||
/* If no family name was found in the "undocumented" auxiliary
|
||||
/* If no family name was found in the `undocumented' auxiliary
|
||||
* data, use the font ID instead. This sucks but is better than
|
||||
* nothing.
|
||||
*/
|
||||
|
@ -187,7 +189,7 @@
|
|||
pfrface->family_name = phy_font->font_id;
|
||||
|
||||
/* note that the style name can be NULL in certain PFR fonts,
|
||||
* probably meaning "Regular"
|
||||
* probably meaning `Regular'
|
||||
*/
|
||||
pfrface->style_name = phy_font->style_name;
|
||||
|
||||
|
@ -264,13 +266,13 @@
|
|||
error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
|
||||
|
||||
#if 0
|
||||
/* Select default charmap */
|
||||
/* select default charmap */
|
||||
if ( pfrface->num_charmaps )
|
||||
pfrface->charmap = pfrface->charmaps[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check whether we've loaded any kerning pairs */
|
||||
/* check whether we have loaded any kerning pairs */
|
||||
if ( phy_font->num_kern_pairs )
|
||||
pfrface->face_flags |= FT_FACE_FLAG_KERNING;
|
||||
}
|
||||
|
@ -402,7 +404,7 @@
|
|||
pfrslot->linearHoriAdvance = metrics->horiAdvance;
|
||||
pfrslot->linearVertAdvance = metrics->vertAdvance;
|
||||
|
||||
/* make-up vertical metrics(?) */
|
||||
/* make up vertical metrics(?) */
|
||||
metrics->vertBearingX = 0;
|
||||
metrics->vertBearingY = 0;
|
||||
|
||||
|
@ -596,4 +598,5 @@
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -341,8 +341,8 @@
|
|||
}
|
||||
|
||||
|
||||
/* load bitmap metrics. "*padvance" must be set to the default value */
|
||||
/* before calling this function... */
|
||||
/* load bitmap metrics. `*padvance' must be set to the default value */
|
||||
/* before calling this function */
|
||||
/* */
|
||||
static FT_Error
|
||||
pfr_load_bitmap_metrics( FT_Byte** pdata,
|
||||
|
@ -544,7 +544,7 @@
|
|||
|
||||
character = &phys->chars[glyph_index];
|
||||
|
||||
/* Look-up a bitmap strike corresponding to the current */
|
||||
/* look up a bitmap strike corresponding to the current */
|
||||
/* character dimensions */
|
||||
{
|
||||
FT_UInt n;
|
||||
|
@ -555,9 +555,7 @@
|
|||
{
|
||||
if ( strike->x_ppm == (FT_UInt)size->root.metrics.x_ppem &&
|
||||
strike->y_ppm == (FT_UInt)size->root.metrics.y_ppem )
|
||||
{
|
||||
goto Found_Strike;
|
||||
}
|
||||
|
||||
strike++;
|
||||
}
|
||||
|
@ -568,7 +566,7 @@
|
|||
|
||||
Found_Strike:
|
||||
|
||||
/* Now lookup the glyph's position within the file */
|
||||
/* now look up the glyph's position within the file */
|
||||
{
|
||||
FT_UInt char_len;
|
||||
|
||||
|
@ -578,7 +576,7 @@
|
|||
if ( strike->flags & 2 ) char_len += 1;
|
||||
if ( strike->flags & 4 ) char_len += 1;
|
||||
|
||||
/* Access data directly in the frame to speed lookups */
|
||||
/* access data directly in the frame to speed lookups */
|
||||
if ( FT_STREAM_SEEK( phys->bct_offset + strike->bct_offset ) ||
|
||||
FT_FRAME_ENTER( char_len * strike->num_bitmaps ) )
|
||||
goto Exit;
|
||||
|
@ -595,7 +593,7 @@
|
|||
|
||||
if ( gps_size == 0 )
|
||||
{
|
||||
/* Could not find a bitmap program string for this glyph */
|
||||
/* could not find a bitmap program string for this glyph */
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
goto Exit;
|
||||
}
|
||||
|
@ -617,8 +615,8 @@
|
|||
|
||||
glyph->root.linearHoriAdvance = advance;
|
||||
|
||||
/* compute default advance, i.e., scaled advance. This can be */
|
||||
/* overridden in the bitmap header of certain glyphs. */
|
||||
/* compute default advance, i.e., scaled advance; this can be */
|
||||
/* overridden in the bitmap header of certain glyphs */
|
||||
advance = FT_MulDiv( (FT_Fixed)size->root.metrics.x_ppem << 8,
|
||||
character->advance,
|
||||
(FT_Long)phys->metrics_resolution );
|
||||
|
@ -684,7 +682,6 @@
|
|||
|
||||
error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
|
||||
if ( !error )
|
||||
{
|
||||
error = pfr_load_bitmap_bits(
|
||||
p,
|
||||
stream->limit,
|
||||
|
@ -693,7 +690,6 @@
|
|||
&glyph->root.bitmap );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FT_FRAME_EXIT();
|
||||
}
|
||||
|
@ -702,4 +698,5 @@
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
Loading…
Reference in New Issue