pfrload.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /***************************************************************************/
  2. /* */
  3. /* pfrload.h */
  4. /* */
  5. /* FreeType PFR loader (specification). */
  6. /* */
  7. /* Copyright 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 __PFRLOAD_H__
  18. #define __PFRLOAD_H__
  19. #include "pfrobjs.h"
  20. #include FT_INTERNAL_STREAM_H
  21. FT_BEGIN_HEADER
  22. #ifdef PFR_CONFIG_NO_CHECKS
  23. #define PFR_CHECK( x ) do { } while ( 0 )
  24. #else
  25. #define PFR_CHECK( x ) do \
  26. { \
  27. if ( p + (x) > limit ) \
  28. goto Too_Short; \
  29. } while ( 0 )
  30. #endif
  31. #define PFR_NEXT_BYTE( p ) FT_NEXT_BYTE( p )
  32. #define PFR_NEXT_INT8( p ) FT_NEXT_CHAR( p )
  33. #define PFR_NEXT_SHORT( p ) FT_NEXT_SHORT( p )
  34. #define PFR_NEXT_USHORT( p ) FT_NEXT_USHORT( p )
  35. #define PFR_NEXT_LONG( p ) FT_NEXT_OFF3( p )
  36. #define PFR_NEXT_ULONG( p ) FT_NEXT_UOFF3( p )
  37. /* handling extra items */
  38. typedef FT_Error
  39. (*PFR_ExtraItem_ParseFunc)( FT_Byte* p,
  40. FT_Byte* limit,
  41. FT_Pointer data );
  42. typedef struct PFR_ExtraItemRec_
  43. {
  44. FT_UInt type;
  45. PFR_ExtraItem_ParseFunc parser;
  46. } PFR_ExtraItemRec;
  47. typedef const struct PFR_ExtraItemRec_* PFR_ExtraItem;
  48. FT_LOCAL( FT_Error )
  49. pfr_extra_items_skip( FT_Byte* *pp,
  50. FT_Byte* limit );
  51. FT_LOCAL( FT_Error )
  52. pfr_extra_items_parse( FT_Byte* *pp,
  53. FT_Byte* limit,
  54. PFR_ExtraItem item_list,
  55. FT_Pointer item_data );
  56. /* load a PFR header */
  57. FT_LOCAL( FT_Error )
  58. pfr_header_load( PFR_Header header,
  59. FT_Stream stream );
  60. /* check a PFR header */
  61. FT_LOCAL( FT_Bool )
  62. pfr_header_check( PFR_Header header );
  63. /* return number of logical fonts in this file */
  64. FT_LOCAL( FT_Error )
  65. pfr_log_font_count( FT_Stream stream,
  66. FT_UInt32 log_section_offset,
  67. FT_UInt *acount );
  68. /* load a pfr logical font entry */
  69. FT_LOCAL( FT_Error )
  70. pfr_log_font_load( PFR_LogFont log_font,
  71. FT_Stream stream,
  72. FT_UInt face_index,
  73. FT_UInt32 section_offset,
  74. FT_Bool size_increment );
  75. /* load a physical font entry */
  76. FT_LOCAL( FT_Error )
  77. pfr_phy_font_load( PFR_PhyFont phy_font,
  78. FT_Stream stream,
  79. FT_UInt32 offset,
  80. FT_UInt32 size );
  81. /* finalize a physical font */
  82. FT_LOCAL( void )
  83. pfr_phy_font_done( PFR_PhyFont phy_font,
  84. FT_Memory memory );
  85. /* */
  86. FT_END_HEADER
  87. #endif /* __PFRLOAD_H__ */
  88. /* END */