/src/freetype/src/base/ftcid.c

https://bitbucket.org/cabalistic/ogredeps/ · C · 117 lines · 65 code · 35 blank · 17 comment · 14 complexity · a975771fbd089848297831ffd496e801 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ftcid.c */
  4. /* */
  5. /* FreeType API for accessing CID font information. */
  6. /* */
  7. /* Copyright 2007, 2009 by Derek Clegg, Michael Toftdal. */
  8. /* */
  9. /* This file is part of the FreeType project, and may only be used, */
  10. /* modified, and distributed under the terms of the FreeType project */
  11. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  12. /* this file you indicate that you have read the license and */
  13. /* understand and accept it fully. */
  14. /* */
  15. /***************************************************************************/
  16. #include <ft2build.h>
  17. #include FT_CID_H
  18. #include FT_INTERNAL_OBJECTS_H
  19. #include FT_SERVICE_CID_H
  20. /* documentation is in ftcid.h */
  21. FT_EXPORT_DEF( FT_Error )
  22. FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,
  23. const char* *registry,
  24. const char* *ordering,
  25. FT_Int *supplement)
  26. {
  27. FT_Error error;
  28. const char* r = NULL;
  29. const char* o = NULL;
  30. FT_Int s = 0;
  31. error = FT_Err_Invalid_Argument;
  32. if ( face )
  33. {
  34. FT_Service_CID service;
  35. FT_FACE_FIND_SERVICE( face, service, CID );
  36. if ( service && service->get_ros )
  37. error = service->get_ros( face, &r, &o, &s );
  38. }
  39. if ( registry )
  40. *registry = r;
  41. if ( ordering )
  42. *ordering = o;
  43. if ( supplement )
  44. *supplement = s;
  45. return error;
  46. }
  47. FT_EXPORT_DEF( FT_Error )
  48. FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,
  49. FT_Bool *is_cid )
  50. {
  51. FT_Error error = FT_Err_Invalid_Argument;
  52. FT_Bool ic = 0;
  53. if ( face )
  54. {
  55. FT_Service_CID service;
  56. FT_FACE_FIND_SERVICE( face, service, CID );
  57. if ( service && service->get_is_cid )
  58. error = service->get_is_cid( face, &ic);
  59. }
  60. if ( is_cid )
  61. *is_cid = ic;
  62. return error;
  63. }
  64. FT_EXPORT_DEF( FT_Error )
  65. FT_Get_CID_From_Glyph_Index( FT_Face face,
  66. FT_UInt glyph_index,
  67. FT_UInt *cid )
  68. {
  69. FT_Error error = FT_Err_Invalid_Argument;
  70. FT_UInt c = 0;
  71. if ( face )
  72. {
  73. FT_Service_CID service;
  74. FT_FACE_FIND_SERVICE( face, service, CID );
  75. if ( service && service->get_cid_from_glyph_index )
  76. error = service->get_cid_from_glyph_index( face, glyph_index, &c);
  77. }
  78. if ( cid )
  79. *cid = c;
  80. return error;
  81. }
  82. /* END */