home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / printing / ghostscrip / source / _gs / h / gxchar < prev    next >
Encoding:
Text File  |  1991-10-27  |  4.2 KB  |  112 lines

  1. /* Copyright (C) 1989, 1990, 1991 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gxchar.h */
  21. /* Internal character definition for Ghostscript library */
  22. /* Requires gsmatrix.h, gxfixed.h, gzdevice.h */
  23. #include "gschar.h"
  24.  
  25. /* An entry for a (font,matrix) pair in the character cache. */
  26. typedef struct cached_fm_pair_s cached_fm_pair;
  27. struct cached_fm_pair_s {
  28.     struct gs_font_s *font;        /* base font */
  29.     float mxx, mxy, myx, myy;    /* transformation */
  30.     int num_chars;            /* # of cached chars with this */
  31.                     /* f/m pair */
  32. };
  33.  
  34. /* A cached bitmap for an individual character. */
  35. /* The bits immediately follow the structure. */
  36. typedef struct cached_char_s cached_char;
  37. struct cached_char_s {
  38.     cached_char *next;        /* next in replacement ring */
  39.     /* The code and font/matrix pair are the 'key' in the cache. */
  40.     cached_fm_pair *pair;        /* font/matrix pair */
  41.     uint code;            /* character code */
  42.     /* The rest of the structure is the 'value'. */
  43.     ushort raster, height;        /* dimensions of bitmap */
  44.     ushort width;
  45.     gs_fixed_point wxy;        /* width in device coords */
  46.     gs_fixed_point offset;        /* (-llx, -lly) in device coords */
  47. };
  48.  
  49. /* An enumeration object for string display. */
  50. typedef enum {
  51.     sws_none,
  52.     sws_cache,
  53.     sws_no_cache
  54. } show_width_status;
  55. #ifdef ARC
  56. #define GS_SHOW_ENUM_S_DEFINED
  57. #endif
  58. struct gs_show_enum_s {
  59.     /* Following are set at creation time */
  60.     gs_state *pgs;
  61.     int level;            /* save the level of pgs */
  62.     byte *str;            /* char may be signed! */
  63.     uint size;
  64.     float cx, cy;            /* for widthshow */
  65.     int chr;            /* ditto */
  66.     float ax, ay;            /* for ashow */
  67.     int add;            /* true if a[width]show */
  68.     int do_kern;            /* true if kshow */
  69.     int slow_show;            /* [a][width]show or kshow */
  70.     int charpath_flag;        /* 0 for show, 1 for false */
  71.                     /* charpath, 2 for true charpath */
  72.     int stringwidth_flag;        /* 0 for show/charpath, */
  73.                     /* 1 for stringwidth */
  74.     int can_cache;            /* true if can cache chars */
  75.     int cxmin, cymin, cxmax, cymax;    /* int version of quick-check */
  76.                     /* clipping box */
  77.     int is_composite;        /* true if composite font */
  78.     int ftx, fty;            /* transformed font translation */
  79.     /* Following are set at most once */
  80.     gx_device_memory dev_cache_info;
  81.     device dev_cache_dev;
  82.     int dev_cache_set;
  83.     /* Following are updated dynamically */
  84.     uint index;            /* index within string */
  85.     gs_fixed_point wxy;        /* for current char in device coords */
  86.     cached_char *cc;        /* being accumulated */
  87.     gs_point width;            /* total width of string, set at end */
  88.     show_width_status width_set;
  89.     int color_loaded;        /* true if have done gx_color_render */
  90.     int (*continue_proc)(P1(struct gs_show_enum_s *));    /* continuation procedure */
  91.     /* Following are dynamic, for composite fonts only */
  92. #define max_font_depth 5
  93.     struct gs_font_s *fstack[max_font_depth];
  94.     int fdepth;
  95.     struct gs_font_s *pfont;
  96. };
  97.  
  98. /* Cached character procedures (in gxfont.c) */
  99. #ifndef gs_font_dir_DEFINED
  100. #  define gs_font_dir_DEFINED    
  101. typedef struct gs_font_dir_s gs_font_dir;
  102. #endif
  103. cached_char *
  104.     gx_alloc_char_bits(P4(gs_font_dir *, gx_device_memory *, ushort, ushort));
  105. void    gx_unalloc_cached_char(P2(gs_font_dir *, cached_char *));
  106. cached_fm_pair *
  107.     gx_lookup_fm_pair(P1(gs_state *));
  108. void    gx_add_cached_char(P4(gs_font_dir *, gx_device_memory *, cached_char *, cached_fm_pair *));
  109. cached_char *
  110.     gx_lookup_cached_char(P3(gs_state *, cached_fm_pair *, uint));
  111. int    gx_copy_cached_char(P2(gs_show_enum *, cached_char *));
  112.