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 89 90 91 92 93 94 95 96 97 98 99 100
|
/*
* This file is part of XForms.
*
* XForms is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1, or
* (at your option) any later version.
*
* XForms is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with XForms. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file papers.c
*
* This file is part of XForms package
* Copyright (c) 1997-2000 by T.C. Zhao
* All rights reserved.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include "fd2ps.h"
#ifdef __EMX__
#define strcasecmp stricmp
#endif
struct paper {
const char * name;
const char * size;
float w, /* in inches */
h;
};
static struct paper papers[ ] =
{
{ "Letter", "8.5x11in", 8.5, 11.0 },
{ "Legal", "8.5x14in", 8.5, 14.0 },
{ "A4", "210x295mm", 7.27, 11.61 }, /* European 210x295mm */
{ "B4", "257x364mm", 10.1, 14.33 }, /* Janpanese 275x364mm */
{ "B5", "18x20cm", 7.283, 10.630 },
{ "B", "11x17in", 11.0, 17.0 }, /* US tabloid */
{ "Note", "4x5in", 4.0, 5.0 },
/* sentinel */
{ NULL, NULL, 0.0, 0.0 }
};
/***************************************
***************************************/
void
get_paper_size( const char * name,
float * w,
float * h )
{
struct paper *p = papers;
for ( ; p->name; p++ )
if ( strcasecmp( name, p->name ) == 0 )
{
*w = p->w;
*h = p->h;
return;
}
fprintf( stderr, "Unknown paper name %s - ignored\n", name );
}
/***************************************
***************************************/
void
list_papers( const char * prefix )
{
struct paper *p = papers;
for ( ; p->name; p++ )
fprintf( stderr, "%s%s\t(%s)\n", prefix, p->name, p->size );
}
/*
* Local variables:
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/
|