1 /***************************************************************************/ 2 /* */ 3 /* t1cmap.c */ 4 /* */ 5 /* Type 1 character map support (body). */ 6 /* */ 7 /* Copyright 2002-2018 by */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 /* */ 10 /* This file is part of the FreeType project, and may only be used, */ 11 /* modified, and distributed under the terms of the FreeType project */ 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 /* this file you indicate that you have read the license and */ 14 /* understand and accept it fully. */ 15 /* */ 16 /***************************************************************************/ 17 18 19 #include "t1cmap.h" 20 21 #include FT_INTERNAL_DEBUG_H 22 23 #include "psauxerr.h" 24 25 26 /*************************************************************************/ 27 /*************************************************************************/ 28 /***** *****/ 29 /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/ 30 /***** *****/ 31 /*************************************************************************/ 32 /*************************************************************************/ 33 34 static void 35 t1_cmap_std_init( T1_CMapStd cmap, 36 FT_Int is_expert ) 287 /*************************************************************************/ 288 289 FT_CALLBACK_DEF( const char * ) 290 psaux_get_glyph_name( T1_Face face, 291 FT_UInt idx ) 292 { 293 return face->type1.glyph_names[idx]; 294 } 295 296 297 FT_CALLBACK_DEF( FT_Error ) 298 t1_cmap_unicode_init( PS_Unicodes unicodes, 299 FT_Pointer pointer ) 300 { 301 T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes ); 302 FT_Memory memory = FT_FACE_MEMORY( face ); 303 FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; 304 305 FT_UNUSED( pointer ); 306 307 308 return psnames->unicodes_init( memory, 309 unicodes, 310 (FT_UInt)face->type1.num_glyphs, 311 (PS_GetGlyphNameFunc)&psaux_get_glyph_name, 312 (PS_FreeGlyphNameFunc)NULL, 313 (FT_Pointer)face ); 314 } 315 316 317 FT_CALLBACK_DEF( void ) 318 t1_cmap_unicode_done( PS_Unicodes unicodes ) 319 { 320 FT_Face face = FT_CMAP_FACE( unicodes ); 321 FT_Memory memory = FT_FACE_MEMORY( face ); 322 323 324 FT_FREE( unicodes->maps ); 325 unicodes->num_maps = 0; 326 } | 1 /**************************************************************************** 2 * 3 * t1cmap.c 4 * 5 * Type 1 character map support (body). 6 * 7 * Copyright (C) 2002-2019 by 8 * David Turner, Robert Wilhelm, and Werner Lemberg. 9 * 10 * This file is part of the FreeType project, and may only be used, 11 * modified, and distributed under the terms of the FreeType project 12 * license, LICENSE.TXT. By continuing to use, modify, or distribute 13 * this file you indicate that you have read the license and 14 * understand and accept it fully. 15 * 16 */ 17 18 19 #include "t1cmap.h" 20 21 #include FT_INTERNAL_DEBUG_H 22 23 #include "psauxerr.h" 24 25 26 /*************************************************************************/ 27 /*************************************************************************/ 28 /***** *****/ 29 /***** TYPE1 STANDARD (AND EXPERT) ENCODING CMAPS *****/ 30 /***** *****/ 31 /*************************************************************************/ 32 /*************************************************************************/ 33 34 static void 35 t1_cmap_std_init( T1_CMapStd cmap, 36 FT_Int is_expert ) 287 /*************************************************************************/ 288 289 FT_CALLBACK_DEF( const char * ) 290 psaux_get_glyph_name( T1_Face face, 291 FT_UInt idx ) 292 { 293 return face->type1.glyph_names[idx]; 294 } 295 296 297 FT_CALLBACK_DEF( FT_Error ) 298 t1_cmap_unicode_init( PS_Unicodes unicodes, 299 FT_Pointer pointer ) 300 { 301 T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes ); 302 FT_Memory memory = FT_FACE_MEMORY( face ); 303 FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; 304 305 FT_UNUSED( pointer ); 306 307 308 if ( !psnames->unicodes_init ) 309 return FT_THROW( Unimplemented_Feature ); 310 311 return psnames->unicodes_init( memory, 312 unicodes, 313 (FT_UInt)face->type1.num_glyphs, 314 (PS_GetGlyphNameFunc)&psaux_get_glyph_name, 315 (PS_FreeGlyphNameFunc)NULL, 316 (FT_Pointer)face ); 317 } 318 319 320 FT_CALLBACK_DEF( void ) 321 t1_cmap_unicode_done( PS_Unicodes unicodes ) 322 { 323 FT_Face face = FT_CMAP_FACE( unicodes ); 324 FT_Memory memory = FT_FACE_MEMORY( face ); 325 326 327 FT_FREE( unicodes->maps ); 328 unicodes->num_maps = 0; 329 } |