]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/pwg-private.h
4 * Private PWG media API definitions for CUPS.
6 * Copyright 2009-2010 by Apple Inc.
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/".
14 * This file is subject to the Apple OS-Developed Software exception.
17 #ifndef _CUPS_PWG_PRIVATE_H_
18 # define _CUPS_PWG_PRIVATE_H_
22 * Include necessary headers...
25 # include <cups/cups.h>
34 # endif /* __cplusplus */
41 /* Convert from points to 2540ths */
42 # define _PWG_FROMPTS(n) (int)((n) * 2540 / 72)
43 /* Convert from 2540ths to points */
44 # define _PWG_TOPTS(n) ((n) * 72.0 / 2540.0)
48 * Types and structures...
51 typedef struct _pwg_media_s
/**** Common media size data ****/
53 const char *pwg
, /* PWG 5101.1 "self describing" name */
54 *legacy
, /* IPP/ISO legacy name */
55 *ppd
; /* Standard Adobe PPD name */
56 int width
, /* Width in 2540ths */
57 length
; /* Length in 2540ths */
60 typedef struct _pwg_map_s
/**** Map element - PPD to/from PWG */
62 char *pwg
, /* PWG media keyword */
63 *ppd
; /* PPD option keyword */
66 typedef struct _pwg_size_s
/**** Size element - PPD to/from PWG */
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 */
77 typedef struct _pwg_s
/**** PWG-PPD conversion data ****/
79 int num_sizes
; /* Number of media sizes */
80 _pwg_size_t
*sizes
; /* Media sizes */
81 int custom_max_width
, /* Maximum custom width in 2540ths */
82 custom_max_length
, /* Maximum custom length in 2540ths */
83 custom_min_width
, /* Minimum custom width in 2540ths */
84 custom_min_length
; /* Minimum custom length in 2540ths */
85 char *custom_max_keyword
, /* Maximum custom size PWG keyword */
86 *custom_min_keyword
, /* Minimum custom size PWG keyword */
87 custom_ppd_size
[PPD_MAX_NAME
];
88 /* Custom PPD size name */
89 _pwg_size_t custom_size
; /* Custom size record */
90 int num_sources
; /* Number of media sources */
91 _pwg_map_t
*sources
; /* Media sources */
92 int num_types
; /* Number of media types */
93 _pwg_map_t
*types
; /* Media types */
101 extern _pwg_t
*_pwgCreateWithFile(const char *filename
);
102 extern _pwg_t
*_pwgCreateWithPPD(ppd_file_t
*ppd
);
103 extern void _pwgDestroy(_pwg_t
*pwg
);
104 extern void _pwgGenerateSize(char *keyword
, size_t keysize
,
107 int width
, int length
);
108 extern const char *_pwgGetInputSlot(_pwg_t
*pwg
, ipp_t
*job
,
109 const char *keyword
);
110 extern const char *_pwgGetMediaType(_pwg_t
*pwg
, ipp_t
*job
,
111 const char *keyword
);
112 extern const char *_pwgGetPageSize(_pwg_t
*pwg
, ipp_t
*job
,
113 const char *keyword
, int *exact
);
114 extern _pwg_size_t
*_pwgGetSize(_pwg_t
*pwg
, const char *page_size
);
115 extern const char *_pwgGetSource(_pwg_t
*pwg
, const char *input_slot
);
116 extern const char *_pwgGetType(_pwg_t
*pwg
, const char *media_type
);
117 extern int _pwgInitSize(_pwg_size_t
*size
, ipp_t
*job
,
119 extern const char *_pwgInputSlotForSource(const char *media_source
,
120 char *name
, size_t namesize
);
121 extern _pwg_media_t
*_pwgMediaForLegacy(const char *legacy
);
122 extern _pwg_media_t
*_pwgMediaForPPD(const char *ppd
);
123 extern _pwg_media_t
*_pwgMediaForPWG(const char *pwg
);
124 extern _pwg_media_t
*_pwgMediaForSize(int width
, int length
);
125 extern const char *_pwgMediaTypeForType(const char *media_source
,
126 char *name
, size_t namesize
);
127 extern const char *_pwgPageSizeForMedia(_pwg_media_t
*media
,
128 char *name
, size_t namesize
);
129 extern int _pwgWriteFile(_pwg_t
*pwg
, const char *filename
);
134 # endif /* __cplusplus */
136 #endif /* !_CUPS_PWG_PRIVATE_H_ */