diff options
41 files changed, 652 insertions, 83 deletions
diff --git a/svg/ghostsvg.h b/svg/ghostsvg.h index e8ef5b190..bde30ad70 100644 --- a/svg/ghostsvg.h +++ b/svg/ghostsvg.h @@ -1,3 +1,18 @@ +/* Copyright (C) 2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* SVG interpreter - combined internal header */ + #include "memory_.h" #include "math_.h" diff --git a/svg/svg.mak b/svg/svg.mak index 4d318b335..720e529bf 100644 --- a/svg/svg.mak +++ b/svg/svg.mak @@ -1,3 +1,17 @@ +# Copyright (C) 2008 Artifex Software, Inc. +# All Rights Reserved. +# +# This software is provided AS-IS with no warranty, either express or +# implied. +# +# This software is distributed under license and may not be copied, modified +# or distributed except as expressly authorized under the terms of that +# license. Refer to licensing information at http://www.artifex.com/ +# or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, +# San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +# +# Platform-independent makefile for the SVG interpreter + SVGSRC = $(SVGSRCDIR)$(D) SVGGEN = $(SVGGENDIR)$(D) SVGOBJ = $(SVGOBJDIR)$(D) @@ -71,4 +85,5 @@ $(SVGOBJ)svg.dev: $(SVG_MAK) $(ECHOGS_XE) $(SVG_OBJS) \ $(SVGGEN)pl.dev $(SVGGEN)$(PL_SCALER).dev $(SVGGEN)pjl.dev $(SETMOD) $(SVGOBJ)svg $(SVG_OBJS) $(ADDMOD) $(SVGOBJ)svg -include $(SVGGEN)expat $(SVGGEN)pl $(SVGGEN)$(PL_SCALER) $(SVGGEN)pjl.dev + $(ADDMOD) $(SVGOBJ)svg -lib profiler diff --git a/svg/svg_gcc.mak b/svg/svg_gcc.mak index a417ea8a6..cde4ee088 100644 --- a/svg/svg_gcc.mak +++ b/svg/svg_gcc.mak @@ -1,3 +1,17 @@ +# Copyright (C) 2008 Artifex Software, Inc. +# All Rights Reserved. +# +# This software is provided AS-IS with no warranty, either express or +# implied. +# +# This software is distributed under license and may not be copied, modified +# or distributed except as expressly authorized under the terms of that +# license. Refer to licensing information at http://www.artifex.com/ +# or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, +# San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +# +# GNU makefile for the SVG interpreter + # The "?=" style of this makefile is designed to facilitate "deriving" # your own make file from it by setting your own custom options, then include'ing # this file. In its current form, this file will compile using default options diff --git a/svg/svg_msvc.mak b/svg/svg_msvc.mak index 58dc6fa1d..db8d25192 100644 --- a/svg/svg_msvc.mak +++ b/svg/svg_msvc.mak @@ -1,3 +1,17 @@ +# Copyright (C) 2008 Artifex Software, Inc. +# All Rights Reserved. +# +# This software is provided AS-IS with no warranty, either express or +# implied. +# +# This software is distributed under license and may not be copied, modified +# or distributed except as expressly authorized under the terms of that +# license. Refer to licensing information at http://www.artifex.com/ +# or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, +# San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +# +# 'nmake' build file for the SVG interpreter + # Define the name of this makefile. MAKEFILE= $(MAKEFILE) ..\svg\svg_msvc.mak diff --git a/svg/svgcolor.c b/svg/svgcolor.c index 65eb80b4b..fd57f60bb 100644 --- a/svg/svgcolor.c +++ b/svg/svgcolor.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* SVG interpreter - color support */ + #include "ghostsvg.h" /* Color keywords (white, blue, fuchsia) @@ -113,3 +128,4 @@ svg_parse_color(char *str, float *rgb) return gs_throw1(-1, "cannot recognize color syntax: '%s'", str); } + diff --git a/svg/svgcolorlist.h b/svg/svgcolorlist.h index 6f0f17415..d94a8f8f1 100644 --- a/svg/svgcolorlist.h +++ b/svg/svgcolorlist.h @@ -1,3 +1,18 @@ +/* Copyright (C) 2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* SVG interpreter - named colors from the specification */ + { "aliceblue", 240, 248, 255 }, { "antiquewhite", 250, 235, 215 }, { "aqua", 0, 255, 255 }, diff --git a/svg/svgdoc.c b/svg/svgdoc.c index ebd0b8202..16eeac8f5 100644 --- a/svg/svgdoc.c +++ b/svg/svgdoc.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* SVG interpreter - document parsing */ + #include "ghostsvg.h" int @@ -251,7 +266,7 @@ svg_parse_document(svg_context_t *ctx, svg_item_t *root) height = svg_parse_length(height_att, vb_height, 12); if (version > 12) - gs_warn("svg document version is newer than we support"); + gs_warn("svg document version is newer than we support"); /* Setup new page */ { @@ -297,7 +312,7 @@ svg_parse_document(svg_context_t *ctx, svg_item_t *root) code = gs_erasepage(pgs); if (code < 0) return gs_rethrow(code, "cannot clear page"); - + gs_setcolorspace(ctx->pgs, ctx->srgb); } diff --git a/svg/svgshapes.c b/svg/svgshapes.c index 2dd4c7509..a18ee9500 100644 --- a/svg/svgshapes.c +++ b/svg/svgshapes.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* SVG interpreter - vector art support */ + #include "ghostsvg.h" static void svg_fill(svg_context_t *ctx) @@ -65,7 +80,7 @@ svg_parse_rect(svg_context_t *ctx, svg_item_t *node) gs_closepath(ctx->pgs); svg_fill(ctx); } - + if (ctx->stroke_is_set) { gs_moveto(ctx->pgs, x, y); @@ -75,7 +90,7 @@ svg_parse_rect(svg_context_t *ctx, svg_item_t *node) gs_closepath(ctx->pgs); svg_stroke(ctx); } - + return 0; } @@ -109,7 +124,7 @@ svg_parse_circle(svg_context_t *ctx, svg_item_t *node) gs_closepath(ctx->pgs); svg_fill(ctx); } - + if (ctx->stroke_is_set) { gs_moveto(ctx->pgs, cx + r, cy); diff --git a/svg/svgtop.c b/svg/svgtop.c index 4c0f1d636..440be835d 100644 --- a/svg/svgtop.c +++ b/svg/svgtop.c @@ -1,16 +1,15 @@ -/* Portions Copyright (C) 2001 artofcode LLC. - Portions Copyright (C) 1996, 2001 Artifex Software Inc. - Portions Copyright (C) 1988, 2000 Aladdin Enterprises. - This software is based in part on the work of the Independent JPEG Group. +/* Copyright (C) 2008 Artifex Software, Inc. All Rights Reserved. + This software is provided AS-IS with no warranty, either express or + implied. + This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that - license. Refer to licensing information at http://www.artifex.com/ or - contact Artifex Software, Inc., 101 Lucas Valley Road #110, - San Rafael, CA 94903, (415)492-9861, for further information. */ - -/*$Id$*/ + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ /* Top-level API implementation of Scalable Vector Graphics (SVG) */ @@ -56,7 +55,7 @@ svg_imp_characteristics(const pl_interp_implementation_t *pimpl) { static pl_interp_characteristics_t svg_characteristics = { - "SVG", + "SVG", "<?xml", /* string to recognize SVG files */ "Artifex", SVG_VERSION, @@ -66,7 +65,7 @@ svg_imp_characteristics(const pl_interp_implementation_t *pimpl) return &svg_characteristics; } -static int +static int svg_imp_allocate_interp(pl_interp_t **ppinterp, const pl_interp_implementation_t *pimpl, gs_memory_t *pmem) @@ -221,7 +220,7 @@ cleanup_setdevice: return code; } -static int +static int svg_imp_get_device_memory(pl_interp_instance_t *pinstance, gs_memory_t **ppmem) { /* huh? we do nothing here */ @@ -232,12 +231,12 @@ svg_imp_get_device_memory(pl_interp_instance_t *pinstance, gs_memory_t **ppmem) static int svg_imp_process(pl_interp_instance_t *pinstance, stream_cursor_read *buf) { - svg_interp_instance_t *instance = (svg_interp_instance_t *)pinstance; + svg_interp_instance_t *instance = (svg_interp_instance_t *)pinstance; svg_context_t *ctx = instance->ctx; int code; code = svg_feed_xml_parser(ctx, (const char*)buf->ptr + 1, buf->limit - buf->ptr); - + buf->ptr = buf->limit; return code; @@ -381,7 +380,7 @@ const pl_interp_implementation_t svg_implementation = svg_imp_get_device_memory, }; -/* +/* * End-of-page function called by SVG parser. */ int @@ -407,7 +406,7 @@ svg_show_page(svg_context_t *ctx, int num_copies, int flush) if (code < 0) return code; - /* do post-page action */ + /* do post-page action */ if (instance->post_page_action) { code = instance->post_page_action(pinstance, instance->post_page_closure); diff --git a/svg/svgtransform.c b/svg/svgtransform.c index e987a80ff..8ff76cbb9 100644 --- a/svg/svgtransform.c +++ b/svg/svgtransform.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* SVG interpreter - coordinate transformations */ + #include "ghostsvg.h" int svg_parse_transform(svg_context_t *ctx, char *str) diff --git a/svg/svgtypes.c b/svg/svgtypes.c index 68684b503..14c3ba776 100644 --- a/svg/svgtypes.c +++ b/svg/svgtypes.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* SVG interpreter - data type parsing */ + #include "ghostsvg.h" int svg_is_whitespace_or_comma(int c) @@ -29,13 +44,13 @@ svg_parse_length(char *str, float percent, float font_size) { char *end; float val; - + val = strtof(str, &end); if (end == str) return 0; /* failed */ - + if (!strcmp(end, "px")) return val; - + if (!strcmp(end, "pt")) return val * 1.0; if (!strcmp(end, "pc")) return val * 12.0; if (!strcmp(end, "mm")) return val * 2.83464567; @@ -44,13 +59,13 @@ svg_parse_length(char *str, float percent, float font_size) if (!strcmp(end, "em")) return val * font_size; if (!strcmp(end, "ex")) return val * font_size * 0.5; - + if (!strcmp(end, "%")) return val * percent * 0.01; - + if (end[0] == 0) return val; - + return 0; } @@ -60,11 +75,11 @@ svg_parse_angle(char *str) { char *end; float val; - + val = strtof(str, &end); if (end == str) return 0; /* failed */ - + if (!strcmp(end, "deg")) return val; diff --git a/svg/svgxml.c b/svg/svgxml.c index 6384a3260..9d00747e4 100644 --- a/svg/svgxml.c +++ b/svg/svgxml.c @@ -1,3 +1,16 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + /* Recursive descent XML parsing API on top of Expat. */ #include "ghostsvg.h" diff --git a/xps/ghostxps.h b/xps/ghostxps.h index f6939db86..99ff8458d 100644 --- a/xps/ghostxps.h +++ b/xps/ghostxps.h @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* combined internal header for the XPS interpreter */ + #include "memory_.h" #include "math_.h" diff --git a/xps/xps.mak b/xps/xps.mak index 21b384fbe..77a954b50 100644 --- a/xps/xps.mak +++ b/xps/xps.mak @@ -1,3 +1,17 @@ +# Copyright (C) 2006-2008 Artifex Software, Inc. +# All Rights Reserved. +# +# This software is provided AS-IS with no warranty, either express or +# implied. +# +# This software is distributed under license and may not be copied, modified +# or distributed except as expressly authorized under the terms of that +# license. Refer to licensing information at http://www.artifex.com/ +# or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, +# San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +# +# Platform-independent makefile for the XPS interpreter + XPSSRC = $(XPSSRCDIR)$(D) XPSGEN = $(XPSGENDIR)$(D) XPSOBJ = $(XPSOBJDIR)$(D) diff --git a/xps/xps_gcc.mak b/xps/xps_gcc.mak index 60583b09c..794c775c8 100644 --- a/xps/xps_gcc.mak +++ b/xps/xps_gcc.mak @@ -1,3 +1,17 @@ +# Copyright (C) 2006-2008 Artifex Software, Inc. +# All Rights Reserved. +# +# This software is provided AS-IS with no warranty, either express or +# implied. +# +# This software is distributed under license and may not be copied, modified +# or distributed except as expressly authorized under the terms of that +# license. Refer to licensing information at http://www.artifex.com/ +# or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, +# San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +# +# GNU makefile for the XPS interpreter + # The "?=" style of this makefile is designed to facilitate "deriving" # your own make file from it by setting your own custom options, then include'ing # this file. In its current form, this file will compile using default options diff --git a/xps/xps_msvc.mak b/xps/xps_msvc.mak index b362b1738..ef99ad1d5 100644 --- a/xps/xps_msvc.mak +++ b/xps/xps_msvc.mak @@ -1,3 +1,17 @@ +# Copyright (C) 2006-2008 Artifex Software, Inc. +# All Rights Reserved. +# +# This software is provided AS-IS with no warranty, either express or +# implied. +# +# This software is distributed under license and may not be copied, modified +# or distributed except as expressly authorized under the terms of that +# license. Refer to licensing information at http://www.artifex.com/ +# or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, +# San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +# +# 'nmake' build file for the XPS interpreter + # Define the name of this makefile. MAKEFILE= $(MAKEFILE) ..\xps\xps_msvc.mak @@ -129,4 +143,4 @@ GX_COLOR_INDEX_DEFINE=-DGX_COLOR_INDEX_TYPE="unsigned long long" # Subsystems # this is already in pcl6_gcc.mak #include $(XPSSRCDIR)\xps.mak -!include $(PSSRCDIR)\expat.mak
\ No newline at end of file +!include $(PSSRCDIR)\expat.mak diff --git a/xps/xpscff.c b/xps/xpscff.c index 2fdd598ac..1a2860408 100644 --- a/xps/xpscff.c +++ b/xps/xpscff.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - cff font support */ + #include "ghostxps.h" /* diff --git a/xps/xpscolor.c b/xps/xpscolor.c index 75fa28b45..eb214760e 100644 --- a/xps/xpscolor.c +++ b/xps/xpscolor.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - color functions */ + #include "ghostxps.h" #include "stream.h" /* for sizeof(stream) to work */ diff --git a/xps/xpscommon.c b/xps/xpscommon.c index d96444dd4..afe42be7c 100644 --- a/xps/xpscommon.c +++ b/xps/xpscommon.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - common parse functions */ + #include "ghostxps.h" int diff --git a/xps/xpscrc.c b/xps/xpscrc.c index 633f40625..b2675b7cc 100644 --- a/xps/xpscrc.c +++ b/xps/xpscrc.c @@ -1,6 +1,17 @@ -/* - * Compute the CRC-32 of a data buffer - */ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - CRC-32 implementation */ #include "ghostxps.h" diff --git a/xps/xpsdoc.c b/xps/xpsdoc.c index c16440463..b62dd11ff 100644 --- a/xps/xpsdoc.c +++ b/xps/xpsdoc.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - document parsing */ + #include "ghostxps.h" #include <expat.h> @@ -408,7 +423,7 @@ xps_free_used_parts(xps_context_t *ctx) xps_part_t *part = ctx->first_part; while (part) - { + { xps_part_t *next = part->next; xps_free_part_caches(ctx, part); part = next; @@ -681,7 +696,7 @@ xps_parse_content_relations_imp(void *zp, char *ns_name, char **atts) char path[1024]; char *name; int i; - + name = strchr(ns_name, ' '); if (name) name ++; @@ -950,4 +965,3 @@ xps_process_part(xps_context_t *ctx, xps_part_t *part) return 0; } - diff --git a/xps/xpsfont.c b/xps/xpsfont.c index fa3e0ca3f..7b04166a1 100644 --- a/xps/xpsfont.c +++ b/xps/xpsfont.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - general font functions */ + #include "ghostxps.h" /* diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c index f8c6cc8ae..19ecbf9f4 100644 --- a/xps/xpsglyphs.c +++ b/xps/xpsglyphs.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - */ + #include "ghostxps.h" #include <ctype.h> @@ -32,12 +47,12 @@ void xps_debug_path(xps_context_t *ctx) switch (seg->type) { case s_start: - dprintf2("%g %g moveto\n", + dprintf2("%g %g moveto\n", fixed2float(seg->pt.x) * 0.001, fixed2float(seg->pt.y) * 0.001); break; case s_line: - dprintf2("%g %g lineto\n", + dprintf2("%g %g lineto\n", fixed2float(seg->pt.x) * 0.001, fixed2float(seg->pt.y) * 0.001); break; @@ -46,7 +61,7 @@ void xps_debug_path(xps_context_t *ctx) break; case s_curve: cseg = (curve_segment*)seg; - dprintf6("%g %g %g %g %g %g curveto\n", + dprintf6("%g %g %g %g %g %g curveto\n", fixed2float(cseg->p1.x) * 0.001, fixed2float(cseg->p1.y) * 0.001, fixed2float(cseg->p2.x) * 0.001, @@ -234,18 +249,18 @@ int xps_flush_text_buffer(xps_context_t *ctx, xps_font_t *font, * * Indices syntax: - GlyphIndices = GlyphMapping ( ";" GlyphMapping ) - GlyphMapping = ( [ClusterMapping] GlyphIndex ) [GlyphMetrics] - ClusterMapping = "(" ClusterCodeUnitCount [":" ClusterGlyphCount] ")" - ClusterCodeUnitCount = * DIGIT - ClusterGlyphCount = * DIGIT - GlyphIndex = * DIGIT - GlyphMetrics = "," AdvanceWidth ["," uOffset ["," vOffset]] - AdvanceWidth = ["+"] RealNum - uOffset = ["+" | "-"] RealNum - vOffset = ["+" | "-"] RealNum - RealNum = ((DIGIT ["." DIGIT]) | ("." DIGIT)) [Exponent] - Exponent = ( ("E"|"e") ("+"|"-") DIGIT ) + GlyphIndices = GlyphMapping ( ";" GlyphMapping ) + GlyphMapping = ( [ClusterMapping] GlyphIndex ) [GlyphMetrics] + ClusterMapping = "(" ClusterCodeUnitCount [":" ClusterGlyphCount] ")" + ClusterCodeUnitCount = * DIGIT + ClusterGlyphCount = * DIGIT + GlyphIndex = * DIGIT + GlyphMetrics = "," AdvanceWidth ["," uOffset ["," vOffset]] + AdvanceWidth = ["+"] RealNum + uOffset = ["+" | "-"] RealNum + vOffset = ["+" | "-"] RealNum + RealNum = ((DIGIT ["." DIGIT]) | ("." DIGIT)) [Exponent] + Exponent = ( ("E"|"e") ("+"|"-") DIGIT ) */ diff --git a/xps/xpsgradient.c b/xps/xpsgradient.c index 9bcc9cdc3..acbafee05 100644 --- a/xps/xpsgradient.c +++ b/xps/xpsgradient.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - gradient support */ + #include "ghostxps.h" #include "../icclib/icc.h" diff --git a/xps/xpshdp.c b/xps/xpshdp.c index dcfa9f0ee..33cc2aeb0 100644 --- a/xps/xpshdp.c +++ b/xps/xpshdp.c @@ -1,8 +1,23 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - HD-Photo support */ + #include "ghostxps.h" /* HD-Photo decoder should go here. */ -int +int xps_decode_hdphoto(gs_memory_t *mem, byte *buf, int len, xps_image_t *image) { return gs_throw(-1, "HD-Photo codec is not available"); diff --git a/xps/xpsimage.c b/xps/xpsimage.c index a8b3518ad..36795010a 100644 --- a/xps/xpsimage.c +++ b/xps/xpsimage.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - image support */ + #include "ghostxps.h" static void diff --git a/xps/xpsjpeg.c b/xps/xpsjpeg.c index 55b9c99e2..07df77349 100644 --- a/xps/xpsjpeg.c +++ b/xps/xpsjpeg.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - JPEG image support */ + #include "ghostxps.h" #include "stream.h" diff --git a/xps/xpsmem.c b/xps/xpsmem.c index df79ceb3f..fa34f0c08 100644 --- a/xps/xpsmem.c +++ b/xps/xpsmem.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - string manipulation functions */ + #include "ghostxps.h" static inline int diff --git a/xps/xpsopacity.c b/xps/xpsopacity.c index 59613bcb0..0b83344b5 100644 --- a/xps/xpsopacity.c +++ b/xps/xpsopacity.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - transparency support */ + #include "ghostxps.h" int diff --git a/xps/xpspage.c b/xps/xpspage.c index e76c4d10b..19df52b8d 100644 --- a/xps/xpspage.c +++ b/xps/xpspage.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - page parsing */ + #include "ghostxps.h" int xps_parse_canvas(xps_context_t *ctx, xps_resource_t *dict, xps_item_t *root) @@ -139,7 +154,7 @@ xps_parse_fixed_page(xps_context_t *ctx, xps_part_t *part) code = param_write_float_array((gs_param_list *)&list, ".MediaSize", &fa); if ( code >= 0 ) - { + { gs_c_param_list_read(&list); code = gs_putdeviceparams(dev, (gs_param_list *)&list); } diff --git a/xps/xpspath.c b/xps/xpspath.c index 5d33e0ec2..ecbbf6e94 100644 --- a/xps/xpspath.c +++ b/xps/xpspath.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - path (vector drawing) support */ + #include "ghostxps.h" static void diff --git a/xps/xpspng.c b/xps/xpspng.c index b464a51fe..b039952d5 100644 --- a/xps/xpspng.c +++ b/xps/xpspng.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - PNG image support */ + #include "ghostxps.h" #include "stream.h" diff --git a/xps/xpsresource.c b/xps/xpsresource.c index f5858f86f..7c8f8d747 100644 --- a/xps/xpsresource.c +++ b/xps/xpsresource.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - resource functions */ + #include "ghostxps.h" int diff --git a/xps/xpstiff.c b/xps/xpstiff.c index a1ffcc45f..1412be918 100644 --- a/xps/xpstiff.c +++ b/xps/xpstiff.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - TIFF image support */ + #include "ghostxps.h" #include "stream.h" @@ -774,7 +789,7 @@ xps_read_tiff_tag_value(unsigned *p, xps_tiff_t *tiff, unsigned type, unsigned o } } -static int +static int xps_read_tiff_tag(gs_memory_t *mem, xps_tiff_t *tiff, unsigned offset) { unsigned tag; @@ -906,7 +921,7 @@ xps_swap_byte_order(byte *buf, int n) } } -int +int xps_decode_tiff(gs_memory_t *mem, byte *buf, int len, xps_image_t *image) { int error; diff --git a/xps/xpstile.c b/xps/xpstile.c index 5a02a5db8..baca5f45f 100644 --- a/xps/xpstile.c +++ b/xps/xpstile.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - tiles for pattern rendering */ + #include "ghostxps.h" /* diff --git a/xps/xpstop.c b/xps/xpstop.c index 715834e17..1730a816a 100644 --- a/xps/xpstop.c +++ b/xps/xpstop.c @@ -1,16 +1,15 @@ -/* Portions Copyright (C) 2001 artofcode LLC. - Portions Copyright (C) 1996, 2001 Artifex Software Inc. - Portions Copyright (C) 1988, 2000 Aladdin Enterprises. - This software is based in part on the work of the Independent JPEG Group. +/* Copyright (C) 2006-2008 Artifex Software, Inc. All Rights Reserved. + This software is provided AS-IS with no warranty, either express or + implied. + This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that - license. Refer to licensing information at http://www.artifex.com/ or - contact Artifex Software, Inc., 101 Lucas Valley Road #110, - San Rafael, CA 94903, (415)492-9861, for further information. */ - -/*$Id$*/ + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ /* Top-level API implementation of XML Paper Specification */ @@ -56,7 +55,7 @@ xps_imp_characteristics(const pl_interp_implementation_t *pimpl) { static pl_interp_characteristics_t xps_characteristics = { - "XPS", + "XPS", "PK", /* string to recognize XPS files */ "Artifex", XPS_VERSION, @@ -66,7 +65,7 @@ xps_imp_characteristics(const pl_interp_implementation_t *pimpl) return &xps_characteristics; } -static int +static int xps_imp_allocate_interp(pl_interp_t **ppinterp, const pl_interp_implementation_t *pimpl, gs_memory_t *pmem) @@ -212,7 +211,7 @@ cleanup_setdevice: return code; } -static int +static int xps_imp_get_device_memory(pl_interp_instance_t *pinstance, gs_memory_t **ppmem) { /* huh? we do nothing here */ @@ -223,7 +222,7 @@ xps_imp_get_device_memory(pl_interp_instance_t *pinstance, gs_memory_t **ppmem) static int xps_imp_process(pl_interp_instance_t *pinstance, stream_cursor_read *pcursor) { - xps_interp_instance_t *instance = (xps_interp_instance_t *)pinstance; + xps_interp_instance_t *instance = (xps_interp_instance_t *)pinstance; xps_context_t *ctx = instance->ctx; return xps_process_data(ctx, pcursor); } @@ -422,7 +421,7 @@ const pl_interp_implementation_t xps_implementation = xps_imp_get_device_memory, }; -/* +/* * End-of-page function called by XPS parser. */ int @@ -448,7 +447,7 @@ xps_show_page(xps_context_t *ctx, int num_copies, int flush) if (code < 0) return code; - /* do post-page action */ + /* do post-page action */ if (instance->post_page_action) { code = instance->post_page_action(pinstance, instance->post_page_closure); @@ -530,5 +529,3 @@ xps_install_halftone(xps_context_t *ctx, gx_device *pdevice) return 0; } - - diff --git a/xps/xpsttf.c b/xps/xpsttf.c index 275dccd07..cfac65349 100644 --- a/xps/xpsttf.c +++ b/xps/xpsttf.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - truetype font support */ + #include "ghostxps.h" #include <gxfont.h> @@ -132,7 +147,7 @@ xps_true_callback_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *ps } else { - return gs_throw1(-1, "glyph index %d out of range", glyph); + return gs_throw1(-1, "glyph index %d out of range", glyph); } } diff --git a/xps/xpsutf.c b/xps/xpsutf.c index fa972942a..76af7a653 100644 --- a/xps/xpsutf.c +++ b/xps/xpsutf.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - unicode text functions */ + #include "ghostxps.h" /* @@ -49,6 +64,6 @@ int xps_utf8_to_ucs(int *p, const char *ss, int n) bad: *p = 0x80; - return 1; + return 1; } diff --git a/xps/xpsvisual.c b/xps/xpsvisual.c index 3d42df57d..45f245138 100644 --- a/xps/xpsvisual.c +++ b/xps/xpsvisual.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - visual brush functions */ + #include "ghostxps.h" enum { TILE_NONE, TILE_TILE, TILE_FLIP_X, TILE_FLIP_Y, TILE_FLIP_X_Y }; diff --git a/xps/xpsxml.c b/xps/xpsxml.c index f1fff4b0c..d71fbee74 100644 --- a/xps/xpsxml.c +++ b/xps/xpsxml.c @@ -1,3 +1,16 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + /* Recursive descent XML parsing API on top of Expat. */ #include "ghostxps.h" @@ -51,30 +64,30 @@ static void on_open_tag(void *zp, const char *ns_name, const char **atts) if (parser->error) return; - + /* check namespace */ - + name = NULL; - + p = strstr(ns_name, NS_XPS); if (p == ns_name) { name = strchr(ns_name, ' ') + 1; } - + p = strstr(ns_name, NS_MC); if (p == ns_name) { name = strchr(ns_name, ' ') + 1; parser->compat = 1; } - + if (!name) { dprintf1("unknown namespace: %s\n", ns_name); name = ns_name; } - + /* count size to alloc */ namelen = strlen(name) + 1; /* zero terminated */ @@ -236,7 +249,7 @@ xps_parse_xml(xps_context_t *ctx, char *buf, int len) } XML_ParserFree(xp); - + if (parser.compat) xps_process_compatibility(ctx, parser.root); @@ -321,7 +334,7 @@ xps_debug_item_imp(xps_item_t *item, int level, int loop) } item = item->next; - + if (!loop) return; } @@ -332,3 +345,4 @@ xps_debug_item(xps_item_t *item, int level) { xps_debug_item_imp(item, level, 0); } + diff --git a/xps/xpszip.c b/xps/xpszip.c index 410d1e868..8f6bc6251 100644 --- a/xps/xpszip.c +++ b/xps/xpszip.c @@ -1,3 +1,18 @@ +/* Copyright (C) 2006-2008 Artifex Software, Inc. + All Rights Reserved. + + This software is provided AS-IS with no warranty, either express or + implied. + + This software is distributed under license and may not be copied, modified + or distributed except as expressly authorized under the terms of that + license. Refer to licensing information at http://www.artifex.com/ + or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, + San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. +*/ + +/* XPS interpreter - zip container parsing */ + #include "ghostxps.h" #define ZIP_LOCAL_FILE_SIG 0x04034b50 @@ -68,7 +83,7 @@ xps_zip_alloc_items(xps_context_t *ctx, int items, int size) return xps_alloc(ctx, items * size); } -static void +static void xps_zip_free(xps_context_t *ctx, void *ptr) { xps_free(ctx, ptr); |