* src/cff/cffcmap.c: Signature fixes.

This commit is contained in:
Werner Lemberg 2023-05-07 09:14:27 +02:00
parent 563f401127
commit 4a28ff3db8
1 changed files with 46 additions and 35 deletions

View File

@ -32,9 +32,10 @@
/*************************************************************************/
FT_CALLBACK_DEF( FT_Error )
cff_cmap_encoding_init( CFF_CMapStd cmap,
FT_Pointer pointer )
cff_cmap_encoding_init( FT_CMap cmap,
FT_Pointer pointer )
{
CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
CFF_Font cff = (CFF_Font)face->extra.data;
CFF_Encoding encoding = &cff->encoding;
@ -42,44 +43,49 @@
FT_UNUSED( pointer );
cmap->gids = encoding->codes;
cffcmap->gids = encoding->codes;
return 0;
}
FT_CALLBACK_DEF( void )
cff_cmap_encoding_done( CFF_CMapStd cmap )
cff_cmap_encoding_done( FT_CMap cmap )
{
cmap->gids = NULL;
CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
cffcmap->gids = NULL;
}
FT_CALLBACK_DEF( FT_UInt )
cff_cmap_encoding_char_index( CFF_CMapStd cmap,
FT_UInt32 char_code )
cff_cmap_encoding_char_index( FT_CMap cmap,
FT_UInt32 char_code )
{
FT_UInt result = 0;
CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
FT_UInt result = 0;
if ( char_code < 256 )
result = cmap->gids[char_code];
result = cffcmap->gids[char_code];
return result;
}
FT_CALLBACK_DEF( FT_UInt )
cff_cmap_encoding_char_next( CFF_CMapStd cmap,
FT_UInt32 *pchar_code )
cff_cmap_encoding_char_next( FT_CMap cmap,
FT_UInt32 *pchar_code )
{
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code;
CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code;
while ( char_code < 255 )
{
result = cmap->gids[++char_code];
result = cffcmap->gids[++char_code];
if ( result )
{
*pchar_code = char_code;
@ -118,9 +124,10 @@
/*************************************************************************/
FT_CALLBACK_DEF( const char* )
cff_sid_to_glyph_name( TT_Face face,
cff_sid_to_glyph_name( void* face_, /* TT_Face */
FT_UInt idx )
{
TT_Face face = (TT_Face)face_;
CFF_Font cff = (CFF_Font)face->extra.data;
CFF_Charset charset = &cff->charset;
FT_UInt sid = charset->sids[idx];
@ -131,14 +138,15 @@
FT_CALLBACK_DEF( FT_Error )
cff_cmap_unicode_init( PS_Unicodes unicodes,
cff_cmap_unicode_init( FT_CMap cmap, /* PS_Unicodes */
FT_Pointer pointer )
{
TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
FT_Memory memory = FT_FACE_MEMORY( face );
CFF_Font cff = (CFF_Font)face->extra.data;
CFF_Charset charset = &cff->charset;
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
PS_Unicodes unicodes = (PS_Unicodes)cmap;
TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
FT_Memory memory = FT_FACE_MEMORY( face );
CFF_Font cff = (CFF_Font)face->extra.data;
CFF_Charset charset = &cff->charset;
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
FT_UNUSED( pointer );
@ -154,17 +162,18 @@
return psnames->unicodes_init( memory,
unicodes,
cff->num_glyphs,
(PS_GetGlyphNameFunc)&cff_sid_to_glyph_name,
&cff_sid_to_glyph_name,
(PS_FreeGlyphNameFunc)NULL,
(FT_Pointer)face );
}
FT_CALLBACK_DEF( void )
cff_cmap_unicode_done( PS_Unicodes unicodes )
cff_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 );
@ -173,12 +182,13 @@
FT_CALLBACK_DEF( FT_UInt )
cff_cmap_unicode_char_index( PS_Unicodes unicodes,
FT_UInt32 char_code )
cff_cmap_unicode_char_index( FT_CMap cmap, /* PS_Unicodes */
FT_UInt32 char_code )
{
TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
CFF_Font cff = (CFF_Font)face->extra.data;
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
PS_Unicodes unicodes = (PS_Unicodes)cmap;
TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
CFF_Font cff = (CFF_Font)face->extra.data;
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
return psnames->unicodes_char_index( unicodes, char_code );
@ -186,12 +196,13 @@
FT_CALLBACK_DEF( FT_UInt )
cff_cmap_unicode_char_next( PS_Unicodes unicodes,
FT_UInt32 *pchar_code )
cff_cmap_unicode_char_next( FT_CMap cmap, /* PS_Unicodes */
FT_UInt32 *pchar_code )
{
TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
CFF_Font cff = (CFF_Font)face->extra.data;
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
PS_Unicodes unicodes = (PS_Unicodes)cmap;
TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
CFF_Font cff = (CFF_Font)face->extra.data;
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
return psnames->unicodes_char_next( unicodes, pchar_code );