diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2009-10-29 14:59:16 +0000 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2009-10-29 14:59:16 +0000 |
commit | e70374db44db0e7db84502deb0ea34d11f6523df (patch) | |
tree | e8caedf47498509afe93fefa3456d4d918958f4c /xps/xpsglyphs.c | |
parent | 83a7c1bdeaa8f7f11f2d5ad7ba8df1c61134ae8c (diff) | |
download | ghostpdl-e70374db44db0e7db84502deb0ea34d11f6523df.tar.gz |
Implement a random file access mode for the XPS parser that uses less memory.
To enable this mode, set the XPS_ZIP_SEEK environment variable
which will cause the interpreter to spool the data to a temp file
and then run the parser in the new mode.
This is going to change in a later patch to plmain that will enable
the interpreters to directly access the job files.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@10243 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'xps/xpsglyphs.c')
-rw-r--r-- | xps/xpsglyphs.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c index 11cf1aea7..aefc9c09b 100644 --- a/xps/xpsglyphs.c +++ b/xps/xpsglyphs.c @@ -109,18 +109,6 @@ xps_deobfuscate_font_resource(xps_context_t *ctx, xps_part_t *part) part->data[i+16] ^= key[15-i]; } - if (getenv("XPS_SAVE_FONTS")) - { - static int id = 0; - char buf[25]; - FILE *fp; - sprintf(buf, "font%d.otf", id++); - dprintf1("saving font data to %s\n", buf); - fp = fopen(buf, "wb"); - fwrite(part->data, part->size, 1, fp); - fclose(fp); - } - return 0; } @@ -497,7 +485,6 @@ xps_parse_glyphs(xps_context_t *ctx, xps_font_t *font; char partname[1024]; - char *parttype; char *subfont; gs_matrix matrix; @@ -578,23 +565,17 @@ xps_parse_glyphs(xps_context_t *ctx, subfontid = atoi(subfont + 1); *subfont = 0; } - part = xps_find_part(ctx, partname); + part = xps_read_part(ctx, partname); if (!part) return gs_throw1(-1, "cannot find font resource part '%s'", partname); /* deobfuscate if necessary */ if (!part->deobfuscated) { - parttype = xps_get_content_type(ctx, part->name); - if (parttype && !strcmp(parttype, "application/vnd.ms-package.obfuscated-opentype")) + if (strstr(part->name, ".odttf")) xps_deobfuscate_font_resource(ctx, part); - - /* stupid XPS files with content-types after the parts */ - if (!parttype && strstr(part->name, ".odttf")) + if (strstr(part->name, ".ODTTF")) xps_deobfuscate_font_resource(ctx, part); - if (!parttype && strstr(part->name, ".ODTTF")) - xps_deobfuscate_font_resource(ctx, part); - part->deobfuscated = 1; } @@ -698,6 +679,8 @@ xps_parse_glyphs(xps_context_t *ctx, xps_unclip(ctx, &saved_bounds); } + xps_release_part(ctx, part); + return 0; } |