ccfont.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* Copyright (C) 1992, 1995, 1998, 1999 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: ccfont.h,v 1.5 2002/06/16 04:47:10 lpd Exp $ */
  14. /* Header for fonts compiled into C. */
  15. #ifndef ccfont_INCLUDED
  16. # define ccfont_INCLUDED
  17. /* Include all the things a compiled font needs. */
  18. #include "stdpre.h"
  19. #include "gsmemory.h"
  20. #include "iref.h"
  21. #include "ivmspace.h" /* for avm_foreign */
  22. #include "store.h"
  23. /* Define type-specific refs for initializing arrays. */
  24. #define ref_(t) struct { struct tas_s tas; t value; }
  25. #define boolean_v(b) { {t_boolean<<r_type_shift}, (ushort)(b) }
  26. #define integer_v(i) { {t_integer<<r_type_shift}, (long)(i) }
  27. #define null_v() { {t_null<<r_type_shift} }
  28. #define real_v(v) { {t_real<<r_type_shift}, (float)(v) }
  29. /* Define other initialization structures. */
  30. typedef struct {
  31. byte encx, charx;
  32. } charindex;
  33. /*
  34. * We represent mostly-string arrays by byte strings. Each element
  35. * starts with length bytes. If the first length byte is not 255,
  36. * it and the following byte define a big-endian length of a string or name.
  37. * If the first two bytes are (255,255), this element is null.
  38. * Otherwise, the initial 255 is followed by a 2-byte big-endian length
  39. * of a string that must be scanned as a token.
  40. */
  41. typedef const char *cfont_string_array;
  42. /* Support routines in iccfont.c */
  43. typedef struct {
  44. const charindex *enc_keys; /* keys from encoding vectors */
  45. uint num_enc_keys;
  46. uint num_str_keys;
  47. uint extra_slots; /* (need extra for fonts) */
  48. uint dict_attrs; /* protection for dictionary */
  49. uint value_attrs; /* protection for values */
  50. /* (only used for string dicts) */
  51. } cfont_dict_keys;
  52. /*
  53. * We pass a procedure vector to the font initialization routine
  54. * to avoid having externs, which compromise sharability.
  55. */
  56. typedef struct cfont_procs_s {
  57. int (*ref_dict_create) (i_ctx_t *, ref *, const cfont_dict_keys *,
  58. cfont_string_array, const ref *);
  59. int (*string_dict_create) (i_ctx_t *, ref *, const cfont_dict_keys *,
  60. cfont_string_array, cfont_string_array);
  61. int (*num_dict_create) (i_ctx_t *, ref *, const cfont_dict_keys *,
  62. cfont_string_array, const ref *, const char *);
  63. int (*name_array_create) (i_ctx_t *, ref *, cfont_string_array, int);
  64. int (*string_array_create) (i_ctx_t *, ref *, cfont_string_array,
  65. int /*size */ , uint /*protection */ );
  66. int (*scalar_array_create) (i_ctx_t *, ref *, const ref *,
  67. int /*size */ , uint /*protection */ );
  68. int (*name_create) (i_ctx_t *, ref *, const char *);
  69. int (*ref_from_string) (i_ctx_t *, ref *, const char *, uint);
  70. } cfont_procs;
  71. /*
  72. * In order to make it possible for third parties to compile fonts (into
  73. * a shared library, on systems that support such things), we define
  74. * a tiny procedural interface for getting access to the compiled font table.
  75. */
  76. #define ccfont_proc(proc)\
  77. int proc(i_ctx_t *, const cfont_procs *, ref *)
  78. typedef ccfont_proc((*ccfont_fproc));
  79. /*
  80. * There should be some consts in the *** below, but a number of
  81. * C compilers don't handle const properly in such situations.
  82. */
  83. extern int ccfont_fprocs(int *, const ccfont_fproc **);
  84. #define ccfont_version 19 /* for checking against libraries */
  85. #endif /* ccfont_INCLUDED */