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