1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/*
* PWG media API definitions for CUPS.
*
* Copyright 2009-2017 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
#ifndef _CUPS_PWG_H_
# define _CUPS_PWG_H_
/*
* C++ magic...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Macros...
*/
/* Convert from points to hundredths of millimeters */
# define PWG_FROM_POINTS(n) (int)(((n) * 2540 + 36) / 72)
/* Convert from hundredths of millimeters to points */
# define PWG_TO_POINTS(n) ((n) * 72.0 / 2540.0)
/*
* Types and structures...
*/
typedef struct pwg_map_s /**** Map element - PPD to/from PWG @exclude all@ */
{
char *pwg, /* PWG media keyword */
*ppd; /* PPD option keyword */
} pwg_map_t;
typedef struct pwg_media_s /**** Common media size data ****/
{
const char *pwg, /* PWG 5101.1 "self describing" name */
*legacy, /* IPP/ISO legacy name */
*ppd; /* Standard Adobe PPD name */
int width, /* Width in 2540ths */
length; /* Length in 2540ths */
} pwg_media_t;
typedef struct pwg_size_s /**** Size element - PPD to/from PWG @exclude all@ */
{
pwg_map_t map; /* Map element */
int width, /* Width in 2540ths */
length, /* Length in 2540ths */
left, /* Left margin in 2540ths */
bottom, /* Bottom margin in 2540ths */
right, /* Right margin in 2540ths */
top; /* Top margin in 2540ths */
} pwg_size_t;
/*
* Functions...
*/
extern int pwgFormatSizeName(char *keyword, size_t keysize,
const char *prefix, const char *name,
int width, int length,
const char *units) _CUPS_API_1_7;
extern int pwgInitSize(pwg_size_t *size, ipp_t *job,
int *margins_set) _CUPS_API_1_7;
extern pwg_media_t *pwgMediaForLegacy(const char *legacy) _CUPS_API_1_7;
extern pwg_media_t *pwgMediaForPPD(const char *ppd) _CUPS_API_1_7;
extern pwg_media_t *pwgMediaForPWG(const char *pwg) _CUPS_API_1_7;
extern pwg_media_t *pwgMediaForSize(int width, int length) _CUPS_API_1_7;
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !_CUPS_PWG_H_ */
|