t1parse.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /***************************************************************************/
  2. /* */
  3. /* t1parse.h */
  4. /* */
  5. /* Type 1 parser (specification). */
  6. /* */
  7. /* Copyright 1996-2001, 2002 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 __T1PARSE_H__
  18. #define __T1PARSE_H__
  19. #include <ft2build.h>
  20. #include FT_INTERNAL_TYPE1_TYPES_H
  21. #include FT_INTERNAL_STREAM_H
  22. FT_BEGIN_HEADER
  23. /*************************************************************************/
  24. /* */
  25. /* <Struct> */
  26. /* T1_ParserRec */
  27. /* */
  28. /* <Description> */
  29. /* A PS_ParserRec is an object used to parse a Type 1 fonts very */
  30. /* quickly. */
  31. /* */
  32. /* <Fields> */
  33. /* root :: The root parser. */
  34. /* */
  35. /* stream :: The current input stream. */
  36. /* */
  37. /* base_dict :: A pointer to the top-level dictionary. */
  38. /* */
  39. /* base_len :: The length in bytes of the top dictionary. */
  40. /* */
  41. /* private_dict :: A pointer to the private dictionary. */
  42. /* */
  43. /* private_len :: The length in bytes of the private dictionary. */
  44. /* */
  45. /* in_pfb :: A boolean. Indicates that we are handling a PFB */
  46. /* file. */
  47. /* */
  48. /* in_memory :: A boolean. Indicates a memory-based stream. */
  49. /* */
  50. /* single_block :: A boolean. Indicates that the private dictionary */
  51. /* is stored in lieu of the base dictionary. */
  52. /* */
  53. typedef struct T1_ParserRec_
  54. {
  55. PS_ParserRec root;
  56. FT_Stream stream;
  57. FT_Byte* base_dict;
  58. FT_Long base_len;
  59. FT_Byte* private_dict;
  60. FT_Long private_len;
  61. FT_Byte in_pfb;
  62. FT_Byte in_memory;
  63. FT_Byte single_block;
  64. } T1_ParserRec, *T1_Parser;
  65. #define T1_Add_Table( p, i, o, l ) (p)->funcs.add( (p), i, o, l )
  66. #define T1_Done_Table( p ) \
  67. do \
  68. { \
  69. if ( (p)->funcs.done ) \
  70. (p)->funcs.done( p ); \
  71. } while ( 0 )
  72. #define T1_Release_Table( p ) \
  73. do \
  74. { \
  75. if ( (p)->funcs.release ) \
  76. (p)->funcs.release( p ); \
  77. } while ( 0 )
  78. #define T1_Skip_Spaces( p ) (p)->root.funcs.skip_spaces( &(p)->root )
  79. #define T1_Skip_Alpha( p ) (p)->root.funcs.skip_alpha ( &(p)->root )
  80. #define T1_ToInt( p ) (p)->root.funcs.to_int( &(p)->root )
  81. #define T1_ToFixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t )
  82. #define T1_ToCoordArray( p, m, c ) \
  83. (p)->root.funcs.to_coord_array( &(p)->root, m, c )
  84. #define T1_ToFixedArray( p, m, f, t ) \
  85. (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
  86. #define T1_ToToken( p, t ) \
  87. (p)->root.funcs.to_token( &(p)->root, t )
  88. #define T1_ToTokenArray( p, t, m, c ) \
  89. (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
  90. #define T1_Load_Field( p, f, o, m, pf ) \
  91. (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
  92. #define T1_Load_Field_Table( p, f, o, m, pf ) \
  93. (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
  94. FT_LOCAL( FT_Error )
  95. T1_New_Parser( T1_Parser parser,
  96. FT_Stream stream,
  97. FT_Memory memory,
  98. PSAux_Service psaux );
  99. FT_LOCAL( FT_Error )
  100. T1_Get_Private_Dict( T1_Parser parser,
  101. PSAux_Service psaux );
  102. FT_LOCAL( void )
  103. T1_Finalize_Parser( T1_Parser parser );
  104. FT_END_HEADER
  105. #endif /* __T1PARSE_H__ */
  106. /* END */