Lines Matching +full:page +full:- +full:size
2 * Page size functions for CUPS.
4 * Copyright 2007-2015 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
17 #include "string-private.h"
18 #include "debug-internal.h"
23 * 'ppdPageSize()' - Get the page size record for the named size.
26 ppd_size_t * /* O - Size record for page or NULL */
27 ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */ in ppdPageSize()
28 const char *name) /* I - Size name */ in ppdPageSize()
31 ppd_size_t *size; /* Current page size */ in ppdPageSize() local
32 double w, l; /* Width and length of page */ in ppdPageSize()
35 ppd_coption_t *coption; /* Custom option for page size */ in ppdPageSize()
49 if (!strncmp(name, "Custom.", 7) && ppd->variable_sizes) in ppdPageSize()
52 * Find the custom page size... in ppdPageSize()
55 for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++) in ppdPageSize()
56 if (!strcmp("Custom", size->name)) in ppdPageSize()
66 * Variable size; size name can be one of the following: in ppdPageSize()
68 * Custom.WIDTHxLENGTHin - Size in inches in ppdPageSize()
69 * Custom.WIDTHxLENGTHft - Size in feet in ppdPageSize()
70 * Custom.WIDTHxLENGTHcm - Size in centimeters in ppdPageSize()
71 * Custom.WIDTHxLENGTHmm - Size in millimeters in ppdPageSize()
72 * Custom.WIDTHxLENGTHm - Size in meters in ppdPageSize()
73 * Custom.WIDTHxLENGTH[pt] - Size in points in ppdPageSize()
111 size->width = (float)w; in ppdPageSize()
112 size->length = (float)l; in ppdPageSize()
113 size->left = ppd->custom_margins[0]; in ppdPageSize()
114 size->bottom = ppd->custom_margins[1]; in ppdPageSize()
115 size->right = (float)(w - ppd->custom_margins[2]); in ppdPageSize()
116 size->top = (float)(l - ppd->custom_margins[3]); in ppdPageSize()
119 * Update the custom option records for the page size, too... in ppdPageSize()
125 cparam->current.custom_points = (float)w; in ppdPageSize()
128 cparam->current.custom_points = (float)l; in ppdPageSize()
132 * Return the page size... in ppdPageSize()
135 DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size, in ppdPageSize()
136 size->name, size->width, size->length)); in ppdPageSize()
138 return (size); in ppdPageSize()
146 for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++) in ppdPageSize()
147 if (!_cups_strcasecmp(name, size->name)) in ppdPageSize()
149 DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size, in ppdPageSize()
150 size->name, size->width, size->length)); in ppdPageSize()
152 return (size); in ppdPageSize()
162 for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++) in ppdPageSize()
163 if (size->marked) in ppdPageSize()
165 DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size, in ppdPageSize()
166 size->name, size->width, size->length)); in ppdPageSize()
168 return (size); in ppdPageSize()
172 DEBUG_puts("3ppdPageSize: Size not found, returning NULL"); in ppdPageSize()
179 * 'ppdPageSizeLimits()' - Return the custom page size limits.
181 * This function returns the minimum and maximum custom page sizes and printable
182 * areas based on the currently-marked (selected) options.
184 * If the specified PPD file does not support custom page sizes, both
190 int /* O - 1 if custom sizes are supported, 0 otherwise */
191 ppdPageSizeLimits(ppd_file_t *ppd, /* I - PPD file record */ in ppdPageSizeLimits()
192 ppd_size_t *minimum, /* O - Minimum custom size */ in ppdPageSizeLimits()
193 ppd_size_t *maximum) /* O - Maximum custom size */ in ppdPageSizeLimits()
207 if (!ppd || !ppd->variable_sizes || !minimum || !maximum) in ppdPageSizeLimits()
222 cupsArraySave(ppd->sorted_attrs); in ppdPageSizeLimits()
225 attr->value) in ppdPageSizeLimits()
226 qualifier2 = ppdFindMarkedChoice(ppd, attr->value); in ppdPageSizeLimits()
231 attr->value) in ppdPageSizeLimits()
232 qualifier3 = ppdFindMarkedChoice(ppd, attr->value); in ppdPageSizeLimits()
240 width = ppd->custom_min[0]; in ppdPageSizeLimits()
241 length = ppd->custom_min[1]; in ppdPageSizeLimits()
251 snprintf(spec, sizeof(spec), ".%s.%s", qualifier2->choice, in ppdPageSizeLimits()
252 qualifier3->choice); in ppdPageSizeLimits()
260 snprintf(spec, sizeof(spec), ".%s.", qualifier2->choice); in ppdPageSizeLimits()
266 snprintf(spec, sizeof(spec), "..%s", qualifier3->choice); in ppdPageSizeLimits()
270 if ((attr && attr->value && in ppdPageSizeLimits()
271 sscanf(attr->value, "%f%f", &width, &length) != 2) || !attr) in ppdPageSizeLimits()
273 width = ppd->custom_min[0]; in ppdPageSizeLimits()
274 length = ppd->custom_min[1]; in ppdPageSizeLimits()
278 minimum->width = width; in ppdPageSizeLimits()
279 minimum->length = length; in ppdPageSizeLimits()
280 minimum->left = ppd->custom_margins[0]; in ppdPageSizeLimits()
281 minimum->bottom = ppd->custom_margins[1]; in ppdPageSizeLimits()
282 minimum->right = width - ppd->custom_margins[2]; in ppdPageSizeLimits()
283 minimum->top = length - ppd->custom_margins[3]; in ppdPageSizeLimits()
289 width = ppd->custom_max[0]; in ppdPageSizeLimits()
290 length = ppd->custom_max[1]; in ppdPageSizeLimits()
300 snprintf(spec, sizeof(spec), ".%s.%s", qualifier2->choice, in ppdPageSizeLimits()
301 qualifier3->choice); in ppdPageSizeLimits()
309 snprintf(spec, sizeof(spec), ".%s.", qualifier2->choice); in ppdPageSizeLimits()
315 snprintf(spec, sizeof(spec), "..%s", qualifier3->choice); in ppdPageSizeLimits()
320 (attr->value && sscanf(attr->value, "%f%f", &width, &length) != 2)) in ppdPageSizeLimits()
322 width = ppd->custom_max[0]; in ppdPageSizeLimits()
323 length = ppd->custom_max[1]; in ppdPageSizeLimits()
327 maximum->width = width; in ppdPageSizeLimits()
328 maximum->length = length; in ppdPageSizeLimits()
329 maximum->left = ppd->custom_margins[0]; in ppdPageSizeLimits()
330 maximum->bottom = ppd->custom_margins[1]; in ppdPageSizeLimits()
331 maximum->right = width - ppd->custom_margins[2]; in ppdPageSizeLimits()
332 maximum->top = length - ppd->custom_margins[3]; in ppdPageSizeLimits()
338 cupsArrayRestore(ppd->sorted_attrs); in ppdPageSizeLimits()
345 * 'ppdPageWidth()' - Get the page width for the given size.
348 float /* O - Width of page in points or 0.0 */
349 ppdPageWidth(ppd_file_t *ppd, /* I - PPD file record */ in ppdPageWidth()
350 const char *name) /* I - Size name */ in ppdPageWidth()
352 ppd_size_t *size; /* Page size */ in ppdPageWidth() local
355 if ((size = ppdPageSize(ppd, name)) == NULL) in ppdPageWidth()
358 return (size->width); in ppdPageWidth()
363 * 'ppdPageLength()' - Get the page length for the given size.
366 float /* O - Length of page in points or 0.0 */
367 ppdPageLength(ppd_file_t *ppd, /* I - PPD file */ in ppdPageLength()
368 const char *name) /* I - Size name */ in ppdPageLength()
370 ppd_size_t *size; /* Page size */ in ppdPageLength() local
373 if ((size = ppdPageSize(ppd, name)) == NULL) in ppdPageLength()
376 return (size->length); in ppdPageLength()