| 37 | */ |
| 38 | |
| 39 | ppd_file_t * /* O - PPD file */ |
| 40 | SetCommonOptions( |
| 41 | int num_options, /* I - Number of options */ |
| 42 | cups_option_t *options, /* I - Options */ |
| 43 | int change_size) /* I - Change page size? */ |
| 44 | { |
| 45 | ppd_file_t *ppd; /* PPD file */ |
| 46 | ppd_size_t *pagesize; /* Current page size */ |
| 47 | const char *val; /* Option value */ |
| 48 | |
| 49 | |
| 50 | #ifdef LC_TIME |
| 51 | setlocale(LC_TIME, ""); |
| 52 | #endif /* LC_TIME */ |
| 53 | |
| 54 | ppd = ppdOpenFile(getenv("PPD")); |
| 55 | |
| 56 | ppdMarkDefaults(ppd); |
| 57 | cupsMarkOptions(ppd, num_options, options); |
| 58 | |
| 59 | if ((pagesize = ppdPageSize(ppd, NULL)) != NULL) |
| 60 | { |
| 61 | PageWidth = pagesize->width; |
| 62 | PageLength = pagesize->length; |
| 63 | PageTop = pagesize->top; |
| 64 | PageBottom = pagesize->bottom; |
| 65 | PageLeft = pagesize->left; |
| 66 | PageRight = pagesize->right; |
| 67 | |
| 68 | fprintf(stderr, "DEBUG: Page = %.0fx%.0f; %.0f,%.0f to %.0f,%.0f\n", |
| 69 | PageWidth, PageLength, PageLeft, PageBottom, PageRight, PageTop); |
| 70 | } |
| 71 | |
| 72 | if (ppd != NULL) |
| 73 | { |
| 74 | ColorDevice = ppd->color_device; |
| 75 | LanguageLevel = ppd->language_level; |
| 76 | } |
| 77 | |
| 78 | if ((val = cupsGetOption("landscape", num_options, options)) != NULL) |
| 79 | { |
| 80 | if (_cups_strcasecmp(val, "no") != 0 && _cups_strcasecmp(val, "off") != 0 && |
| 81 | _cups_strcasecmp(val, "false") != 0) |
| 82 | { |
| 83 | if (ppd && ppd->landscape > 0) |
| 84 | Orientation = 1; |
| 85 | else |
| 86 | Orientation = 3; |
| 87 | } |
| 88 | } |
| 89 | else if ((val = cupsGetOption("orientation-requested", num_options, options)) != NULL) |
| 90 | { |
| 91 | /* |
| 92 | * Map IPP orientation values to 0 to 3: |
| 93 | * |
| 94 | * 3 = 0 degrees = 0 |
| 95 | * 4 = 90 degrees = 1 |
| 96 | * 5 = -90 degrees = 3 |
no test coverage detected