[pfr] Signature fixes.

This commit is contained in:
Werner Lemberg 2023-05-07 15:57:06 +02:00
parent 3297a7a9e0
commit 19aca9666e
2 changed files with 58 additions and 48 deletions

View File

@ -24,17 +24,18 @@
FT_CALLBACK_DEF( FT_Error )
pfr_cmap_init( PFR_CMap cmap,
pfr_cmap_init( FT_CMap cmap, /* PFR_CMap */
FT_Pointer pointer )
{
FT_Error error = FT_Err_Ok;
PFR_Face face = (PFR_Face)FT_CMAP_FACE( cmap );
PFR_CMap pfrcmap = (PFR_CMap)cmap;
FT_Error error = FT_Err_Ok;
PFR_Face face = (PFR_Face)FT_CMAP_FACE( cmap );
FT_UNUSED( pointer );
cmap->num_chars = face->phy_font.num_chars;
cmap->chars = face->phy_font.chars;
pfrcmap->num_chars = face->phy_font.num_chars;
pfrcmap->chars = face->phy_font.chars;
/* just for safety, check that the character entries are correctly */
/* sorted in increasing character code order */
@ -42,9 +43,9 @@
FT_UInt n;
for ( n = 1; n < cmap->num_chars; n++ )
for ( n = 1; n < pfrcmap->num_chars; n++ )
{
if ( cmap->chars[n - 1].char_code >= cmap->chars[n].char_code )
if ( pfrcmap->chars[n - 1].char_code >= pfrcmap->chars[n].char_code )
{
error = FT_THROW( Invalid_Table );
goto Exit;
@ -58,26 +59,30 @@
FT_CALLBACK_DEF( void )
pfr_cmap_done( PFR_CMap cmap )
pfr_cmap_done( FT_CMap cmap ) /* PFR_CMap */
{
cmap->chars = NULL;
cmap->num_chars = 0;
PFR_CMap pfrcmap = (PFR_CMap)cmap;
pfrcmap->chars = NULL;
pfrcmap->num_chars = 0;
}
FT_CALLBACK_DEF( FT_UInt )
pfr_cmap_char_index( PFR_CMap cmap,
pfr_cmap_char_index( FT_CMap cmap, /* PFR_CMap */
FT_UInt32 char_code )
{
FT_UInt min = 0;
FT_UInt max = cmap->num_chars;
FT_UInt mid = min + ( max - min ) / 2;
PFR_CMap pfrcmap = (PFR_CMap)cmap;
FT_UInt min = 0;
FT_UInt max = pfrcmap->num_chars;
FT_UInt mid = min + ( max - min ) / 2;
PFR_Char gchar;
while ( min < max )
{
gchar = cmap->chars + mid;
gchar = pfrcmap->chars + mid;
if ( gchar->char_code == char_code )
return mid + 1;
@ -97,9 +102,10 @@
FT_CALLBACK_DEF( FT_UInt )
pfr_cmap_char_next( PFR_CMap cmap,
pfr_cmap_char_next( FT_CMap cmap, /* PFR_CMap */
FT_UInt32 *pchar_code )
{
PFR_CMap pfrcmap = (PFR_CMap)cmap;
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code + 1;
@ -107,14 +113,14 @@
Restart:
{
FT_UInt min = 0;
FT_UInt max = cmap->num_chars;
FT_UInt max = pfrcmap->num_chars;
FT_UInt mid = min + ( max - min ) / 2;
PFR_Char gchar;
while ( min < max )
{
gchar = cmap->chars + mid;
gchar = pfrcmap->chars + mid;
if ( gchar->char_code == char_code )
{
@ -143,9 +149,9 @@
/* we didn't find it, but we have a pair just above it */
char_code = 0;
if ( min < cmap->num_chars )
if ( min < pfrcmap->num_chars )
{
gchar = cmap->chars + min;
gchar = pfrcmap->chars + min;
result = min;
if ( result != 0 )
{

View File

@ -449,15 +449,16 @@
/* load bitmap strikes lists */
FT_CALLBACK_DEF( FT_Error )
pfr_extra_item_load_bitmap_info( FT_Byte* p,
FT_Byte* limit,
PFR_PhyFont phy_font )
pfr_extra_item_load_bitmap_info( FT_Byte* p,
FT_Byte* limit,
void* phy_font_ )
{
FT_Memory memory = phy_font->memory;
PFR_Strike strike;
FT_UInt flags0;
FT_UInt n, count, size1;
FT_Error error = FT_Err_Ok;
PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_;
FT_Memory memory = phy_font->memory;
PFR_Strike strike;
FT_UInt flags0;
FT_UInt n, count, size1;
FT_Error error = FT_Err_Ok;
PFR_CHECK( 5 );
@ -549,13 +550,14 @@
* family.
*/
FT_CALLBACK_DEF( FT_Error )
pfr_extra_item_load_font_id( FT_Byte* p,
FT_Byte* limit,
PFR_PhyFont phy_font )
pfr_extra_item_load_font_id( FT_Byte* p,
FT_Byte* limit,
void* phy_font_ )
{
FT_Error error = FT_Err_Ok;
FT_Memory memory = phy_font->memory;
FT_UInt len = (FT_UInt)( limit - p );
PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_;
FT_Error error = FT_Err_Ok;
FT_Memory memory = phy_font->memory;
FT_UInt len = (FT_UInt)( limit - p );
if ( phy_font->font_id )
@ -575,14 +577,15 @@
/* load stem snap tables */
FT_CALLBACK_DEF( FT_Error )
pfr_extra_item_load_stem_snaps( FT_Byte* p,
FT_Byte* limit,
PFR_PhyFont phy_font )
pfr_extra_item_load_stem_snaps( FT_Byte* p,
FT_Byte* limit,
void* phy_font_ )
{
FT_UInt count, num_vert, num_horz;
FT_Int* snaps = NULL;
FT_Error error = FT_Err_Ok;
FT_Memory memory = phy_font->memory;
PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_;
FT_UInt count, num_vert, num_horz;
FT_Int* snaps = NULL;
FT_Error error = FT_Err_Ok;
FT_Memory memory = phy_font->memory;
if ( phy_font->vertical.stem_snaps )
@ -619,10 +622,11 @@
/* load kerning pair data */
FT_CALLBACK_DEF( FT_Error )
pfr_extra_item_load_kerning_pairs( FT_Byte* p,
FT_Byte* limit,
PFR_PhyFont phy_font )
pfr_extra_item_load_kerning_pairs( FT_Byte* p,
FT_Byte* limit,
void* phy_font_ )
{
PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_;
PFR_KernItem item = NULL;
FT_Error error = FT_Err_Ok;
FT_Memory memory = phy_font->memory;
@ -715,10 +719,10 @@
static const PFR_ExtraItemRec pfr_phy_font_extra_items[] =
{
{ 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },
{ 2, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_font_id },
{ 3, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_stem_snaps },
{ 4, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_kerning_pairs },
{ 1, pfr_extra_item_load_bitmap_info },
{ 2, pfr_extra_item_load_font_id },
{ 3, pfr_extra_item_load_stem_snaps },
{ 4, pfr_extra_item_load_kerning_pairs },
{ 0, NULL }
};