|
|
977894 |
From a59a4a809dc1b68cc590f9017f466f6dcfc20b3b Mon Sep 17 00:00:00 2001
|
|
|
977894 |
From: Chris Liddell <chris.liddell@artifex.com>
|
|
|
977894 |
Date: Thu, 3 Nov 2016 13:09:27 +0000
|
|
|
977894 |
Subject: [PATCH] Bug 697286: handle GlyphDirectory as an array
|
|
|
977894 |
|
|
|
977894 |
For high level devices that need to copy CIDFonts, we need to establish the
|
|
|
977894 |
highest CID in a given CIDFont. If the font has a GlyphDirectory dictionary
|
|
|
977894 |
the only way to do so is to iterate through the keys to find the highest.
|
|
|
977894 |
|
|
|
977894 |
The code handling this ignored that the GlyphDirectory could be an array,
|
|
|
977894 |
which confused the dictionary content iterator, and caused a segfault.
|
|
|
977894 |
|
|
|
977894 |
In the case of an array, set the high CID to the highest index available in the
|
|
|
977894 |
array.
|
|
|
977894 |
---
|
|
|
977894 |
psi/zfcid.c | 18 +++++++++++-------
|
|
|
977894 |
1 file changed, 11 insertions(+), 7 deletions(-)
|
|
|
977894 |
|
|
|
977894 |
diff --git a/psi/zfcid.c b/psi/zfcid.c
|
|
|
977894 |
index d3ff274..fb8792d 100644
|
|
|
977894 |
--- a/psi/zfcid.c
|
|
|
977894 |
+++ b/psi/zfcid.c
|
|
|
977894 |
@@ -76,15 +76,19 @@ cid_font_data_param(os_ptr op, gs_font_cid_data *pdata, ref *pGlyphDirectory)
|
|
|
977894 |
* the number of CIDs in the font. We need to know the maximum CID
|
|
|
977894 |
* when copying fonts, so calculate and store it now.
|
|
|
977894 |
*/
|
|
|
977894 |
- index = dict_first(pgdir);
|
|
|
977894 |
- while (index >= 0) {
|
|
|
977894 |
- index = dict_next(pgdir, index, (ref *)&element);
|
|
|
977894 |
- if (index >= 0) {
|
|
|
977894 |
- if (element[0].value.intval > pdata->MaxCID)
|
|
|
977894 |
- pdata->MaxCID = element[0].value.intval;
|
|
|
977894 |
+ if (r_has_type(pgdir, t_dictionary)) {
|
|
|
977894 |
+ index = dict_first(pgdir);
|
|
|
977894 |
+ while (index >= 0) {
|
|
|
977894 |
+ index = dict_next(pgdir, index, (ref *)&element);
|
|
|
977894 |
+ if (index >= 0) {
|
|
|
977894 |
+ if (element[0].value.intval > pdata->MaxCID)
|
|
|
977894 |
+ pdata->MaxCID = element[0].value.intval;
|
|
|
977894 |
+ }
|
|
|
977894 |
}
|
|
|
977894 |
}
|
|
|
977894 |
-
|
|
|
977894 |
+ else {
|
|
|
977894 |
+ pdata->MaxCID = r_size(pgdir) - 1;
|
|
|
977894 |
+ }
|
|
|
977894 |
return code;
|
|
|
977894 |
} else {
|
|
|
977894 |
return_error(e_typecheck);
|
|
|
977894 |
--
|
|
|
977894 |
2.9.3
|
|
|
977894 |
|