* src/psaux/t1cmap.c: Signature fixes.

This commit is contained in:
Werner Lemberg 2023-05-08 06:46:55 +02:00
parent 968fc281ac
commit bd37b84718
1 changed files with 77 additions and 58 deletions

View File

@ -50,8 +50,11 @@
FT_CALLBACK_DEF( void )
t1_cmap_std_done( T1_CMapStd cmap )
t1_cmap_std_done( FT_CMap cmap_ ) /* T1_CMapStd */
{
T1_CMapStd cmap = (T1_CMapStd)cmap_;
cmap->num_glyphs = 0;
cmap->glyph_names = NULL;
cmap->sid_to_string = NULL;
@ -60,10 +63,11 @@
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_std_char_index( T1_CMapStd cmap,
FT_UInt32 char_code )
t1_cmap_std_char_index( FT_CMap cmap, /* T1_CMapStd */
FT_UInt32 char_code )
{
FT_UInt result = 0;
T1_CMapStd t1cmap = (T1_CMapStd)cmap;
FT_UInt result = 0;
if ( char_code < 256 )
@ -73,13 +77,13 @@
/* convert character code to Adobe SID string */
code = cmap->code_to_sid[char_code];
glyph_name = cmap->sid_to_string( code );
code = t1cmap->code_to_sid[char_code];
glyph_name = t1cmap->sid_to_string( code );
/* look for the corresponding glyph name */
for ( n = 0; n < cmap->num_glyphs; n++ )
for ( n = 0; n < t1cmap->num_glyphs; n++ )
{
const char* gname = cmap->glyph_names[n];
const char* gname = t1cmap->glyph_names[n];
if ( gname && gname[0] == glyph_name[0] &&
@ -96,8 +100,8 @@
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_std_char_next( T1_CMapStd cmap,
FT_UInt32 *pchar_code )
t1_cmap_std_char_next( FT_CMap cmap,
FT_UInt32 *pchar_code )
{
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code + 1;
@ -120,13 +124,14 @@
FT_CALLBACK_DEF( FT_Error )
t1_cmap_standard_init( T1_CMapStd cmap,
t1_cmap_standard_init( FT_CMap cmap, /* T1_CMapStd */
FT_Pointer pointer )
{
T1_CMapStd t1cmap = (T1_CMapStd)cmap;
FT_UNUSED( pointer );
t1_cmap_std_init( cmap, 0 );
t1_cmap_std_init( t1cmap, 0 );
return 0;
}
@ -150,13 +155,14 @@
FT_CALLBACK_DEF( FT_Error )
t1_cmap_expert_init( T1_CMapStd cmap,
t1_cmap_expert_init( FT_CMap cmap, /* T1_CMapStd */
FT_Pointer pointer )
{
T1_CMapStd t1cmap = (T1_CMapStd)cmap;
FT_UNUSED( pointer );
t1_cmap_std_init( cmap, 1 );
t1_cmap_std_init( t1cmap, 1 );
return 0;
}
@ -188,20 +194,21 @@
FT_CALLBACK_DEF( FT_Error )
t1_cmap_custom_init( T1_CMapCustom cmap,
FT_Pointer pointer )
t1_cmap_custom_init( FT_CMap cmap, /* T1_CMapCustom */
FT_Pointer pointer )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
T1_Encoding encoding = &face->type1.encoding;
T1_CMapCustom t1cmap = (T1_CMapCustom)cmap;
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
T1_Encoding encoding = &face->type1.encoding;
FT_UNUSED( pointer );
cmap->first = (FT_UInt)encoding->code_first;
cmap->count = (FT_UInt)encoding->code_last - cmap->first;
cmap->indices = encoding->char_index;
t1cmap->first = (FT_UInt)encoding->code_first;
t1cmap->count = (FT_UInt)encoding->code_last - t1cmap->first;
t1cmap->indices = encoding->char_index;
FT_ASSERT( cmap->indices );
FT_ASSERT( t1cmap->indices );
FT_ASSERT( encoding->code_first <= encoding->code_last );
return 0;
@ -209,45 +216,50 @@
FT_CALLBACK_DEF( void )
t1_cmap_custom_done( T1_CMapCustom cmap )
t1_cmap_custom_done( FT_CMap cmap ) /* T1_CMapCustom */
{
cmap->indices = NULL;
cmap->first = 0;
cmap->count = 0;
T1_CMapCustom t1cmap = (T1_CMapCustom)cmap;
t1cmap->indices = NULL;
t1cmap->first = 0;
t1cmap->count = 0;
}
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_custom_char_index( T1_CMapCustom cmap,
FT_UInt32 char_code )
t1_cmap_custom_char_index( FT_CMap cmap, /* T1_CMapCustom */
FT_UInt32 char_code )
{
FT_UInt result = 0;
T1_CMapCustom t1cmap = (T1_CMapCustom)cmap;
FT_UInt result = 0;
if ( ( char_code >= cmap->first ) &&
( char_code < ( cmap->first + cmap->count ) ) )
result = cmap->indices[char_code];
if ( char_code >= t1cmap->first &&
char_code < ( t1cmap->first + t1cmap->count ) )
result = t1cmap->indices[char_code];
return result;
}
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_custom_char_next( T1_CMapCustom cmap,
FT_UInt32 *pchar_code )
t1_cmap_custom_char_next( FT_CMap cmap, /* T1_CMapCustom */
FT_UInt32 *pchar_code )
{
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code;
T1_CMapCustom t1cmap = (T1_CMapCustom)cmap;
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code;
char_code++;
if ( char_code < cmap->first )
char_code = cmap->first;
if ( char_code < t1cmap->first )
char_code = t1cmap->first;
for ( ; char_code < ( cmap->first + cmap->count ); char_code++ )
for ( ; char_code < ( t1cmap->first + t1cmap->count ); char_code++ )
{
result = cmap->indices[char_code];
result = t1cmap->indices[char_code];
if ( result != 0 )
goto Exit;
}
@ -287,20 +299,24 @@
/*************************************************************************/
FT_CALLBACK_DEF( const char * )
psaux_get_glyph_name( T1_Face face,
psaux_get_glyph_name( void* face_,
FT_UInt idx )
{
T1_Face face = (T1_Face)face_;
return face->type1.glyph_names[idx];
}
FT_CALLBACK_DEF( FT_Error )
t1_cmap_unicode_init( PS_Unicodes unicodes,
FT_Pointer pointer )
t1_cmap_unicode_init( FT_CMap cmap, /* PS_Unicodes */
FT_Pointer pointer )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
FT_Memory memory = FT_FACE_MEMORY( face );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
PS_Unicodes unicodes = (PS_Unicodes)cmap;
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
FT_Memory memory = FT_FACE_MEMORY( face );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
FT_UNUSED( pointer );
@ -311,17 +327,18 @@
return psnames->unicodes_init( memory,
unicodes,
(FT_UInt)face->type1.num_glyphs,
(PS_GetGlyphNameFunc)&psaux_get_glyph_name,
&psaux_get_glyph_name,
(PS_FreeGlyphNameFunc)NULL,
(FT_Pointer)face );
}
FT_CALLBACK_DEF( void )
t1_cmap_unicode_done( PS_Unicodes unicodes )
t1_cmap_unicode_done( FT_CMap cmap ) /* PS_Unicodes */
{
FT_Face face = FT_CMAP_FACE( unicodes );
FT_Memory memory = FT_FACE_MEMORY( face );
PS_Unicodes unicodes = (PS_Unicodes)cmap;
FT_Face face = FT_CMAP_FACE( cmap );
FT_Memory memory = FT_FACE_MEMORY( face );
FT_FREE( unicodes->maps );
@ -330,11 +347,12 @@
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_unicode_char_index( PS_Unicodes unicodes,
FT_UInt32 char_code )
t1_cmap_unicode_char_index( FT_CMap cmap, /* PS_Unicodes */
FT_UInt32 char_code )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
PS_Unicodes unicodes = (PS_Unicodes)cmap;
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
return psnames->unicodes_char_index( unicodes, char_code );
@ -342,11 +360,12 @@
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_unicode_char_next( PS_Unicodes unicodes,
FT_UInt32 *pchar_code )
t1_cmap_unicode_char_next( FT_CMap cmap, /* PS_Unicodes */
FT_UInt32 *pchar_code )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
PS_Unicodes unicodes = (PS_Unicodes)cmap;
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
return psnames->unicodes_char_next( unicodes, pchar_code );