gsccode.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* Copyright (C) 1993, 2000, 2002 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: gsccode.h,v 1.14 2004/08/19 19:33:09 stefan Exp $ */
  14. /* Types for character codes */
  15. #ifndef gsccode_INCLUDED
  16. # define gsccode_INCLUDED
  17. /*
  18. * Define a character code. Normally this is just a single byte from a
  19. * string, but because of composite fonts, character codes must be
  20. * at least 32 bits.
  21. */
  22. typedef ulong gs_char;
  23. #define GS_NO_CHAR ((gs_char)~0L)
  24. /* Backward compatibility */
  25. #define gs_no_char GS_NO_CHAR
  26. /*
  27. * Define a character glyph code, a.k.a. character name. The space of
  28. * glyph codes is divided into five sections:
  29. *
  30. * - Codes >= GS_MIN_GLYPH_INDEX represent (non-negative)
  31. * integers biased by GS_MIN_CID_GLYPH. They represent glyph indices
  32. * of a specific font.
  33. *
  34. * - Codes within [GS_MIN_CID_GLYPH, GS_MIN_GLYPH_INDEX) represent (non-negative)
  35. * integers biased by GS_MIN_CID_GLYPH. They represent PostScript CIDs
  36. * of a specific Ordering.
  37. *
  38. * - Codes < GS_MIN_CID_GLYPH represent named glyphs. There are
  39. * three sub-sections:
  40. *
  41. * - GS_NO_GLYPH, which means "no known glyph value". Note that
  42. * it is not the same as /.notdef or CID 0 or GID 0: it means
  43. * that the identity of the glyph is unknown, as opposed to a
  44. * known glyph that is used for rendering an unknown character
  45. * code.
  46. *
  47. * - Codes < gs_c_min_std_encoding_glyph represent names in some
  48. * global space that the graphics library doesn't attempt to
  49. * interpret. (When the client is the PostScript interpreter,
  50. * these codes are PostScript name indices, but the graphics
  51. * library doesn't know or rely on this.) The graphics library
  52. * *does* assume that such codes denote the same names across
  53. * all fonts, and that they can be converted to a string name
  54. * by the font's glyph_name virtual procedure.
  55. *
  56. * - Codes >= gs_c_min_std_encoding_glyph (and < GS_MIN_CID_GLYPH)
  57. * represent names in a special space used for the 11 built-in
  58. * Encodings. The API is defined in gscencs.h. The only
  59. * procedures that generate or recognize such codes are the ones
  60. * declared in that file: clients must be careful not to mix
  61. * such codes with codes in the global space.
  62. *
  63. * Client code may assume that GS_NO_GLYPH < GS_MIN_CID_GLYPH (i.e., it is a
  64. * "name", not an integer), but should not make assumptions about whether
  65. * GS_NO_GLYPH is less than or greater than gs_c_min_std_encoding_glyph.
  66. */
  67. typedef ulong gs_glyph;
  68. #define GS_NO_GLYPH ((gs_glyph)0x7fffffff)
  69. #if arch_sizeof_long > 4
  70. # define GS_MIN_CID_GLYPH ((gs_glyph)0x80000000L)
  71. #else
  72. /* Avoid compiler warnings about signed/unsigned constants. */
  73. # define GS_MIN_CID_GLYPH ((gs_glyph)~0x7fffffff)
  74. #endif
  75. #define GS_MIN_GLYPH_INDEX (GS_MIN_CID_GLYPH | (GS_MIN_CID_GLYPH >> 1))
  76. #define GS_GLYPH_TAG (gs_glyph)(GS_MIN_CID_GLYPH | GS_MIN_GLYPH_INDEX)
  77. #define GS_MAX_GLYPH max_ulong
  78. /* Backward compatibility */
  79. #define gs_no_glyph GS_NO_GLYPH
  80. #define gs_min_cid_glyph GS_MIN_CID_GLYPH
  81. #define gs_max_glyph GS_MAX_GLYPH
  82. /* Define a procedure for marking a gs_glyph during garbage collection. */
  83. typedef bool (*gs_glyph_mark_proc_t)(const gs_memory_t *mem, gs_glyph glyph, void *proc_data);
  84. /* Define the indices for known encodings. */
  85. typedef enum {
  86. ENCODING_INDEX_UNKNOWN = -1,
  87. /* Real encodings. These must come first. */
  88. ENCODING_INDEX_STANDARD = 0,
  89. ENCODING_INDEX_ISOLATIN1,
  90. ENCODING_INDEX_SYMBOL,
  91. ENCODING_INDEX_DINGBATS,
  92. ENCODING_INDEX_WINANSI,
  93. ENCODING_INDEX_MACROMAN,
  94. ENCODING_INDEX_MACEXPERT,
  95. #define NUM_KNOWN_REAL_ENCODINGS 7
  96. /* Pseudo-encodings (glyph sets). */
  97. ENCODING_INDEX_MACGLYPH, /* Mac glyphs */
  98. ENCODING_INDEX_ALOGLYPH, /* Adobe Latin glyph set */
  99. ENCODING_INDEX_ALXGLYPH, /* Adobe Latin Extended glyph set */
  100. ENCODING_INDEX_CFFSTRINGS /* CFF StandardStrings */
  101. #define NUM_KNOWN_ENCODINGS 11
  102. } gs_encoding_index_t;
  103. #define KNOWN_REAL_ENCODING_NAMES\
  104. "StandardEncoding", "ISOLatin1Encoding", "SymbolEncoding",\
  105. "DingbatsEncoding", "WinAnsiEncoding", "MacRomanEncoding",\
  106. "MacExpertEncoding"
  107. /*
  108. * For fonts that use more than one method to identify glyphs, define the
  109. * glyph space for the values returned by procedures that return glyphs.
  110. * Note that if a font uses only one method (such as Type 1 fonts, which
  111. * only use names, or TrueType fonts, which only use indexes), the
  112. * glyph_space argument is ignored.
  113. */
  114. typedef enum gs_glyph_space_s {
  115. GLYPH_SPACE_NAME, /* names (if available) */
  116. GLYPH_SPACE_INDEX, /* indexes (if available) */
  117. GLYPH_SPACE_NOGEN /* don't generate new names (Type 3 only) */
  118. } gs_glyph_space_t;
  119. /*
  120. * Define a procedure for mapping a glyph to its (string) name. This is
  121. * currently used only for CMaps: it is *not* the same as the glyph_name
  122. * procedure in fonts.
  123. */
  124. typedef int (*gs_glyph_name_proc_t)(const gs_memory_t *mem,
  125. gs_glyph glyph, gs_const_string *pstr,
  126. void *proc_data);
  127. #endif /* gsccode_INCLUDED */