2 |
- |
1 |
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 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: zfcid.c,v 1.14 2003/06/09 13:58:21 alexcher Exp $ */
|
|
|
18 |
/* CID-keyed font utilities */
|
|
|
19 |
#include "ghost.h"
|
|
|
20 |
#include "oper.h"
|
|
|
21 |
#include "gsmatrix.h"
|
|
|
22 |
#include "gxfcid.h"
|
|
|
23 |
#include "bfont.h"
|
|
|
24 |
#include "icid.h"
|
|
|
25 |
#include "idict.h"
|
|
|
26 |
#include "idparam.h"
|
|
|
27 |
#include "ifcid.h"
|
|
|
28 |
#include "store.h"
|
|
|
29 |
|
|
|
30 |
/* Get the CIDSystemInfo of a CIDFont. */
|
|
|
31 |
int
|
|
|
32 |
cid_font_system_info_param(gs_cid_system_info_t *pcidsi, const ref *prfont)
|
|
|
33 |
{
|
|
|
34 |
ref *prcidsi;
|
|
|
35 |
|
|
|
36 |
if (dict_find_string(prfont, "CIDSystemInfo", &prcidsi) <= 0)
|
|
|
37 |
return_error(e_rangecheck);
|
|
|
38 |
return cid_system_info_param(pcidsi, prcidsi);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
/* Get the additional information for a CIDFontType 0 or 2 CIDFont. */
|
|
|
42 |
int
|
|
|
43 |
cid_font_data_param(os_ptr op, gs_font_cid_data *pdata, ref *pGlyphDirectory)
|
|
|
44 |
{
|
|
|
45 |
int code;
|
|
|
46 |
ref *pgdir;
|
|
|
47 |
|
|
|
48 |
check_type(*op, t_dictionary);
|
|
|
49 |
if ((code = cid_font_system_info_param(&pdata->CIDSystemInfo, op)) < 0 ||
|
|
|
50 |
(code = dict_int_param(op, "CIDCount", 0, max_int, -1,
|
|
|
51 |
&pdata->CIDCount)) < 0
|
|
|
52 |
)
|
|
|
53 |
return code;
|
|
|
54 |
/*
|
|
|
55 |
* If the font doesn't have a GlyphDirectory, GDBytes is required.
|
|
|
56 |
* If it does have a GlyphDirectory, GDBytes may still be needed for
|
|
|
57 |
* CIDMap: it's up to the client to check this.
|
|
|
58 |
*/
|
|
|
59 |
if (dict_find_string(op, "GlyphDirectory", &pgdir) <= 0) {
|
|
|
60 |
/* Standard CIDFont, require GDBytes. */
|
|
|
61 |
make_null(pGlyphDirectory);
|
|
|
62 |
return dict_int_param(op, "GDBytes", 1, MAX_GDBytes, 0,
|
|
|
63 |
&pdata->GDBytes);
|
|
|
64 |
}
|
|
|
65 |
if (r_has_type(pgdir, t_dictionary) || r_is_array(pgdir)) {
|
|
|
66 |
/* GlyphDirectory, GDBytes is optional. */
|
|
|
67 |
*pGlyphDirectory = *pgdir;
|
|
|
68 |
code = dict_int_param(op, "GDBytes", 0, MAX_GDBytes, 0,
|
|
|
69 |
&pdata->GDBytes);
|
|
|
70 |
return code;
|
|
|
71 |
} else {
|
|
|
72 |
return_error(e_typecheck);
|
|
|
73 |
}
|
|
|
74 |
}
|