Skip to content
Snippets Groups Projects
Commit 686a5568 authored by Martin Mareš's avatar Martin Mareš
Browse files

We get dimensions in points, but send them in 100ths of mm

parent 7ccebad3
No related branches found
No related tags found
No related merge requests found
......@@ -88,8 +88,8 @@ static char *xstrdup(const char *x)
O(INPUTTRAY, "automatic") \
O(TRAYFEED, "stack") \
O(MEDIATYPE, "system-default") \
O(MEDIAXSIZE, "21000") \
O(MEDIAYSIZE, "29700") \
O(MEDIAXSIZE, "595") \
O(MEDIAYSIZE, "842") \
O(FINISH_STAPLE, "") \
O(FINISH_PUNCH, "") \
O(FINISH_FOLD, "") \
......@@ -307,6 +307,17 @@ static void xcpt_integer(const char *name, int value)
xcpt_printf("<%s syntax=\"integer\">%d</%s>", name, value, name);
}
static void xcpt_dimension(const char *name, int pt)
{
/*
* We get dimensions in PostScript points (1/72 in).
* Xerox printers expect them in 100th's of mm, but
* last two digits must be 0.
*/
double m = pt * (25.4 / 72.) + 0.5;
xcpt_integer(name, 100 * (int)m);
}
static void xcpt_keyword(const char *name, const char *value)
{
xcpt_printf("<%s syntax=\"keyword\">%s</%s>", name, value, name);
......@@ -456,8 +467,8 @@ static void gen_job_template(void)
xcpt_keyword("tray-feed", OPT(TRAYFEED));
xcpt_keyword("media-color", OPT(MEDIACOLOR));
xcpt_collection_open("media-size");
xcpt_integer("x-dimension", OPT_INT(MEDIAXSIZE));
xcpt_integer("y-dimension", OPT_INT(MEDIAYSIZE));
xcpt_dimension("x-dimension", OPT_INT(MEDIAXSIZE));
xcpt_dimension("y-dimension", OPT_INT(MEDIAYSIZE));
xcpt_close();
xcpt_keyword("media-type", OPT(MEDIATYPE));
xcpt_close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment