From 6652de2af572eba6fd91804878a72d1df9cd1286 Mon Sep 17 00:00:00 2001 From: Roland Mainz Date: Mon, 3 Jan 2005 01:06:36 +0000 Subject: xc/lib/XprintAppUtil/xpapputil.c xc/lib/XprintAppUtil/xpapputil.h xc/lib/XprintUtil/xprintutil.c xc/lib/XprintUtil/xprintutil.h xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/commands.c xc/programs/xlogo/print.c xc/programs/xlsfonts/xlsfonts.c xc/programs/xlsfonts/xlsfonts.man xc/programs/xlsfonts/xlsfonts.sgml xc/programs/xman/Xman-xprint.ad xc/programs/xman/handler.c xc/programs/xman/print.c xc/programs/xman/print.h xc/programs/xmore/XMore.ad xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xmore/printdialog.h xc/programs/xmore/printdialogprivates.h xc/programs/xmore/xmore.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c xc/programs/xplsprinters/xplsprinters.c //bugs.freedesktop.org/show_bug.cgi?id=1706) attachment #1615 (https://bugs.freedesktop.org/attachment.cgi?id=1615): XprintUtils 2004/Q3 update. This adds various new features to the XprintUtils library including support for page resolutions where X_resolution!=Y_resolution, listfonts-mode control and initial framework for the COLORSPACE extension. Patch by Roland Mainz and Julien Lafon . --- xpawhelloworld/xpawhelloworld.c | 11 ++++++----- xphelloworld/xphelloworld.c | 2 +- xpsimplehelloworld/xpsimplehelloworld.c | 7 ++++--- xpxmhelloworld/xpxmhelloworld.c | 11 ++++++----- xpxthelloworld/xpxthelloworld.c | 9 +++++---- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/xpawhelloworld/xpawhelloworld.c b/xpawhelloworld/xpawhelloworld.c index 281c310..a480255 100644 --- a/xpawhelloworld/xpawhelloworld.c +++ b/xpawhelloworld/xpawhelloworld.c @@ -246,7 +246,8 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char shell, print_shell, hello; - long dpi; + long dpi_x = 0L, + dpi_y = 0L; char fontname[256]; /* BUG: is this really big enougth ? */ XFontStruct *textFont; XmFontList textFontList; @@ -270,7 +271,7 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char XpSetContext(pdpy, pcontext); /* Get default printer resolution */ - if( XpuGetResolution(pdpy, pcontext, &dpi) != 1 ) + if( XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1 ) { fprintf(stderr, "No default resolution for printer '%s'\n", printername); XpuClosePrinterDisplay(pdpy, pcontext); @@ -285,7 +286,7 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char if( !pdpy ) Error(("XOpenDisplay failure.\n")); - dpi = 0; + dpi_x = dpi_y = 0L; pscreen = XDefaultScreenOfDisplay(pdpy); } @@ -321,11 +322,11 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char shell = toplevel; } - sprintf(fontname, "-adobe-courier-medium-r-normal--40-*-%ld-%ld-*-*-iso8859-1", dpi, dpi); + sprintf(fontname, "-adobe-courier-medium-r-normal--40-*-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); textFont = XLoadQueryFont(pdpy, fontname); if( !textFont ) { - sprintf(fontname, "-*-*-*-*-*-*-*-160-%ld-%ld-*-*-iso8859-1", dpi, dpi); + sprintf(fontname, "-*-*-*-*-*-*-*-160-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); textFont = XLoadQueryFont(pdpy, fontname); } if( !textFont ) diff --git a/xphelloworld/xphelloworld.c b/xphelloworld/xphelloworld.c index 066ceb4..c796d29 100644 --- a/xphelloworld/xphelloworld.c +++ b/xphelloworld/xphelloworld.c @@ -165,7 +165,7 @@ int do_hello_world( const char *printername, const char *printerargs, const char /* usual rendering stuff..... */ - sprintf(fontname, "-*-*-*-*-*-*-*-180-%ld-%ld-*-*-iso8859-1", context->document_dpi, context->document_dpi); + sprintf(fontname, "-*-*-*-*-*-*-*-180-%ld-%ld-*-*-iso8859-1", context->document_dpi_x, context->document_dpi_y); font = XLoadQueryFont(context->pdpy, fontname); XSetFont(context->pdpy, pgc, font->fid); if (!hello_world_message) diff --git a/xpsimplehelloworld/xpsimplehelloworld.c b/xpsimplehelloworld/xpsimplehelloworld.c index 064894c..79bdb48 100644 --- a/xpsimplehelloworld/xpsimplehelloworld.c +++ b/xpsimplehelloworld/xpsimplehelloworld.c @@ -87,7 +87,8 @@ int do_hello_world(const char *printername, const char *printerfile, const char void *printtofile_handle; /* "context" when printing to file */ int xp_event_base, /* XpExtension even base */ xp_error_base; /* XpExtension error base */ - long dpi; + long dpi_x = 0L, + dpi_y = 0L; Screen *pscreen; int pscreennumber; Window pwin; @@ -131,7 +132,7 @@ int do_hello_world(const char *printername, const char *printerfile, const char XpSetContext(pdpy, pcontext); /* Get default printer reolution */ - if( XpuGetResolution(pdpy, pcontext, &dpi) != 1 ) + if( XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1 ) { fprintf(stderr, "No default resolution for printer '%s'.\n", printername); XpuClosePrinterDisplay(pdpy, pcontext); @@ -199,7 +200,7 @@ int do_hello_world(const char *printername, const char *printerfile, const char /* usual rendering stuff..... */ - sprintf(fontname, "-*-*-*-*-*-*-*-180-%ld-%ld-*-*-iso8859-1", dpi, dpi); + sprintf(fontname, "-*-*-*-*-*-*-*-180-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); font = XLoadQueryFont(pdpy, fontname); XSetFont(pdpy, pgc, font->fid); XDrawString(pdpy, pwin, pgc, 100, 100, "hello world from X11 print system", 33); diff --git a/xpxmhelloworld/xpxmhelloworld.c b/xpxmhelloworld/xpxmhelloworld.c index 608c385..e142fc1 100644 --- a/xpxmhelloworld/xpxmhelloworld.c +++ b/xpxmhelloworld/xpxmhelloworld.c @@ -269,7 +269,8 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char shell, print_shell, hello; - long dpi; + long dpi_x = 0L, + dpi_y = 0L; char fontname[256]; /* BUG: is this really big enougth ? */ XFontStruct *textFont; XmFontList textFontList; @@ -293,7 +294,7 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char XpSetContext(pdpy, pcontext); /* Get default printer resolution */ - if( XpuGetResolution(pdpy, pcontext, &dpi) != 1 ) + if( XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1 ) { fprintf(stderr, "No default resolution for printer '%s'\n", printername); XpuClosePrinterDisplay(pdpy, pcontext); @@ -308,7 +309,7 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char if( !pdpy ) Error(("XOpenDisplay failure.\n")); - dpi = 0; + dpi_x = dpi_y = 0L; pscreen = XDefaultScreenOfDisplay(pdpy); } @@ -339,11 +340,11 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char shell = toplevel; } - sprintf(fontname, "-adobe-courier-medium-r-normal--40-*-%ld-%ld-*-*-iso8859-1", dpi, dpi); + sprintf(fontname, "-adobe-courier-medium-r-normal--40-*-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); textFont = XLoadQueryFont(pdpy, fontname); if( !textFont ) { - sprintf(fontname, "-*-*-*-*-*-*-*-160-%ld-%ld-*-*-iso8859-1", dpi, dpi); + sprintf(fontname, "-*-*-*-*-*-*-*-160-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); textFont = XLoadQueryFont(pdpy, fontname); } if( !textFont ) diff --git a/xpxthelloworld/xpxthelloworld.c b/xpxthelloworld/xpxthelloworld.c index 7eeaed2..e631e8a 100644 --- a/xpxthelloworld/xpxthelloworld.c +++ b/xpxthelloworld/xpxthelloworld.c @@ -275,7 +275,8 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char XtAppContext app; Widget toplevel, hello; - long dpi; + long dpi_x = 0L, + dpi_y = 0L; char fontname[256]; /* BUG: is this really big enougth ? */ XFontStruct *labelFont; Cardinal n; @@ -302,7 +303,7 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char XpSetContext(pdpy, pcontext); /* Get default printer resolution */ - if( XpuGetResolution(pdpy, pcontext, &dpi) != 1 ) + if( XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1 ) { fprintf(stderr, "No default resolution for printer '%s'\n", printername); XpuClosePrinterDisplay(pdpy, pcontext); @@ -317,7 +318,7 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char if( !pdpy ) Error(("XOpenDisplay failure.\n")); - dpi = 0; + dpi_x = dpi_y = 0L; pscreen = XDefaultScreenOfDisplay(pdpy); } @@ -331,7 +332,7 @@ int do_hello_world( int argc, char *argv[], const char *printername, const char if( !toplevel ) Error(("xt_xp_openapplication failure.\n")); - sprintf(fontname, "-*-*-*-*-*-*-*-180-%ld-%ld-*-*-iso8859-1", dpi, dpi); + sprintf(fontname, "-*-*-*-*-*-*-*-180-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); labelFont = XLoadQueryFont(pdpy, fontname); if( !labelFont ) Error(("XLoadQueryFont failure.\n")); -- cgit v1.2.3