| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* psmodule.c */ | 3 /* psmodule.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* PSNames module implementation (body). */ | 5 /* PSNames module implementation (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008 by */ | 7 /* Copyright 1996-2003, 2005-2008, 2012, 2013 by */ |
| 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
| 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
| 14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
| 15 /* */ | 15 /* */ |
| 16 /***************************************************************************/ | 16 /***************************************************************************/ |
| 17 | 17 |
| 18 | 18 |
| 19 #include <ft2build.h> | 19 #include <ft2build.h> |
| 20 #include FT_INTERNAL_DEBUG_H |
| 20 #include FT_INTERNAL_OBJECTS_H | 21 #include FT_INTERNAL_OBJECTS_H |
| 21 #include FT_SERVICE_POSTSCRIPT_CMAPS_H | 22 #include FT_SERVICE_POSTSCRIPT_CMAPS_H |
| 22 | 23 |
| 23 #include "psmodule.h" | 24 #include "psmodule.h" |
| 24 #include "pstables.h" | 25 #include "pstables.h" |
| 25 | 26 |
| 26 #include "psnamerr.h" | 27 #include "psnamerr.h" |
| 27 #include "pspic.h" | 28 #include "pspic.h" |
| 28 | 29 |
| 29 | 30 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 363 } |
| 363 | 364 |
| 364 /* now compress the table a bit */ | 365 /* now compress the table a bit */ |
| 365 count = (FT_UInt)( map - table->maps ); | 366 count = (FT_UInt)( map - table->maps ); |
| 366 | 367 |
| 367 if ( count == 0 ) | 368 if ( count == 0 ) |
| 368 { | 369 { |
| 369 /* No unicode chars here! */ | 370 /* No unicode chars here! */ |
| 370 FT_FREE( table->maps ); | 371 FT_FREE( table->maps ); |
| 371 if ( !error ) | 372 if ( !error ) |
| 372 error = PSnames_Err_No_Unicode_Glyph_Name; | 373 error = FT_THROW( No_Unicode_Glyph_Name ); |
| 373 } | 374 } |
| 374 else | 375 else |
| 375 { | 376 { |
| 376 /* Reallocate if the number of used entries is much smaller. */ | 377 /* Reallocate if the number of used entries is much smaller. */ |
| 377 if ( count < num_glyphs / 2 ) | 378 if ( count < num_glyphs / 2 ) |
| 378 { | 379 { |
| 379 (void)FT_RENEW_ARRAY( table->maps, num_glyphs, count ); | 380 (void)FT_RENEW_ARRAY( table->maps, num_glyphs, count ); |
| 380 error = PSnames_Err_Ok; | 381 error = FT_Err_Ok; |
| 381 } | 382 } |
| 382 | 383 |
| 383 /* Sort the table in increasing order of unicode values, */ | 384 /* Sort the table in increasing order of unicode values, */ |
| 384 /* taking care of glyph variants. */ | 385 /* taking care of glyph variants. */ |
| 385 ft_qsort( table->maps, count, sizeof ( PS_UniMap ), | 386 ft_qsort( table->maps, count, sizeof ( PS_UniMap ), |
| 386 compare_uni_maps ); | 387 compare_uni_maps ); |
| 387 } | 388 } |
| 388 | 389 |
| 389 table->num_maps = count; | 390 table->num_maps = count; |
| 390 } | 391 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 ps_get_standard_strings( FT_UInt sid ) | 515 ps_get_standard_strings( FT_UInt sid ) |
| 515 { | 516 { |
| 516 if ( sid >= FT_NUM_SID_NAMES ) | 517 if ( sid >= FT_NUM_SID_NAMES ) |
| 517 return 0; | 518 return 0; |
| 518 | 519 |
| 519 return ft_standard_glyph_names + ft_sid_names[sid]; | 520 return ft_standard_glyph_names + ft_sid_names[sid]; |
| 520 } | 521 } |
| 521 | 522 |
| 522 | 523 |
| 523 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST | 524 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST |
| 524 FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface, | 525 |
| 526 FT_DEFINE_SERVICE_PSCMAPSREC( |
| 527 pscmaps_interface, |
| 525 (PS_Unicode_ValueFunc) ps_unicode_value, | 528 (PS_Unicode_ValueFunc) ps_unicode_value, |
| 526 (PS_Unicodes_InitFunc) ps_unicodes_init, | 529 (PS_Unicodes_InitFunc) ps_unicodes_init, |
| 527 (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index, | 530 (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index, |
| 528 (PS_Unicodes_CharNextFunc) ps_unicodes_char_next, | 531 (PS_Unicodes_CharNextFunc) ps_unicodes_char_next, |
| 529 | 532 |
| 530 (PS_Macintosh_NameFunc) ps_get_macintosh_name, | 533 (PS_Macintosh_NameFunc) ps_get_macintosh_name, |
| 531 (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, | 534 (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, |
| 532 | 535 |
| 533 t1_standard_encoding, | 536 t1_standard_encoding, |
| 534 t1_expert_encoding | 537 t1_expert_encoding ) |
| 535 ) | |
| 536 | 538 |
| 537 #else | 539 #else |
| 538 | 540 |
| 539 FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface, | 541 FT_DEFINE_SERVICE_PSCMAPSREC( |
| 540 0, | 542 pscmaps_interface, |
| 541 0, | 543 NULL, |
| 542 0, | 544 NULL, |
| 543 0, | 545 NULL, |
| 546 NULL, |
| 544 | 547 |
| 545 (PS_Macintosh_NameFunc) ps_get_macintosh_name, | 548 (PS_Macintosh_NameFunc) ps_get_macintosh_name, |
| 546 (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, | 549 (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, |
| 547 | 550 |
| 548 t1_standard_encoding, | 551 t1_standard_encoding, |
| 549 t1_expert_encoding | 552 t1_expert_encoding ) |
| 550 ) | |
| 551 | 553 |
| 552 #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ | 554 #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ |
| 553 | 555 |
| 554 | 556 |
| 555 FT_DEFINE_SERVICEDESCREC1(pscmaps_services, | 557 FT_DEFINE_SERVICEDESCREC1( |
| 556 FT_SERVICE_ID_POSTSCRIPT_CMAPS, &FT_PSCMAPS_INTERFACE_GET | 558 pscmaps_services, |
| 557 ) | 559 FT_SERVICE_ID_POSTSCRIPT_CMAPS, &PSCMAPS_INTERFACE_GET ) |
| 558 | |
| 559 | |
| 560 | 560 |
| 561 | 561 |
| 562 static FT_Pointer | 562 static FT_Pointer |
| 563 psnames_get_service( FT_Module module, | 563 psnames_get_service( FT_Module module, |
| 564 const char* service_id ) | 564 const char* service_id ) |
| 565 { | 565 { |
| 566 /* FT_PSCMAPS_SERVICES_GET derefers `library' in PIC mode */ | 566 /* PSCMAPS_SERVICES_GET derefers `library' in PIC mode */ |
| 567 #ifdef FT_CONFIG_OPTION_PIC | 567 #ifdef FT_CONFIG_OPTION_PIC |
| 568 FT_Library library; | 568 FT_Library library; |
| 569 | 569 |
| 570 | 570 |
| 571 if ( !module ) | 571 if ( !module ) |
| 572 return NULL; | 572 return NULL; |
| 573 library = module->library; | 573 library = module->library; |
| 574 if ( !library ) | 574 if ( !library ) |
| 575 return NULL; | 575 return NULL; |
| 576 #else | 576 #else |
| 577 FT_UNUSED( module ); | 577 FT_UNUSED( module ); |
| 578 #endif | 578 #endif |
| 579 | 579 |
| 580 return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id ); | 580 return ft_service_list_lookup( PSCMAPS_SERVICES_GET, service_id ); |
| 581 } | 581 } |
| 582 | 582 |
| 583 #endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ | 583 #endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ |
| 584 | 584 |
| 585 | 585 |
| 586 #ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES | 586 #ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES |
| 587 #define PUT_PS_NAMES_SERVICE(a) 0 | 587 #define PUT_PS_NAMES_SERVICE( a ) NULL |
| 588 #else | 588 #else |
| 589 #define PUT_PS_NAMES_SERVICE(a) a | 589 #define PUT_PS_NAMES_SERVICE( a ) a |
| 590 #endif | 590 #endif |
| 591 | 591 |
| 592 FT_DEFINE_MODULE(psnames_module_class, | 592 FT_DEFINE_MODULE( |
| 593 psnames_module_class, |
| 593 | 594 |
| 594 0, /* this is not a font driver, nor a renderer */ | 595 0, /* this is not a font driver, nor a renderer */ |
| 595 sizeof ( FT_ModuleRec ), | 596 sizeof ( FT_ModuleRec ), |
| 596 | 597 |
| 597 "psnames", /* driver name */ | 598 "psnames", /* driver name */ |
| 598 0x10000L, /* driver version */ | 599 0x10000L, /* driver version */ |
| 599 0x20000L, /* driver requires FreeType 2 or above */ | 600 0x20000L, /* driver requires FreeType 2 or above */ |
| 600 | 601 |
| 601 PUT_PS_NAMES_SERVICE((void*)&FT_PSCMAPS_INTERFACE_GET), /* module specific
interface */ | 602 PUT_PS_NAMES_SERVICE( |
| 602 (FT_Module_Constructor)0, | 603 (void*)&PSCMAPS_INTERFACE_GET ), /* module specific interface */ |
| 603 (FT_Module_Destructor) 0, | 604 (FT_Module_Constructor)NULL, |
| 604 (FT_Module_Requester) PUT_PS_NAMES_SERVICE(psnames_get_service) | 605 (FT_Module_Destructor) NULL, |
| 605 ) | 606 (FT_Module_Requester) PUT_PS_NAMES_SERVICE( psnames_get_service ) ) |
| 606 | |
| 607 | 607 |
| 608 | 608 |
| 609 /* END */ | 609 /* END */ |
| OLD | NEW |