gschar.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: gschar.h,v 1.6 2002/06/16 08:45:42 lpd Exp $ */
  14. /* Client interface to character operations */
  15. #ifndef gschar_INCLUDED
  16. # define gschar_INCLUDED
  17. #include "gsccode.h"
  18. #include "gscpm.h"
  19. /* String display, like image display, uses an enumeration structure */
  20. /* to keep track of what's going on (aka 'poor man's coroutine'). */
  21. #ifndef gs_show_enum_DEFINED
  22. # define gs_show_enum_DEFINED
  23. typedef struct gs_show_enum_s gs_show_enum;
  24. #endif
  25. /* Define an opaque type for fonts if necessary. */
  26. #ifndef gs_font_DEFINED
  27. # define gs_font_DEFINED
  28. typedef struct gs_font_s gs_font;
  29. #endif
  30. /* Allocate an enumerator. */
  31. gs_show_enum *gs_show_enum_alloc(gs_memory_t *, gs_state *, client_name_t);
  32. /* Release the contents of an enumerator. */
  33. /* (This happens automatically if the enumeration finishes normally.) */
  34. /* If the second argument is not NULL, also free the enumerator. */
  35. void gs_show_enum_release(gs_show_enum *, gs_memory_t *);
  36. /* Initialize a text enumeration. */
  37. int
  38. /* PostScript operators */
  39. gs_show_n_init(gs_show_enum *, gs_state *, const char *, uint),
  40. gs_ashow_n_init(gs_show_enum *, gs_state *, floatp, floatp, const char *, uint),
  41. gs_widthshow_n_init(gs_show_enum *, gs_state *, floatp, floatp, gs_char, const char *, uint),
  42. gs_awidthshow_n_init(gs_show_enum *, gs_state *, floatp, floatp, gs_char, floatp, floatp, const char *, uint),
  43. gs_kshow_n_init(gs_show_enum *, gs_state *, const char *, uint),
  44. gs_xyshow_n_init(gs_show_enum *, gs_state *, const char *, uint),
  45. gs_glyphshow_init(gs_show_enum *, gs_state *, gs_glyph), gs_cshow_n_init(gs_show_enum *, gs_state *, const char *, uint),
  46. gs_stringwidth_n_init(gs_show_enum *, gs_state *, const char *, uint),
  47. gs_charpath_n_init(gs_show_enum *, gs_state *, const char *, uint, bool),
  48. /* Extensions */
  49. gs_glyphpath_init(gs_show_enum *, gs_state *, gs_glyph, bool),
  50. gs_glyphwidth_init(gs_show_enum *, gs_state *, gs_glyph),
  51. gs_charboxpath_n_init(gs_show_enum *, gs_state *, const char *, uint, bool);
  52. int gs_show_use_glyph(gs_show_enum *, gs_glyph);
  53. /* After setting up the enumeration, all the string-related routines */
  54. /* work the same way. The client calls gs_show_next until it returns */
  55. /* a zero (successful completion) or negative (error) value. */
  56. /* Other values indicate the following situations: */
  57. /* The client must render a character: obtain the code from */
  58. /* gs_show_current_char, do whatever is necessary, and then */
  59. /* call gs_show_next again. */
  60. #define gs_show_render TEXT_PROCESS_RENDER
  61. /* The client has asked to intervene between characters (kshow). */
  62. /* Obtain the previous and next codes from gs_kshow_previous_char */
  63. /* and gs_kshow_next_char, do whatever is necessary, and then */
  64. /* call gs_show_next again. */
  65. #define gs_show_kern TEXT_PROCESS_INTERVENE
  66. /* The client has asked to handle characters individually */
  67. /* (xshow, yshow, xyshow, cshow). Obtain the current code */
  68. /* from gs_show_current_char, do whatever is necessary, and then */
  69. /* call gs_show_next again. */
  70. #define gs_show_move TEXT_PROCESS_INTERVENE
  71. int gs_show_next(gs_show_enum *);
  72. gs_char
  73. gs_show_current_char(const gs_show_enum *),
  74. gs_kshow_previous_char(const gs_show_enum *),
  75. gs_kshow_next_char(const gs_show_enum *);
  76. gs_font *
  77. gs_show_current_font(const gs_show_enum *);
  78. gs_glyph
  79. gs_show_current_glyph(const gs_show_enum *);
  80. int gs_show_current_width(const gs_show_enum *, gs_point *);
  81. void gs_show_width(const gs_show_enum *, gs_point *); /* cumulative width */
  82. gs_char_path_mode
  83. gs_show_in_charpath(const gs_show_enum *); /* return charpath flag */
  84. /* Character cache and metrics operators. */
  85. /* gs_setcachedevice* return 1 iff the cache device was just installed. */
  86. int gs_setcachedevice_float(gs_show_enum *, gs_state *, const float * /*[6] */ );
  87. int gs_setcachedevice_double(gs_show_enum *, gs_state *, const double * /*[6] */ );
  88. #define gs_setcachedevice(penum, pgs, pw)\
  89. gs_setcachedevice_float(penum, pgs, pw)
  90. int gs_setcachedevice2_float(gs_show_enum *, gs_state *, const float * /*[10] */ );
  91. int gs_setcachedevice2_double(gs_show_enum *, gs_state *, const double * /*[10] */ );
  92. #define gs_setcachedevice2(penum, pgs, pw2)\
  93. gs_setcachedevice2_float(penum, pgs, pw2)
  94. int gs_setcharwidth(gs_show_enum *, gs_state *, floatp, floatp);
  95. /* Return true if we only need the width from the rasterizer */
  96. /* and can short-circuit the full rendering of the character, */
  97. /* false if we need the actual character bits. */
  98. /* This is only meaningful just before calling gs_setcharwidth or */
  99. /* gs_setcachedevice[2]. */
  100. bool gs_show_width_only(const gs_show_enum *);
  101. #endif /* gschar_INCLUDED */