summaryrefslogtreecommitdiff
path: root/lib/encoding.h
blob: de40b73ddc4c1669ac466ce60b1b92d00c14280f (plain)
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
101
102
103
104
105
106
107
108
109
110
111
/*
 * encoding.h
 *
 * definition of the char encodings used
 * Copyright (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
 * Copyright (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
 * $Id: encoding.h,v 1.1.1.1.2.1 2007/12/29 01:58:17 mhatta Exp $
 */

/*
 * This file is part of a2ps.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
/************************************************************************/
/*			encoding selection				*/
/************************************************************************/
#ifndef _ENCODING_H_
#define _ENCODING_H_
#include "a2ps.h"
#include "faces.h"
#include "hashtab.h"

struct a2ps_job;	/* Declared in jobs.h which includes this file */

#define COURIER_WX	600	/* Any char in courier has WX = 600 */

/*
 * Computation of the width of the chars in the current encoding
 */
unsigned int char_WX PARAMS ((struct a2ps_job * job, uchar c));
unsigned int string_WX PARAMS ((struct a2ps_job * job, uchar * string));
unsigned int char_composite_WX PARAMS ((struct a2ps_job * job, uchar c));


/************************************************************************/
/* Handling of the struct encoding				*/
/************************************************************************/
struct encoding;

const char * encoding_get_name PARAMS ((struct encoding * enc));
const char * encoding_get_key PARAMS ((struct encoding * enc));
void encoding_self_print PARAMS ((struct encoding * item,
					FILE * stream));
int encoding_char_exists PARAMS ((struct encoding * enc,
					enum face_e face, uchar c));
int encoding_get_composite_flag (struct encoding * enc);
struct encoding *
get_encoding_by_alias PARAMS ((struct a2ps_job * job, 
			       char *string));

void set_encoding PARAMS ((struct a2ps_job * job,
			   struct encoding * enc));

/* When FONT_NAME is used with ENCODING, return the real font name to
 * use (e.g., in latin2, Courier-Ogonki should be returned when asked
 * for Courier).  */
const char * encoding_resolve_font_substitute
	PARAMS ((struct a2ps_job * job,
		 struct encoding * encoding,
		 const char * font_name));


const char * encoding_resolve_composite_font
	PARAMS ((struct a2ps_job * job,
		 struct encoding * encoding,
		 const char * font_name));

/*
 * Have a struct encoding determine the faces_wx
 */
void encoding_build_faces_wx PARAMS ((struct a2ps_job * job,
				      struct encoding * encoding));
void encoding_add_font_name_used PARAMS ((struct encoding * enc,
						const char * name));

/* Dump on STREAM the encodings setup */
void dump_encodings_setup PARAMS ((FILE * stream, struct a2ps_job * job));

/*
 * Related to a2ps_job
 */
void list_encodings_short PARAMS ((struct a2ps_job * job, FILE * stream));
void list_encodings_long PARAMS ((struct a2ps_job * job, FILE * stream));
void list_texinfo_encodings_long PARAMS ((struct a2ps_job * job,
					  FILE * stream));

/************************************************************************/
/* Road map to the files defining the encodings				*/
/************************************************************************/
struct pair_htable * encodings_map_new PARAMS ((void));
void encodings_map_free PARAMS ((struct pair_htable * table));

struct hash_table_s * encodings_table_new PARAMS ((void));
void encodings_table_free PARAMS ((struct hash_table_s * table));

int load_main_encodings_map PARAMS ((struct a2ps_job * job));
#endif