1/*
2 * "$Id: pwg.h 4274 2013-04-09 20:10:23Z msweet $"
3 *
4 * PWG media API definitions for CUPS.
5 *
6 * Copyright 2009-2013 by Apple Inc.
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_H_
18# define _CUPS_PWG_H_
19
20
21/*
22 * C++ magic...
23 */
24
25# ifdef __cplusplus
26extern "C" {
27# endif /* __cplusplus */
28
29
30/*
31 * Macros...
32 */
33
34/* Convert from points to hundredths of millimeters */
35# define PWG_FROM_POINTS(n) (int)(((n) * 2540 + 36) / 72)
36/* Convert from hundredths of millimeters to points */
37# define PWG_TO_POINTS(n) ((n) * 72.0 / 2540.0)
38
39
40/*
41 * Types and structures...
42 */
43
44typedef struct pwg_map_s /**** Map element - PPD to/from PWG */
45{
46 char *pwg, /* PWG media keyword */
47 *ppd; /* PPD option keyword */
48} pwg_map_t;
49
50typedef struct pwg_media_s /**** Common media size data ****/
51{
52 const char *pwg, /* PWG 5101.1 "self describing" name */
53 *legacy, /* IPP/ISO legacy name */
54 *ppd; /* Standard Adobe PPD name */
55 int width, /* Width in 2540ths */
56 length; /* Length in 2540ths */
57} pwg_media_t;
58
59typedef struct pwg_size_s /**** Size element - PPD to/from PWG */
60{
61 pwg_map_t map; /* Map element */
62 int width, /* Width in 2540ths */
63 length, /* Length in 2540ths */
64 left, /* Left margin in 2540ths */
65 bottom, /* Bottom margin in 2540ths */
66 right, /* Right margin in 2540ths */
67 top; /* Top margin in 2540ths */
68} pwg_size_t;
69
70
71/*
72 * Functions...
73 */
74
75extern int pwgFormatSizeName(char *keyword, size_t keysize,
76 const char *prefix, const char *name,
77 int width, int length,
78 const char *units) _CUPS_API_1_7;
79extern int pwgInitSize(pwg_size_t *size, ipp_t *job,
80 int *margins_set) _CUPS_API_1_7;
81extern pwg_media_t *pwgMediaForLegacy(const char *legacy) _CUPS_API_1_7;
82extern pwg_media_t *pwgMediaForPPD(const char *ppd) _CUPS_API_1_7;
83extern pwg_media_t *pwgMediaForPWG(const char *pwg) _CUPS_API_1_7;
84extern pwg_media_t *pwgMediaForSize(int width, int length) _CUPS_API_1_7;
85
86# ifdef __cplusplus
87}
88# endif /* __cplusplus */
89
90#endif /* !_CUPS_PWG_H_ */
91
92/*
93 * End of "$Id: pwg.h 4274 2013-04-09 20:10:23Z msweet $".
94 */
95