/src/freetype/src/cff/cffparse.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 106 lines · 57 code · 31 blank · 18 comment · 0 complexity · 9b08364d74c4fab9e3ae587d202f805e MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* cffparse.h */
  4. /* */
  5. /* CFF token stream parser (specification) */
  6. /* */
  7. /* Copyright 1996-2003, 2011 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. #ifndef __CFF_PARSE_H__
  18. #define __CFF_PARSE_H__
  19. #include <ft2build.h>
  20. #include "cfftypes.h"
  21. #include FT_INTERNAL_OBJECTS_H
  22. FT_BEGIN_HEADER
  23. #define CFF_MAX_STACK_DEPTH 96
  24. #define CFF_CODE_TOPDICT 0x1000
  25. #define CFF_CODE_PRIVATE 0x2000
  26. typedef struct CFF_ParserRec_
  27. {
  28. FT_Library library;
  29. FT_Byte* start;
  30. FT_Byte* limit;
  31. FT_Byte* cursor;
  32. FT_Byte* stack[CFF_MAX_STACK_DEPTH + 1];
  33. FT_Byte** top;
  34. FT_UInt object_code;
  35. void* object;
  36. } CFF_ParserRec, *CFF_Parser;
  37. FT_LOCAL( void )
  38. cff_parser_init( CFF_Parser parser,
  39. FT_UInt code,
  40. void* object,
  41. FT_Library library);
  42. FT_LOCAL( FT_Error )
  43. cff_parser_run( CFF_Parser parser,
  44. FT_Byte* start,
  45. FT_Byte* limit );
  46. enum
  47. {
  48. cff_kind_none = 0,
  49. cff_kind_num,
  50. cff_kind_fixed,
  51. cff_kind_fixed_thousand,
  52. cff_kind_string,
  53. cff_kind_bool,
  54. cff_kind_delta,
  55. cff_kind_callback,
  56. cff_kind_max /* do not remove */
  57. };
  58. /* now generate handlers for the most simple fields */
  59. typedef FT_Error (*CFF_Field_Reader)( CFF_Parser parser );
  60. typedef struct CFF_Field_Handler_
  61. {
  62. int kind;
  63. int code;
  64. FT_UInt offset;
  65. FT_Byte size;
  66. CFF_Field_Reader reader;
  67. FT_UInt array_max;
  68. FT_UInt count_offset;
  69. #ifdef FT_DEBUG_LEVEL_TRACE
  70. const char* id;
  71. #endif
  72. } CFF_Field_Handler;
  73. FT_END_HEADER
  74. #endif /* __CFF_PARSE_H__ */
  75. /* END */