]>
Commit | Line | Data |
---|---|---|
54afec33 MS |
1 | /* |
2 | * "$Id$" | |
3 | * | |
71e16022 | 4 | * Private PWG media API definitions for CUPS. |
54afec33 | 5 | * |
dcb445bc | 6 | * Copyright 2009-2012 by Apple Inc. |
54afec33 MS |
7 | * |
8 | * These coded instructions, statements, and computer programs are the | |
9 | * property of Apple Inc. and are protected by Federal copyright | |
10 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
11 | * which should have been included with this file. If this file is | |
12 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
13 | * | |
14 | * This file is subject to the Apple OS-Developed Software exception. | |
15 | */ | |
16 | ||
17 | #ifndef _CUPS_PWG_PRIVATE_H_ | |
18 | # define _CUPS_PWG_PRIVATE_H_ | |
19 | ||
20 | ||
21 | /* | |
22 | * Include necessary headers... | |
23 | */ | |
24 | ||
25 | # include <cups/cups.h> | |
26 | ||
27 | ||
28 | /* | |
29 | * C++ magic... | |
30 | */ | |
31 | ||
32 | # ifdef __cplusplus | |
33 | extern "C" { | |
34 | # endif /* __cplusplus */ | |
35 | ||
36 | ||
37 | /* | |
38 | * Macros... | |
39 | */ | |
40 | ||
41 | /* Convert from points to 2540ths */ | |
dcb445bc | 42 | # define _PWG_FROMPTS(n) (int)(((n) * 2540 + 36) / 72) |
54afec33 MS |
43 | /* Convert from 2540ths to points */ |
44 | # define _PWG_TOPTS(n) ((n) * 72.0 / 2540.0) | |
45 | ||
46 | ||
47 | /* | |
48 | * Types and structures... | |
49 | */ | |
50 | ||
c7017ecc MS |
51 | typedef struct _pwg_map_s /**** Map element - PPD to/from PWG */ |
52 | { | |
53 | char *pwg, /* PWG media keyword */ | |
54 | *ppd; /* PPD option keyword */ | |
55 | } _pwg_map_t; | |
aaf19ab0 | 56 | |
54afec33 MS |
57 | typedef struct _pwg_media_s /**** Common media size data ****/ |
58 | { | |
59 | const char *pwg, /* PWG 5101.1 "self describing" name */ | |
60 | *legacy, /* IPP/ISO legacy name */ | |
61 | *ppd; /* Standard Adobe PPD name */ | |
62 | int width, /* Width in 2540ths */ | |
63 | length; /* Length in 2540ths */ | |
64 | } _pwg_media_t; | |
65 | ||
54afec33 MS |
66 | typedef struct _pwg_size_s /**** Size element - PPD to/from PWG */ |
67 | { | |
68 | _pwg_map_t map; /* Map element */ | |
69 | int width, /* Width in 2540ths */ | |
70 | length, /* Length in 2540ths */ | |
71 | left, /* Left margin in 2540ths */ | |
72 | bottom, /* Bottom margin in 2540ths */ | |
73 | right, /* Right margin in 2540ths */ | |
74 | top; /* Top margin in 2540ths */ | |
75 | } _pwg_size_t; | |
76 | ||
54afec33 MS |
77 | |
78 | /* | |
79 | * Functions... | |
80 | */ | |
81 | ||
54afec33 MS |
82 | extern void _pwgGenerateSize(char *keyword, size_t keysize, |
83 | const char *prefix, | |
c7017ecc | 84 | const char *name, |
54afec33 | 85 | int width, int length); |
54afec33 MS |
86 | extern int _pwgInitSize(_pwg_size_t *size, ipp_t *job, |
87 | int *margins_set); | |
54afec33 | 88 | extern _pwg_media_t *_pwgMediaForLegacy(const char *legacy); |
7cf5915e | 89 | extern _pwg_media_t *_pwgMediaForPPD(const char *ppd); |
54afec33 MS |
90 | extern _pwg_media_t *_pwgMediaForPWG(const char *pwg); |
91 | extern _pwg_media_t *_pwgMediaForSize(int width, int length); | |
54afec33 MS |
92 | |
93 | ||
94 | # ifdef __cplusplus | |
95 | } | |
96 | # endif /* __cplusplus */ | |
97 | ||
98 | #endif /* !_CUPS_PWG_PRIVATE_H_ */ | |
99 | ||
100 | /* | |
101 | * End of "$Id$". | |
102 | */ |