aboutsummaryrefslogtreecommitdiff
path: root/generic/PostScript.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/PostScript.c')
-rw-r--r--generic/PostScript.c394
1 files changed, 197 insertions, 197 deletions
diff --git a/generic/PostScript.c b/generic/PostScript.c
index f8458a6..d1ba9f2 100644
--- a/generic/PostScript.c
+++ b/generic/PostScript.c
@@ -1,8 +1,8 @@
/*
* PostScript.c -- Implementation of PostScript driver.
*
- * Authors : Patrick Lecoanet.
- * Creation date : Tue Jan 3 13:17:17 1995
+ * Authors : Patrick Lecoanet.
+ * Creation date : Tue Jan 3 13:17:17 1995
*
* $Id$
*/
@@ -66,78 +66,78 @@
**********************************************************************************
*/
-static const char rcsid[] = "$Id$";
+static const char rcsid[] = "$Id$";
static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $";
-#define PROLOG_VERSION 1.0
-#define PROLOG_REVISION 0
+#define PROLOG_VERSION 1.0
+#define PROLOG_REVISION 0
-static char ps_prolog[] = "";
+static char ps_prolog[] = "";
typedef struct _ZnPostScriptInfo {
- ZnBBox area; /* Area to print, in device coordinates. */
- ZnReal page_x; /* PostScript coordinates of anchor on page */
- ZnReal page_y;
- ZnReal page_width; /* Printed width and height of output area. */
- ZnReal page_height;
- Tk_Anchor page_anchor; /* Area anchor on Postscript page. */
- ZnBool landscape; /* True means output is rotated ccw by 90 degrees
- * (landscape mode). */
- char *font_var; /* If non-NULL, gives name of global variable
- * containing font mapping information. Malloc'ed. */
- char *color_var; /* If non-NULL, give name of global variable
- * containing color mapping information. Malloc'ed. */
- int colormode; /* Tell how color show be handled: 0 for mono,
- * 1 for gray, 2 for color. */
- char *filename; /* Name of file in which to write PostScript; NULL
- * means return Postscript info as result. Malloc'ed. */
- char *channel_name; /* If -channel is specified, the name of the channel
- * to use. Malloc'ed */
- Tcl_Channel chan; /* Open channel corresponding to fileName. */
- Tcl_HashTable font_table; /* Hash table containing names of all font families
- * used in output. The table values are not used. */
- ZnBool prepass; /* True means that we're currently in
- * the pre-pass that collects font information,
- * so the PostScript generated isn't relevant. */
- ZnBool prolog; /* True means output should contain the file
- * prolog.ps in the header. */
+ ZnBBox area; /* Area to print, in device coordinates. */
+ ZnReal page_x; /* PostScript coordinates of anchor on page */
+ ZnReal page_y;
+ ZnReal page_width; /* Printed width and height of output area. */
+ ZnReal page_height;
+ Tk_Anchor page_anchor; /* Area anchor on Postscript page. */
+ ZnBool landscape; /* True means output is rotated ccw by 90 degrees
+ * (landscape mode). */
+ char *font_var; /* If non-NULL, gives name of global variable
+ * containing font mapping information. Malloc'ed. */
+ char *color_var; /* If non-NULL, give name of global variable
+ * containing color mapping information. Malloc'ed. */
+ int colormode; /* Tell how color show be handled: 0 for mono,
+ * 1 for gray, 2 for color. */
+ char *filename; /* Name of file in which to write PostScript; NULL
+ * means return Postscript info as result. Malloc'ed. */
+ char *channel_name; /* If -channel is specified, the name of the channel
+ * to use. Malloc'ed */
+ Tcl_Channel chan; /* Open channel corresponding to fileName. */
+ Tcl_HashTable font_table; /* Hash table containing names of all font families
+ * used in output. The table values are not used. */
+ ZnBool prepass; /* True means that we're currently in
+ * the pre-pass that collects font information,
+ * so the PostScript generated isn't relevant. */
+ ZnBool prolog; /* True means output should contain the file
+ * prolog.ps in the header. */
} ZnPostScriptInfo;
static int ZnPsDimParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
static Tcl_Obj *ZnPsDimPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
static int ZnPsColorModeParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
static Tcl_Obj *ZnPsColorModePrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
static int ZnBBoxParse _ANSI_ARGS_((ClientData client_data, Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *ovalue,
- char *widget_rec, int offset));
-static Tcl_Obj *ZnBBoxPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
- char *widget_rec, int offset,
- Tcl_FreeProc **free_proc));
+ Tk_Window tkwin, Tcl_Obj *ovalue,
+ char *widget_rec, int offset));
+static Tcl_Obj *ZnBBoxPrint _ANSI_ARGS_((ClientData client_data, Tk_Window tkwin,
+ char *widget_rec, int offset,
+ Tcl_FreeProc **free_proc));
-static Tk_CustomOption psDimOption = {
+static Tk_CustomOption psDimOption = {
(Tk_OptionParseProc *) ZnPsDimParse,
(Tk_OptionPrintProc *) ZnPsDimPrint,
NULL
};
-static Tk_CustomOption psColorModeOption = {
+static Tk_CustomOption psColorModeOption = {
(Tk_OptionParseProc *) ZnPsColorModeParse,
(Tk_OptionPrintProc *) ZnPsColorModePrint,
NULL
};
-static Tk_CustomOption bboxOption = {
+static Tk_CustomOption bboxOption = {
(Tk_OptionParseProc *) ZnBBoxParse,
(Tk_OptionPrintProc *) ZnBBoxPrint,
NULL
@@ -148,33 +148,33 @@ static Tk_CustomOption bboxOption = {
*/
static Tk_ConfigSpec config_specs[] = {
{TK_CONFIG_CUSTOM, "-area", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, area), 0, &bboxOption},
+ "", Tk_Offset(ZnPostScriptInfo, area), 0, &bboxOption},
{TK_CONFIG_STRING, "-colormap", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, color_var), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, color_var), 0, NULL},
{TK_CONFIG_CUSTOM, "-colormode", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, colormode), 0, &psColorModeOption},
+ "", Tk_Offset(ZnPostScriptInfo, colormode), 0, &psColorModeOption},
{TK_CONFIG_STRING, "-file", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, filename), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, filename), 0, NULL},
{TK_CONFIG_STRING, "-channel", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, channel_name), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, channel_name), 0, NULL},
{TK_CONFIG_STRING, "-fontmap", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, font_var), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, font_var), 0, NULL},
{TK_CONFIG_BOOLEAN, "-landscape", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, landscape), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, landscape), 0, NULL},
{TK_CONFIG_ANCHOR, "-pageanchor", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_anchor), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, page_anchor), 0, NULL},
{TK_CONFIG_CUSTOM, "-pageheight", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_height), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_height), 0, &psDimOption},
{TK_CONFIG_CUSTOM, "-pagewidth", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_width), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_width), 0, &psDimOption},
{TK_CONFIG_CUSTOM, "-pagex", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_x), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_x), 0, &psDimOption},
{TK_CONFIG_CUSTOM, "-pagey", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, page_y), 0, &psDimOption},
+ "", Tk_Offset(ZnPostScriptInfo, page_y), 0, &psDimOption},
{TK_CONFIG_BOOLEAN, "-prolog", (char *) NULL, (char *) NULL,
- "", Tk_Offset(ZnPostScriptInfo, prolog), 0, NULL},
+ "", Tk_Offset(ZnPostScriptInfo, prolog), 0, NULL},
{TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0, NULL}
+ (char *) NULL, 0, 0, NULL}
};
@@ -183,26 +183,26 @@ static Tk_ConfigSpec config_specs[] = {
*
* ZnPsDimParse
* ZnPsDimPrint --
- * Converter for the PostScript dimension options
+ * Converter for the PostScript dimension options
* (-pagex, -pagey, -pagewidth, -pageheight).
*
*----------------------------------------------------------------------
*/
static int
-ZnPsDimParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnPsDimParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
ZnReal *dim = (ZnReal *) (widget_rec + offset);
#ifdef PTK
- char *value = Tcl_GetString(ovalue);
+ char *value = Tcl_GetString(ovalue);
#else
- char *value = (char *) ovalue;
+ char *value = (char *) ovalue;
#endif
- char *end;
+ char *end;
double d;
d = strtod(value, &end);
@@ -250,14 +250,14 @@ ZnPsDimParse(ClientData client_data,
}
static Tcl_Obj *
-ZnPsDimPrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
+ZnPsDimPrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
#ifdef PTK
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#else
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#endif
)
{
@@ -284,25 +284,25 @@ ZnPsDimPrint(ClientData client_data,
*
* ZnPsColorModeParse
* ZnPsColorModePrint --
- * Converter for the PostScript -colormode option.
+ * Converter for the PostScript -colormode option.
*
*----------------------------------------------------------------------
*/
static int
-ZnPsColorModeParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnPsColorModeParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
- int *mode = (int *) (widget_rec + offset);
+ int *mode = (int *) (widget_rec + offset);
#ifdef PTK
- char *value = Tcl_GetString(ovalue);
+ char *value = Tcl_GetString(ovalue);
#else
- char *value = (char *) ovalue;
+ char *value = (char *) ovalue;
#endif
- int result = TCL_OK;
+ int result = TCL_OK;
if (value != NULL) {
if (strcmp(value, "monochrome") == 0) {
@@ -316,8 +316,8 @@ ZnPsColorModeParse(ClientData client_data,
}
else {
Tcl_AppendResult(interp, " incorrect PostScript color mode \"",
- value, "\" should be \"monochrome\", \"gray\"",
- " or \"color\"", NULL);
+ value, "\" should be \"monochrome\", \"gray\"",
+ " or \"color\"", NULL);
result = TCL_ERROR;
}
}
@@ -326,14 +326,14 @@ ZnPsColorModeParse(ClientData client_data,
}
static Tcl_Obj *
-ZnPsColorModePrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
- Tcl_FreeProc **free_proc)
+ZnPsColorModePrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
+ Tcl_FreeProc **free_proc)
{
- int *mode = (int *) (widget_rec + offset);
- char *s;
+ int *mode = (int *) (widget_rec + offset);
+ char *s;
switch (*mode) {
case 0: s = "monochrome";
@@ -357,20 +357,20 @@ ZnPsColorModePrint(ClientData client_data,
*
* ZnBBoxParse
* ZnBBoxPrint --
- * Converter for the -area option.
+ * Converter for the -area option.
*
*----------------------------------------------------------------------
*/
static int
-ZnBBoxParse(ClientData client_data,
- Tcl_Interp *interp,
- Tk_Window tkwin,
- Tcl_Obj *ovalue,
- char *widget_rec,
- int offset)
+ZnBBoxParse(ClientData client_data,
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ Tcl_Obj *ovalue,
+ char *widget_rec,
+ int offset)
{
ZnBBox *bbox = (ZnBBox *) (widget_rec + offset);
- int i, result, num_elems;
+ int i, result, num_elems;
Tcl_Obj **elems;
double d[4];
@@ -389,7 +389,7 @@ ZnBBoxParse(ClientData client_data,
for (i = 0; i < 4; i++) {
result = Tcl_GetDoubleFromObj(interp, elems[0], &d[0]);
if (result == TCL_ERROR) {
- goto bbox_error;
+ goto bbox_error;
}
}
bbox->orig.x = d[0];
@@ -402,16 +402,16 @@ ZnBBoxParse(ClientData client_data,
}
static Tcl_Obj *
-ZnBBoxPrint(ClientData client_data,
- Tk_Window tkwin,
- char *widget_rec,
- int offset,
+ZnBBoxPrint(ClientData client_data,
+ Tk_Window tkwin,
+ char *widget_rec,
+ int offset,
#ifdef PTK
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#else
- Tcl_FreeProc **free_proc
+ Tcl_FreeProc **free_proc
#endif
- )
+ )
{
ZnBBox *bbox = (ZnBBox *) (widget_rec + offset);
Tcl_Obj *obj = NULL;
@@ -466,12 +466,12 @@ ZnBBoxPrint(ClientData client_data,
fprintf(ps_info->file, "%%%%Pages: 1\n");
fprintf(ps_info->file, "%%%%DocumentData: Clean7Bit\n");
fprintf(ps_info->file, "%%%%Orientation: %s\n",
- ps_info->landscape ? "Landscape" : "Portrait");
+ ps_info->landscape ? "Landscape" : "Portrait");
fprintf(ps_info->file, "%%%%LanguageLevel: 1\n");
fprintf(ps_info->file, "%%%%DocumentNeededResources: (atend)\n");
fprintf(ps_info->file,
- "%%%%DocumentSuppliedResources: procset Zinc-Widget-Prolog %f %d\n",
- PROLOG_VERSION, PROLOG_REVISION);
+ "%%%%DocumentSuppliedResources: procset Zinc-Widget-Prolog %f %d\n",
+ PROLOG_VERSION, PROLOG_REVISION);
fprintf(ps_info->file, "%%%%EndComments\n\n\n");
/*
@@ -479,7 +479,7 @@ ZnBBoxPrint(ClientData client_data,
*/
fprintf(ps_info->file, "%%%%BeginProlog\n");
fprintf(ps_info->file, "%%%%BeginResource: procset Zinc-Widget-Prolog %f %d\n",
- PROLOG_VERSION, PROLOG_REVISION);
+ PROLOG_VERSION, PROLOG_REVISION);
fwrite(ps_prolog, 1, sizeof(ps_prolog), ps_info->file);
fprintf(ps_info->file, "%%%%EndResource\n");
fprintf(ps_info->file, "%%%%EndProlog\n");
@@ -512,7 +512,7 @@ ZnBBoxPrint(ClientData client_data,
fprintf(ps_info->file, "%%%%Trailer\n");
s = "%%DocumentNeededResources: font ";
for (fs = (XFontStruct *) ZnListArray(ps_info->fonts),
- i = ZnListSize(ps_info->fonts); i > 0; i--, fs++) {
+ i = ZnListSize(ps_info->fonts); i > 0; i--, fs++) {
fprintf(ps_info->file, "%s", s);
s = "%%+ font";
}
@@ -524,14 +524,14 @@ ZnBBoxPrint(ClientData client_data,
*
* ZnPostScriptY --
*
- * Given a y-coordinate in local coordinates, this procedure
- * returns a y-coordinate to use for PostScript output.
+ * Given a y-coordinate in local coordinates, this procedure
+ * returns a y-coordinate to use for PostScript output.
*
*--------------------------------------------------------------
*/
ZnReal
-ZnPostScriptY(ZnReal y,
- void *ps_info)
+ZnPostScriptY(ZnReal y,
+ void *ps_info)
{
return ((ZnPostScriptInfo *) ps_info)->area.corner.y - y;
}
@@ -541,27 +541,27 @@ ZnPostScriptY(ZnReal y,
*
* ZnPostScriptCmd --
*
- * This procedure process the "postscript" command for
- * zinc widgets.
+ * This procedure process the "postscript" command for
+ * zinc widgets.
*
*----------------------------------------------------------------------------
*/
int
-ZnPostScriptCmd(ZnWInfo *wi,
- int argc,
- Tcl_Obj *CONST args[])
+ZnPostScriptCmd(ZnWInfo *wi,
+ int argc,
+ Tcl_Obj *CONST args[])
{
ZnPostScriptInfo ps_info;
- void *old_info;
- int result;
- int delta_x = 0, delta_y = 0;
- ZnReal width, height;
- CONST char *p;
- Tcl_DString buffer;
+ void *old_info;
+ int result;
+ int delta_x = 0, delta_y = 0;
+ ZnReal width, height;
+ CONST char *p;
+ Tcl_DString buffer;
#define STRING_LENGTH 400
- char string[STRING_LENGTH+1];
- ZnBBox *area;
- time_t now;
+ char string[STRING_LENGTH+1];
+ ZnBBox *area;
+ time_t now;
Tcl_HashSearch search;
Tcl_HashEntry *entry;
@@ -599,11 +599,11 @@ ZnPostScriptCmd(ZnWInfo *wi,
Tcl_InitHashTable(&ps_info.font_table, TCL_STRING_KEYS);
result = Tk_ConfigureWidget(wi->interp, wi->win, config_specs, argc-2,
#ifdef PTK
- (Tcl_Obj **) args+2, (char *) &ps_info,
- TK_CONFIG_ARGV_ONLY
+ (Tcl_Obj **) args+2, (char *) &ps_info,
+ TK_CONFIG_ARGV_ONLY
#else
- (CONST char **) args+2, (char *) &ps_info,
- TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS
+ (CONST char **) args+2, (char *) &ps_info,
+ TK_CONFIG_ARGV_ONLY|TK_CONFIG_OBJS
#endif
);
if (result != TCL_OK) {
@@ -722,7 +722,7 @@ ZnPostScriptCmd(ZnWInfo *wi,
}
if ((mode & TCL_WRITABLE) == 0) {
Tcl_AppendResult(wi->interp, "channel \"", ps_info.channel_name,
- "\" wasn't opened for writing", NULL);
+ "\" wasn't opened for writing", NULL);
result = TCL_ERROR;
goto cleanup;
}
@@ -756,68 +756,68 @@ ZnPostScriptCmd(ZnWInfo *wi,
scale_y = ps_info.page_height/ height;
Tcl_AppendResult(wi->interp,
- "%!PS-Adobe-3.0 EPSF-3.0\n",
- "%%Creator: TkZinc Widget\n",
- NULL);
+ "%!PS-Adobe-3.0 EPSF-3.0\n",
+ "%%Creator: TkZinc Widget\n",
+ NULL);
#ifdef HAVE_PW_GECOS
if (!Tcl_IsSafe(wi->interp)) {
struct passwd *pw = getpwuid(getuid());
Tcl_AppendResult(wi->interp,
- "%%For: ", (pw != NULL) ? pw->pw_gecos : "Unknown", "\n",
- NULL);
+ "%%For: ", (pw != NULL) ? pw->pw_gecos : "Unknown", "\n",
+ NULL);
endpwent();
}
#endif /* HAVE_PW_GECOS */
Tcl_AppendResult(wi->interp,
- "%%Title: Window ", Tk_PathName(wi->win), "\n",
- NULL);
+ "%%Title: Window ", Tk_PathName(wi->win), "\n",
+ NULL);
time(&now);
Tcl_AppendResult(wi->interp,
- "%%CreationDate: ", ctime(&now),
- NULL);
+ "%%CreationDate: ", ctime(&now),
+ NULL);
if (!ps_info.landscape) {
sprintf(string, "%d %d %d %d",
- (int) (ps_info.page_x + scale_x*delta_x),
- (int) (ps_info.page_y + scale_y*delta_y),
- (int) (ps_info.page_x + scale_x*(delta_x + width) + 1.0),
- (int) (ps_info.page_y + scale_y*(delta_y + height) + 1.0));
+ (int) (ps_info.page_x + scale_x*delta_x),
+ (int) (ps_info.page_y + scale_y*delta_y),
+ (int) (ps_info.page_x + scale_x*(delta_x + width) + 1.0),
+ (int) (ps_info.page_y + scale_y*(delta_y + height) + 1.0));
} else {
sprintf(string, "%d %d %d %d",
- (int) (ps_info.page_x - scale_x*(delta_y + height)),
- (int) (ps_info.page_y + scale_y*delta_x),
- (int) (ps_info.page_x - scale_x*delta_y + 1.0),
- (int) (ps_info.page_y + scale_y*(delta_x + width) + 1.0));
+ (int) (ps_info.page_x - scale_x*(delta_y + height)),
+ (int) (ps_info.page_y + scale_y*delta_x),
+ (int) (ps_info.page_x - scale_x*delta_y + 1.0),
+ (int) (ps_info.page_y + scale_y*(delta_x + width) + 1.0));
}
Tcl_AppendResult(wi->interp,
- "%%BoundingBox: ", string, "\n",
- NULL);
+ "%%BoundingBox: ", string, "\n",
+ NULL);
Tcl_AppendResult(wi->interp,
- "%%Pages: 1\n",
- "%%DocumentData: Clean7Bit\n",
- NULL);
+ "%%Pages: 1\n",
+ "%%DocumentData: Clean7Bit\n",
+ NULL);
Tcl_AppendResult(wi->interp,
- "%%Orientation: ",
- ps_info.landscape ? "Landscape\n" : "Portrait\n",
- NULL);
+ "%%Orientation: ",
+ ps_info.landscape ? "Landscape\n" : "Portrait\n",
+ NULL);
p = "%%DocumentNeededResources: font ";
for (entry = Tcl_FirstHashEntry(&ps_info.font_table, &search);
- entry != NULL; entry = Tcl_NextHashEntry(&search)) {
+ entry != NULL; entry = Tcl_NextHashEntry(&search)) {
Tcl_AppendResult(wi->interp,
- p, Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
- NULL);
+ p, Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
+ NULL);
p = "%%+ font ";
}
Tcl_AppendResult(wi->interp,
- "%%EndComments\n\n",
- NULL);
+ "%%EndComments\n\n",
+ NULL);
/*
* Insert the prolog
*/
Tcl_AppendResult(wi->interp,
- Tcl_GetVar(wi->interp,"::tk::ps_preamable", TCL_GLOBAL_ONLY),
- NULL);
+ Tcl_GetVar(wi->interp,"::tk::ps_preamable", TCL_GLOBAL_ONLY),
+ NULL);
if (ps_info.chan != NULL) {
/* Tcl_Write(ps_info.chan, Tcl_GetStringResult(wi->interp), -1);*/
@@ -831,18 +831,18 @@ ZnPostScriptCmd(ZnWInfo *wi,
*/
sprintf(string, "/CL %d def\n", ps_info.colormode);
Tcl_AppendResult(wi->interp,
- "%%BeginSetup\n", string,
- NULL);
+ "%%BeginSetup\n", string,
+ NULL);
for (entry = Tcl_FirstHashEntry(&ps_info.font_table, &search);
- entry != NULL; entry = Tcl_NextHashEntry(&search)) {
+ entry != NULL; entry = Tcl_NextHashEntry(&search)) {
Tcl_AppendResult(wi->interp,
- "%%IncludeResource: font ",
- Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
- NULL);
+ "%%IncludeResource: font ",
+ Tcl_GetHashKey(&ps_info.font_table, entry), "\n",
+ NULL);
}
Tcl_AppendResult(wi->interp,
- "%%EndSetup\n\n",
- NULL);
+ "%%EndSetup\n\n",
+ NULL);
/*
*-----------------------------------------------------------
@@ -852,29 +852,29 @@ ZnPostScriptCmd(ZnWInfo *wi,
*-----------------------------------------------------------
*/
Tcl_AppendResult(wi->interp,
- "%%Page: 1 1\n",
- "save\n",
- NULL);
+ "%%Page: 1 1\n",
+ "save\n",
+ NULL);
sprintf(string, "%.1f %.1f translate\n", ps_info.page_x, ps_info.page_y);
Tcl_AppendResult(wi->interp, string, NULL);
if (ps_info.landscape) {
Tcl_AppendResult(wi->interp,
- "90 rotate\n",
- NULL);
+ "90 rotate\n",
+ NULL);
}
sprintf(string, "%.4g %.4g scale\n", scale_x, scale_y);
Tcl_AppendResult(wi->interp, string, NULL);
sprintf(string, "%d %d translate\n",
- (int) (delta_x - area->orig.x), (int) delta_y);
+ (int) (delta_x - area->orig.x), (int) delta_y);
Tcl_AppendResult(wi->interp, string, NULL);
sprintf(string, "%d %.15g moveto %d %.15g lineto %d %.15g lineto %d %.15g",
- (int) area->orig.x, ZnPostScriptY(area->orig.y, &ps_info),
- (int) area->corner.x, ZnPostScriptY(area->orig.y, &ps_info),
- (int) area->corner.x, ZnPostScriptY(area->corner.y, &ps_info),
- (int) area->orig.x, ZnPostScriptY(area->corner.y, &ps_info));
+ (int) area->orig.x, ZnPostScriptY(area->orig.y, &ps_info),
+ (int) area->corner.x, ZnPostScriptY(area->orig.y, &ps_info),
+ (int) area->corner.x, ZnPostScriptY(area->corner.y, &ps_info),
+ (int) area->orig.x, ZnPostScriptY(area->corner.y, &ps_info));
Tcl_AppendResult(wi->interp,
- string, " lineto closepath clip newpath\n",
- NULL);
+ string, " lineto closepath clip newpath\n",
+ NULL);
}
if (ps_info.chan != NULL) {
@@ -898,9 +898,9 @@ ZnPostScriptCmd(ZnWInfo *wi,
*/
if (ps_info.prolog) {
Tcl_AppendResult(wi->interp,
- "restore showpage\n\n",
- "%%Trailer\nend\n%%EOF\n",
- NULL);
+ "restore showpage\n\n",
+ "%%Trailer\nend\n%%EOF\n",
+ NULL);
}
if (ps_info.chan != NULL) {
/* Tcl_Write(ps_info.chan, Tcl_GetStringResult(wi->interp), -1);*/