]>
Commit | Line | Data |
---|---|---|
6961465f | 1 | /* |
503b54c9 | 2 | * PWG media API definitions for CUPS. |
6961465f | 3 | * |
718ee2ff | 4 | * Copyright 2009-2017 by Apple Inc. |
6961465f | 5 | * |
e3101897 | 6 | * Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
6961465f MS |
7 | */ |
8 | ||
9 | #ifndef _CUPS_PWG_H_ | |
10 | # define _CUPS_PWG_H_ | |
11 | ||
12 | ||
13 | /* | |
14 | * C++ magic... | |
15 | */ | |
16 | ||
17 | # ifdef __cplusplus | |
18 | extern "C" { | |
19 | # endif /* __cplusplus */ | |
20 | ||
21 | ||
22 | /* | |
23 | * Macros... | |
24 | */ | |
25 | ||
26 | /* Convert from points to hundredths of millimeters */ | |
27 | # define PWG_FROM_POINTS(n) (int)(((n) * 2540 + 36) / 72) | |
28 | /* Convert from hundredths of millimeters to points */ | |
29 | # define PWG_TO_POINTS(n) ((n) * 72.0 / 2540.0) | |
30 | ||
31 | ||
32 | /* | |
33 | * Types and structures... | |
34 | */ | |
35 | ||
718ee2ff | 36 | typedef struct pwg_map_s /**** Map element - PPD to/from PWG @exclude all@ */ |
6961465f MS |
37 | { |
38 | char *pwg, /* PWG media keyword */ | |
39 | *ppd; /* PPD option keyword */ | |
40 | } pwg_map_t; | |
41 | ||
42 | typedef struct pwg_media_s /**** Common media size data ****/ | |
43 | { | |
44 | const char *pwg, /* PWG 5101.1 "self describing" name */ | |
45 | *legacy, /* IPP/ISO legacy name */ | |
46 | *ppd; /* Standard Adobe PPD name */ | |
47 | int width, /* Width in 2540ths */ | |
48 | length; /* Length in 2540ths */ | |
49 | } pwg_media_t; | |
50 | ||
718ee2ff | 51 | typedef struct pwg_size_s /**** Size element - PPD to/from PWG @exclude all@ */ |
6961465f MS |
52 | { |
53 | pwg_map_t map; /* Map element */ | |
54 | int width, /* Width in 2540ths */ | |
55 | length, /* Length in 2540ths */ | |
56 | left, /* Left margin in 2540ths */ | |
57 | bottom, /* Bottom margin in 2540ths */ | |
58 | right, /* Right margin in 2540ths */ | |
59 | top; /* Top margin in 2540ths */ | |
60 | } pwg_size_t; | |
61 | ||
62 | ||
63 | /* | |
64 | * Functions... | |
65 | */ | |
66 | ||
67 | extern int pwgFormatSizeName(char *keyword, size_t keysize, | |
68 | const char *prefix, const char *name, | |
69 | int width, int length, | |
70 | const char *units) _CUPS_API_1_7; | |
71 | extern int pwgInitSize(pwg_size_t *size, ipp_t *job, | |
72 | int *margins_set) _CUPS_API_1_7; | |
73 | extern pwg_media_t *pwgMediaForLegacy(const char *legacy) _CUPS_API_1_7; | |
74 | extern pwg_media_t *pwgMediaForPPD(const char *ppd) _CUPS_API_1_7; | |
75 | extern pwg_media_t *pwgMediaForPWG(const char *pwg) _CUPS_API_1_7; | |
76 | extern pwg_media_t *pwgMediaForSize(int width, int length) _CUPS_API_1_7; | |
77 | ||
78 | # ifdef __cplusplus | |
79 | } | |
80 | # endif /* __cplusplus */ | |
81 | ||
82 | #endif /* !_CUPS_PWG_H_ */ |