[gs-cvs] gs/src
Igor Melichev
igor at casper.ghostscript.com
Sat Aug 17 02:17:17 PDT 2002
Update of /cvs/ghostscript/gs/src
In directory casper:/tmp/cvs-serv26694/gs/src
Modified Files:
fapiufst.c zfapi.c ifapi.h
Log Message:
Fix (FAPI): Allowing servers to substitute glyph name
for FAPI_FF_get_glyph callback.
Index: fapiufst.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/fapiufst.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- fapiufst.c 11 Apr 2002 16:55:35 -0000 1.17
+++ fapiufst.c 17 Aug 2002 09:17:15 -0000 1.18
@@ -901,16 +901,16 @@
code = CGIFchar_with_design_bbox(&r->IFS, cc, &result, (SW16)0, design_bbox, &design_escapement);
if (code == ERR_find_cgnum) {
/* There is no such char in the font, try the glyph 0 (notdef) : */
- const void *client_char_data = ff->client_char_data;
+ const void *client_char_data = ff->char_data;
UW16 c1 = 0, ssnum = r->IFS.fcCur.ssnum;
/* hack : Changing UFST internal data - see above. */
r->IFS.fcCur.ssnum = RAW_GLYPH;
r->callback_error = 0;
- ff->client_char_data = NULL;
+ ff->char_data = NULL;
CGIFchIdptr(&r->IFS, &c1, (char *)".notdef");
code = CGIFchar_with_design_bbox(&r->IFS, c1, &result, (SW16)0, design_bbox, &design_escapement);
r->IFS.fcCur.ssnum = ssnum;
- ff->client_char_data = client_char_data;
+ ff->char_data = client_char_data;
}
r->ff = 0;
release_glyphs(r, (ufst_common_font_data *)ff->server_font_data);
Index: zfapi.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/zfapi.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- zfapi.c 17 Aug 2002 08:04:42 -0000 1.24
+++ zfapi.c 17 Aug 2002 09:17:15 -0000 1.25
@@ -556,13 +556,14 @@
if (ff->is_type1) {
if (ff->is_cid) {
- ref *glyph = (ref *)ff->client_char_data;
+ ref *glyph = (ref *)ff->char_data;
glyph_length = get_type1_data(ff, glyph, buf, buf_length);
} else {
ref *CharStrings, char_name, *glyph;
- if (ff->client_char_data != NULL)
- char_name = *(ref *)ff->client_char_data;
- else if (name_ref((const byte *)".notdef", 7, &char_name, -1) < 0)
+ if (ff->char_data != NULL) {
+ if (name_ref(ff->char_data, ff->char_data_len, &char_name, -1) < 0)
+ return -1;
+ } else if (name_ref((const byte *)".notdef", 7, &char_name, -1) < 0)
return -1;
if (dict_find_string(pdr, "CharStrings", &CharStrings) <= 0)
return -1;
@@ -609,7 +610,8 @@
0, /* is_cid */
0, /* client_font_data */
0, /* client_font_data2 */
- 0, /* client_char_data */
+ 0, /* char_data */
+ 0, /* char_data_len */
FAPI_FF_get_word,
FAPI_FF_get_long,
FAPI_FF_get_float,
@@ -1199,7 +1201,7 @@
return_error(e_invalidfont);
cr.is_glyph_index = true;
} else if (is_embedded_type1) {
- /* Since the client passes charstring by callback using ff.client_char_data,
+ /* Since the client passes charstring by callback using ff.char_data,
the client doesn't need to provide a good cr here.
Perhaps since UFST uses char codes as glyph cache keys (UFST 4.2 cannot use names),
we provide font char codes equal to document's char codes.
@@ -1234,9 +1236,13 @@
/* Render : */
if (ff.is_type1 && ff.is_cid)
- ff.client_char_data = charstring;
- else
- ff.client_char_data = &char_name;
+ ff.char_data = charstring;
+ else {
+ ref sname;
+ name_string_ref(&char_name, &sname);
+ ff.char_data = sname.value.const_bytes;
+ ff.char_data_len = r_size(&sname);
+ }
if (SHOW_IS(penum, TEXT_DO_NONE)) {
if ((code = renderer_retcode(i_ctx_p, I, I->get_char_width(I, &ff, &cr, &metrics))) < 0)
return code;
Index: ifapi.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/ifapi.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ifapi.h 9 Jul 2002 14:55:03 -0000 1.12
+++ ifapi.h 17 Aug 2002 09:17:15 -0000 1.13
@@ -82,7 +82,8 @@
bool is_cid;
void *client_font_data;
void *client_font_data2;
- const void *client_char_data;
+ const void *char_data;
+ int char_data_len;
unsigned short (*get_word )(FAPI_font *ff, fapi_font_feature var_id, int index);
unsigned long (*get_long )(FAPI_font *ff, fapi_font_feature var_id, int index);
float (*get_float)(FAPI_font *ff, fapi_font_feature var_id, int index);
More information about the gs-cvs
mailing list