2 |
- |
1 |
/* Copyright (C) 1992, 1995, 1998, 1999 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: ccfont.h,v 1.5 2002/06/16 04:47:10 lpd Exp $ */
|
|
|
18 |
/* Header for fonts compiled into C. */
|
|
|
19 |
|
|
|
20 |
#ifndef ccfont_INCLUDED
|
|
|
21 |
# define ccfont_INCLUDED
|
|
|
22 |
|
|
|
23 |
/* Include all the things a compiled font needs. */
|
|
|
24 |
#include "stdpre.h"
|
|
|
25 |
#include "gsmemory.h"
|
|
|
26 |
#include "iref.h"
|
|
|
27 |
#include "ivmspace.h" /* for avm_foreign */
|
|
|
28 |
#include "store.h"
|
|
|
29 |
|
|
|
30 |
/* Define type-specific refs for initializing arrays. */
|
|
|
31 |
#define ref_(t) struct { struct tas_s tas; t value; }
|
|
|
32 |
#define boolean_v(b) { {t_boolean<<r_type_shift}, (ushort)(b) }
|
|
|
33 |
#define integer_v(i) { {t_integer<<r_type_shift}, (long)(i) }
|
|
|
34 |
#define null_v() { {t_null<<r_type_shift} }
|
|
|
35 |
#define real_v(v) { {t_real<<r_type_shift}, (float)(v) }
|
|
|
36 |
|
|
|
37 |
/* Define other initialization structures. */
|
|
|
38 |
typedef struct {
|
|
|
39 |
byte encx, charx;
|
|
|
40 |
} charindex;
|
|
|
41 |
|
|
|
42 |
/*
|
|
|
43 |
* We represent mostly-string arrays by byte strings. Each element
|
|
|
44 |
* starts with length bytes. If the first length byte is not 255,
|
|
|
45 |
* it and the following byte define a big-endian length of a string or name.
|
|
|
46 |
* If the first two bytes are (255,255), this element is null.
|
|
|
47 |
* Otherwise, the initial 255 is followed by a 2-byte big-endian length
|
|
|
48 |
* of a string that must be scanned as a token.
|
|
|
49 |
*/
|
|
|
50 |
typedef const char *cfont_string_array;
|
|
|
51 |
|
|
|
52 |
/* Support routines in iccfont.c */
|
|
|
53 |
typedef struct {
|
|
|
54 |
const charindex *enc_keys; /* keys from encoding vectors */
|
|
|
55 |
uint num_enc_keys;
|
|
|
56 |
uint num_str_keys;
|
|
|
57 |
uint extra_slots; /* (need extra for fonts) */
|
|
|
58 |
uint dict_attrs; /* protection for dictionary */
|
|
|
59 |
uint value_attrs; /* protection for values */
|
|
|
60 |
/* (only used for string dicts) */
|
|
|
61 |
} cfont_dict_keys;
|
|
|
62 |
|
|
|
63 |
/*
|
|
|
64 |
* We pass a procedure vector to the font initialization routine
|
|
|
65 |
* to avoid having externs, which compromise sharability.
|
|
|
66 |
*/
|
|
|
67 |
typedef struct cfont_procs_s {
|
|
|
68 |
int (*ref_dict_create) (i_ctx_t *, ref *, const cfont_dict_keys *,
|
|
|
69 |
cfont_string_array, const ref *);
|
|
|
70 |
int (*string_dict_create) (i_ctx_t *, ref *, const cfont_dict_keys *,
|
|
|
71 |
cfont_string_array, cfont_string_array);
|
|
|
72 |
int (*num_dict_create) (i_ctx_t *, ref *, const cfont_dict_keys *,
|
|
|
73 |
cfont_string_array, const ref *, const char *);
|
|
|
74 |
int (*name_array_create) (i_ctx_t *, ref *, cfont_string_array, int);
|
|
|
75 |
int (*string_array_create) (i_ctx_t *, ref *, cfont_string_array,
|
|
|
76 |
int /*size */ , uint /*protection */ );
|
|
|
77 |
int (*scalar_array_create) (i_ctx_t *, ref *, const ref *,
|
|
|
78 |
int /*size */ , uint /*protection */ );
|
|
|
79 |
int (*name_create) (i_ctx_t *, ref *, const char *);
|
|
|
80 |
int (*ref_from_string) (i_ctx_t *, ref *, const char *, uint);
|
|
|
81 |
} cfont_procs;
|
|
|
82 |
|
|
|
83 |
/*
|
|
|
84 |
* In order to make it possible for third parties to compile fonts (into
|
|
|
85 |
* a shared library, on systems that support such things), we define
|
|
|
86 |
* a tiny procedural interface for getting access to the compiled font table.
|
|
|
87 |
*/
|
|
|
88 |
#define ccfont_proc(proc)\
|
|
|
89 |
int proc(i_ctx_t *, const cfont_procs *, ref *)
|
|
|
90 |
typedef ccfont_proc((*ccfont_fproc));
|
|
|
91 |
|
|
|
92 |
/*
|
|
|
93 |
* There should be some consts in the *** below, but a number of
|
|
|
94 |
* C compilers don't handle const properly in such situations.
|
|
|
95 |
*/
|
|
|
96 |
extern int ccfont_fprocs(int *, const ccfont_fproc **);
|
|
|
97 |
|
|
|
98 |
#define ccfont_version 19 /* for checking against libraries */
|
|
|
99 |
|
|
|
100 |
#endif /* ccfont_INCLUDED */
|