home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / GSCHAR.H < prev    next >
C/C++ Source or Header  |  1994-07-27  |  5KB  |  102 lines

  1. /* Copyright (C) 1989, 1992, 1993, 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gschar.h */
  20. /* Client interface to character operations */
  21. #include "gsccode.h"
  22.  
  23. /* String display, like image display, uses an enumeration structure */
  24. /* to keep track of what's going on (aka 'poor man's coroutine'). */
  25. #ifndef gs_show_enum_DEFINED
  26. #  define gs_show_enum_DEFINED
  27. typedef struct gs_show_enum_s gs_show_enum;
  28. #endif
  29.  
  30. gs_show_enum *gs_show_enum_alloc(P2(gs_memory_t *, client_name_t));
  31. /* The initialization routines all come in two versions, */
  32. /* one that uses the C convention of null-terminated strings, */
  33. /* and one that supplies a length. */
  34. int    gs_show_init(P3(gs_show_enum *, gs_state *, const char *)),
  35.     gs_show_n_init(P4(gs_show_enum *, gs_state *, const char *, uint)),
  36.     gs_ashow_init(P5(gs_show_enum *, gs_state *, floatp, floatp, const char *)),
  37.     gs_ashow_n_init(P6(gs_show_enum *, gs_state *, floatp, floatp, const char *, uint)),
  38.     gs_widthshow_init(P6(gs_show_enum *, gs_state *, floatp, floatp, gs_char, const char *)),
  39.     gs_widthshow_n_init(P7(gs_show_enum *, gs_state *, floatp, floatp, gs_char, const char *, uint)),
  40.     gs_awidthshow_init(P8(gs_show_enum *, gs_state *, floatp, floatp, gs_char, floatp, floatp, const char *)),
  41.     gs_awidthshow_n_init(P9(gs_show_enum *, gs_state *, floatp, floatp, gs_char, floatp, floatp, const char *, uint)),
  42.     gs_kshow_init(P3(gs_show_enum *, gs_state *, const char *)),
  43.     gs_kshow_n_init(P4(gs_show_enum *, gs_state *, const char *, uint)),
  44.     gs_xyshow_init(P3(gs_show_enum *, gs_state *, const char *)),
  45.     gs_xyshow_n_init(P4(gs_show_enum *, gs_state *, const char *, uint)),
  46.     gs_glyphshow_init(P3(gs_show_enum *, gs_state *, gs_glyph)),
  47.     gs_cshow_init(P3(gs_show_enum *, gs_state *, const char *)),
  48.     gs_cshow_n_init(P4(gs_show_enum *, gs_state *, const char *, uint)),
  49.     gs_stringwidth_init(P3(gs_show_enum *, gs_state *, const char *)),
  50.     gs_stringwidth_n_init(P4(gs_show_enum *, gs_state *, const char *, uint)),
  51.     gs_charpath_init(P4(gs_show_enum *, gs_state *, const char *, int)),
  52.     gs_charpath_n_init(P5(gs_show_enum *, gs_state *, const char *, uint, int));
  53.  
  54. /* After setting up the enumeration, all the string-related routines */
  55. /* work the same way.  The client calls gs_show_next until it returns */
  56. /* a zero (successful completion) or negative (error) value. */
  57. /* Other values indicate the following situations: */
  58.  
  59.     /* The client must render a character: obtain the code from */
  60.     /* gs_show_current_char, do whatever is necessary, and then */
  61.     /* call gs_show_next again. */
  62. #define gs_show_render 1
  63.  
  64.     /* The client has asked to intervene between characters (kshow). */
  65.     /* Obtain the previous and next codes from gs_kshow_previous_char */
  66.     /* and gs_kshow_next_char, do whatever is necessary, and then */
  67.     /* call gs_show_next again. */
  68. #define gs_show_kern 2
  69.  
  70.     /* The client has asked to handle characters individually */
  71.     /* (xshow, yshow, xyshow, cshow).  Obtain the current code */
  72.     /* from gs_show_current_char, do whatever is necessary, and then */
  73.     /* call gs_show_next again. */
  74. #define gs_show_move 3
  75.  
  76. int    gs_show_next(P1(gs_show_enum *));
  77. gs_char
  78.     gs_show_current_char(P1(const gs_show_enum *)),
  79.     gs_kshow_previous_char(P1(const gs_show_enum *)),
  80.     gs_kshow_next_char(P1(const gs_show_enum *));
  81. gs_glyph
  82.     gs_show_current_glyph(P1(const gs_show_enum *));
  83. int    gs_show_current_width(P2(const gs_show_enum *, gs_point *));
  84. void    gs_show_width(P2(const gs_show_enum *, gs_point *));    /* cumulative width */
  85. int    gs_show_in_charpath(P1(const gs_show_enum *));    /* return charpath flag */
  86.  
  87. /* Character cache and metrics operators. */
  88. int    gs_setcachedevice(P3(gs_show_enum *, gs_state *, const float * /*[6]*/));
  89. int    gs_setcachedevice2(P3(gs_show_enum *, gs_state *, const float * /*[10]*/));
  90. int    gs_setcharwidth(P4(gs_show_enum *, gs_state *, floatp, floatp));
  91. /* Return true if we only need the width from the rasterizer, */
  92. /* false if we need the actual character bits. */
  93. /* This is only meaningful just before calling gs_setcharwidth or */
  94. /* gs_setcachedevice[2]. */
  95. bool    gs_show_width_only(P1(const gs_show_enum *));
  96.  
  97. /* Define the scale for oversampling.  Clients don't actually use this, */
  98. /* but this seemed like the handiest place for it. */
  99. typedef struct gs_log2_scale_point_s {
  100.     int x, y;
  101. } gs_log2_scale_point;
  102.