otlparse.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef __OTL_PARSER_H__
  2. #define __OTL_PARSER_H__
  3. #include "otlayout.h"
  4. #include "otlgdef.h"
  5. #include "otlgsub.h"
  6. #include "otlgpos.h"
  7. OTL_BEGIN_HEADER
  8. typedef struct OTL_ParserRec_* OTL_Parser;
  9. typedef struct OTL_StringRec_* OTL_String;
  10. typedef struct OTL_StringGlyphRec_
  11. {
  12. OTL_UInt gindex;
  13. OTL_UInt properties;
  14. OTL_UInt lig_component;
  15. OTL_UInt lig_id;
  16. } OTL_StringGlyphRec, *OTL_StringGlyph;
  17. typedef struct OTL_StringRec_
  18. {
  19. OTL_StringGlyph glyphs;
  20. OTL_UInt cursor;
  21. OTL_UInt length;
  22. OTL_UInt capacity;
  23. } OTL_StringRec;
  24. typedef struct OTL_ParserRec_
  25. {
  26. OTL_Bytes tab_gdef;
  27. OTL_Bytes tab_gsub;
  28. OTL_Bytes tab_gpos;
  29. OTL_Bytes tab_base;
  30. OTL_Bytes tab_jstf;
  31. OTL_Alternate alternate; /* external alternate handler */
  32. OTL_UInt context_len;
  33. OTL_UInt markup_flags;
  34. OTL_jmp_buf jump_buffer;
  35. OTL_Memory memory;
  36. OTL_Error error;
  37. OTL_StringRec strings[2];
  38. OTL_String str_in;
  39. OTL_String str_out;
  40. } OTL_ParserRec;
  41. typedef enum
  42. {
  43. OTL_Err_Parser_Ok = 0,
  44. OTL_Err_Parser_InvalidData,
  45. OTL_Err_Parser_UncoveredGlyph
  46. } OTL_ParseError;
  47. OTL_LOCAL( OTL_UInt )
  48. otl_parser_get_gindex( OTL_Parser parser );
  49. OTL_LOCAL( void )
  50. otl_parser_error( OTL_Parser parser, OTL_ParserError error );
  51. #define OTL_PARSER_UNCOVERED(x) \
  52. otl_parser_error( x, OTL_Err_Parser_UncoveredGlyph )
  53. OTL_LOCAL( void )
  54. otl_parser_check_property( OTL_Parser parser,
  55. OTL_UInt gindex,
  56. OTL_UInt flags,
  57. OTL_UInt *aproperty );
  58. /* copy current input glyph to output */
  59. OTL_LOCAL( void )
  60. otl_parser_copy_1( OTL_Parser parser );
  61. /* copy current input glyph to output, replacing its index */
  62. OTL_LOCAL( void )
  63. otl_parser_replace_1( OTL_Parser parser,
  64. OTL_UInt gindex );
  65. /* copy current input glyph to output, replacing it by several indices */
  66. /* read directly from the table */
  67. OTL_LOCAL( void )
  68. otl_parser_replace_n( OTL_Parser parser,
  69. OTL_UInt count,
  70. OTL_Bytes indices );
  71. OTL_END_HEADER
  72. #endif /* __OTL_PARSER_H__ */