aboutsummaryrefslogtreecommitdiffstats
path: root/troff/troff.d/afm.h
blob: 59c601905917a73f25dc3adf00376e16aea0226c (plain) (blame)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany
 *
 * Sccsid @(#)afm.h	1.35 (gritter) 10/5/06
 */

#ifndef	TROFF_AFM_H
#define	TROFF_AFM_H

enum spec {
	SPEC_NONE	= 00000,
	SPEC_MATH	= 00001,
	SPEC_GREEK	= 00002,
	SPEC_PUNCT	= 00004,
	SPEC_LARGE	= 00010,
	SPEC_S1		= 01000,
	SPEC_S		= 02000
};

#define	NOCODE		((unsigned short)-1)

#define	NKERNPAIRS	45
struct kernpairs {
	struct kernpairs	*next;
	int	sorted;
	int	cnt;
	unsigned short	ch2[NKERNPAIRS];
	short	k[NKERNPAIRS];
};

struct namecache {
	unsigned short	afpos;
	unsigned short	fival[2];
	unsigned short	gid;
};

struct charpair {
	unsigned short	ch1;
	unsigned short	ch2;
};

struct feature {
	char	*name;
	struct charpair	*pairs;
	int	npairs;
};

extern struct afmtab {
	struct Font	Font;
	char	*encpath;
	char	*path;
	char	*file;
	char	*base;
	char	*fontname;
	char	*supply;
	int	*fontab;
	short	**bbtab;
	char	*kerntab;
	unsigned short	*codetab;
	unsigned short	*fitab;
	char	**nametab;
	int	*unitab;
	int	nunitab;
	void	*unimap;
	int	*encmap;
	struct namecache	*namecache;
	int	nameprime;
	struct kernpairs	*kernpairs;
	struct charpair	*gid2tr;
	int	nspace;
	struct feature	**features;
	int	rq;
	int	lineno;
	int	nchars;
	int	fichars;
	int	capheight;
	int	xheight;
	int	isFixedPitch;
	int	ascender;
	int	descender;
	enum spec	spec;
	enum {
		TYPE_AFM,
		TYPE_OTF,
		TYPE_TTF
	}	type;
} **afmtab;
extern int nafm;

extern	unsigned short	**fitab;
extern	int		**fontab;
extern	char		**kerntab;
extern	unsigned short	**codetab;
extern	struct Font	**fontbase;

extern	int		NCHARS;

extern unsigned short	unitsPerEm;

extern	int	afmget(struct afmtab *, char *, size_t);
extern	int	otfget(struct afmtab *, char *, size_t);
extern	struct namecache	*afmnamelook(struct afmtab *, const char *);
extern	int	afmgetkern(struct afmtab *, int, int);
extern	void	makefont(int, const char *, const char *, const char *, const char *, int);
extern	int	unitconv(int);
extern	void	afmalloc(struct afmtab *, int);
extern	void	afmremap(struct afmtab *);
extern	int	afmmapname(const char *, enum spec);
extern	void	afmaddchar(struct afmtab *, int, int, int, int, int[],
			char *, enum spec, int);
extern void	afmaddkernpair(struct afmtab *, int, int, int);
extern	int	nextprime(int n);
extern	unsigned	pjw(const char *);
extern	char	*afmencodepath(const char *);
extern	char	*afmdecodepath(const char *);
#ifdef	DPOST
#include <stdio.h>
extern	int	otfcff(const char *, char *, size_t, size_t *, size_t *);
extern	int	otft42(char *, char *, char *, size_t, FILE *);
extern	int	fprintenc(FILE *, const char *);
#endif

extern struct dev	dev;

#define	_unitconv(i)	(unitsPerEm * 72 == dev.res ? (i) : unitconv(i))

#endif	/* !TROFF_AFM_H */