From 955955139505a7972929e0844b42ddad6cbf994f Mon Sep 17 00:00:00 2001 From: rahra Date: Thu, 24 Mar 2022 08:13:07 +0100 Subject: [PATCH] ANSI page formats added (thanks go to Jim Ham\!) --- doc/smrender.html | 17 ++++--- doc/smrender.pdf | Bin 596943 -> 597052 bytes doc/smrender.tex | 16 ++++--- src/smrender.c | 115 +++++++++++++++++++++++++++------------------- 4 files changed, 88 insertions(+), 60 deletions(-) diff --git a/doc/smrender.html b/doc/smrender.html index c2dcb5d..030c6a2 100644 --- a/doc/smrender.html +++ b/doc/smrender.html @@ -380,18 +380,23 @@

Contents

american
-P fmt geom[:angle]
- Select the page format of the output image. The format can be set either named format fmt which - has a specific dimension or as geometry geom which contains the width and height of the page - in millimeters in the format widthxheight. - Fmt currently supports the values A4 up to A0. - If this option is omitted, A3 format is selected by default. + Select the page format of the output image. The format can be set to either + a named format fmt which has a predefined dimension or as a geometry + geom which contains the width and height of the page in millimeters + in the format widthxheight. + +
+
Fmt
currently supports the ISO formats A4 up to A0, + and the ANSI formats A to E, letter, + legal, and ledger. If this option is omitted the format + A3 is selected by default.
If the area to be rendered is specified as bounding box (see Section 4.1) this will most probably colide with the dimension of the page because of the requirements of the projection in which case Smrender will resize the bounding box appropriately. If either the width or - the height (but never both) is set to zero then Smrender will + the height (but never both) is set to zero, Smrender will calculate the missing dimension according to the bounding box and the projection. diff --git a/doc/smrender.pdf b/doc/smrender.pdf index 2bbed9fdeba400638e19d109125c579813219228..47c061c973132e52e8a03e2ed921a34c06b47cde 100644 GIT binary patch delta 6742 zcmai3WlS6ZlVyd)q4?tN6n9EOVfTEVSV5eUZTpTEv8kWcB9~_3kFlfaaCNkLMOk#SXwoUL)x1gLDV8 zn)wAIxD1Vi%rcX?yd@q1*sR7D#GUYD>5!r!&S^0oqXLUiq)ds35DCDPu{0%5_`LJR zxM4nFA5ovu>R-#{%72rg!I#%@A`m(J#1*M=ZTuAFZ_~sV4VJwCVCD-gaw&aW-Ci;r zm?!gI@3A=ids9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~n zED*Pglp0sED@y2<8IPdNycg${tkhGuB-qN?(!k diff --git a/doc/smrender.tex b/doc/smrender.tex index 2007dbc..5a78ada 100644 --- a/doc/smrender.tex +++ b/doc/smrender.tex @@ -337,17 +337,21 @@ \subsection{Options} \label{sec:options} \item[\optk{P}] \optv{fmt\textbar geom}[:\optv{angle}{]} - Select the page format of the output image. The format can be set either named format \optv{fmt} which - has a specific dimension or as geometry \optv{geom} which contains the width and height of the page - in millimeters in the format \optv{width}\textsf{x}\optv{height}. - \optv{Fmt} currently supports the values \textsf{A4} up to \textsf{A0}. - If this option is omitted, \textsf{A3} format is selected by default. + Select the page format of the output image. The format can be set to either + a named format \optv{fmt} which has a predefined dimension or as a geometry + \optv{geom} which contains the width and height of the page in millimeters + in the format \optv{width}\textsf{x}\optv{height}. + + \optv{Fmt} currently supports the ISO formats \textsf{A4} up to \textsf{A0}, + and the ANSI formats \textsf{A} to \textsf{E}, \textsf{letter}, + \textsf{legal}, and \textsf{ledger}. If this option is omitted the format + \textsf{A3} is selected by default. If the area to be rendered is specified as bounding box (see Section \ref{sec:window}) this will most probably colide with the dimension of the page because of the requirements of the projection in which case \smrender{} will resize the bounding box appropriately. If either the \optv{width} or - the \optv{height} (but never both) is set to zero then \smrender{} will + the \optv{height} (but never both) is set to zero, \smrender{} will calculate the missing dimension according to the bounding box and the projection. diff --git a/src/smrender.c b/src/smrender.c index 65b2f3e..72e84d1 100644 --- a/src/smrender.c +++ b/src/smrender.c @@ -19,7 +19,7 @@ * This file contains the main() function and main initialization functions. * * \author Bernhard R. Fischer, - * \date 2022/03/08 + * \date 2022/03/24 */ #ifdef HAVE_CONFIG_H @@ -391,72 +391,91 @@ static void page_rotate(struct rdata *rd, const char *angle) char *init_rd_paper(struct rdata *rd, const char *paper) { char buf[strlen(paper) + 1], *s, *angle; - double a4_w, a4_h; - - a4_w = MM2PX(210); - a4_h = MM2PX(297); + double width = 0.; + double height = 0.; // in mm + + struct PAPERSIZE { + const char * const name; + const double w; + const double h; + }; + // all in mm + const float A4_W = 210; + const float A4_H = 297; + const float A_W = 8.5 * 25.4; // ANSI A + const float A_H = 11. * 25.4; + const float L_H = 14. * 25.4; // legal + + const struct PAPERSIZE papersize[] = { + { "A4", A4_W, A4_H }, + { "A3", A4_H, A4_W * 2. }, + { "A2", A4_W * 2., A4_H * 2. }, + { "A1", A4_H * 2., A4_W * 4. }, + { "A0", A4_W * 4., A4_H * 4. }, + { "A", A_W, A_H }, + { "B", A_H, A_W * 2. }, + { "C", A_W * 2., A_H * 2. }, + { "D", A_H * 2., A_W * 4. }, + { "E", A_W * 4., A_H * 4. }, + { "letter", A_W, A_H }, + { "legal", A_W, L_H }, + { "ledger", A_H, A_W * 2. }, + { NULL, 0., 0. } + }; strcpy(buf, paper); strtok(buf, ":"); angle = strtok(NULL, ":"); + // check if format is given as WxH if (strchr(buf, 'x')) { if ((s = strtok(buf, "x")) == NULL) log_msg(LOG_ERR, "strtok returned NULL"), exit(EXIT_FAILURE); - rd->w = MM2PX(atof(s)); + width = atof(s); if ((s = strtok(NULL, "x")) == NULL) log_msg(LOG_ERR, "format error in page size: '%s'", buf), exit(EXIT_FAILURE); - rd->h = MM2PX(atof(s)); - - if ((rd->w < 0) || (rd->h < 0)) - log_msg(LOG_ERR, "page width and height must be a decimal value greater than 0"), - exit(EXIT_FAILURE); - - if (!rd->w && !rd->h) - log_msg(LOG_ERR, "width and height cannot both be 0"), - exit(EXIT_FAILURE); - } - else if (!strcasecmp(buf, "A4")) - { - rd->w = a4_w; - rd->h = a4_h; - } - else if (!strcasecmp(buf, "A3")) - { - rd->w = a4_h; - rd->h = a4_w * 2; - } - else if (!strcasecmp(buf, "A2")) - { - rd->w = a4_w * 2; - rd->h = a4_h * 2; - } - else if (!strcasecmp(buf, "A1")) - { - rd->w = a4_h * 2; - rd->h = a4_w * 4; - } - else if (!strcasecmp(buf, "A0")) - { - rd->w = a4_w * 4; - rd->h = a4_h * 4; + height = atof(s); } + // test if format is one of the preset formats else { - log_msg(LOG_WARN, "unknown page size %s, defaulting to A4", buf); - rd->w = a4_w; - rd->h = a4_h; - } + struct PAPERSIZE const * sizeptr = papersize + 0; + while ( sizeptr->name != NULL ) + { + if ( !strcasecmp(buf, sizeptr->name)) + { + width = sizeptr->w; + height = sizeptr->h; + break; + } // end if + ++sizeptr; + } //end while + + // set default size if specified format is unknown + if ( sizeptr->name == NULL ) { + log_msg(LOG_WARN, "unknown page size %s, defaulting to A3", buf); + width = A4_H; + height = A4_W * 2.; + } // end if + } // end else + + if ( (width <= 0.) || (height <= 0.) ) { + log_msg(LOG_ERR, "page width and height must be a decimal value greater than 0"), + exit(EXIT_FAILURE); + } // end if + // set final width and height to config structure of renderer if (rd->flags & RD_LANDSCAPE) { - a4_w = rd->w; - rd->w = rd->h; - rd->h = a4_w; - } + rd->w = MM2PX(height); + rd->h = MM2PX(width); + } else { + rd->w = MM2PX(width ); + rd->h = MM2PX(height); + } // end else return angle; }