(file) Return to afmint.h CVS log (file) (dir) Up to [RizwankCVS] / testProject / source / src / afmlib

  1 rizwank 1.1 /*
  2              * Internal header for the AFM library.
  3              * Copyright (c) 1995-1999 Markku Rossi.
  4              *
  5              * Author: Markku Rossi <mtr@iki.fi>
  6              */
  7             
  8             /*
  9              * This program is free software; you can redistribute it and/or modify
 10              * it under the terms of the GNU General Public License as published by
 11              * the Free Software Foundation; either version 2, or (at your option)
 12              * any later version.
 13              *
 14              * This program is distributed in the hope that it will be useful,
 15              * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16              * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 17              * GNU General Public License for more details.
 18              *
 19              * You should have received a copy of the GNU General Public License
 20              * along with this program; see the file COPYING.  If not, write to
 21              * the Free Software Foundation, 59 Temple Place - Suite 330,
 22 rizwank 1.1  * Boston, MA 02111-1307, USA.
 23              */
 24             
 25             #ifndef AFMINT_H
 26             #define AFMINT_H
 27             
 28             /*
 29              * Config stuffs.
 30              */
 31             
 32             #ifdef HAVE_CONFIG_H
 33             #include <config.h>
 34             #endif
 35             
 36             #include <stdio.h>
 37             
 38             #ifndef ___P
 39             #if PROTOTYPES
 40             #define ___P(protos) protos
 41             #else /* no PROTOTYPES */
 42             #define ___P(protos) ()
 43 rizwank 1.1 #endif /* no PROTOTYPES */
 44             #endif
 45             
 46             #if STDC_HEADERS
 47             
 48             #include <stdlib.h>
 49             #include <string.h>
 50             
 51             #else /* no STDC_HEADERS */
 52             
 53             #if HAVE_STDLIB_H
 54             #include <stdlib.h>
 55             #endif
 56             
 57             #if HAVE_STRING_H
 58             #include <string.h>
 59             #endif
 60             
 61             #ifndef HAVE_STRCHR
 62             #define strchr index
 63             #define strrchr rindex
 64 rizwank 1.1 #endif
 65             char *strchr ();
 66             char *strrchr ();
 67             
 68             #ifndef HAVE_MEMCPY
 69             #define memcpy(d, s, n) bcopy((s), (d), (n))
 70             #endif
 71             
 72             #ifndef HAVE_STRERROR
 73             extern char *strerror ___P ((int));
 74             #endif
 75             
 76             #endif /* no STDC_HEADERS */
 77             
 78             #if HAVE_UNISTD_H
 79             #include <unistd.h>
 80             #endif
 81             
 82             #include <setjmp.h>
 83             #include <assert.h>
 84             #include <errno.h>
 85 rizwank 1.1 
 86             #include <sys/types.h>
 87             #include <sys/stat.h>
 88             
 89             #include "afm.h"
 90             #include "strhash.h"
 91             
 92             
 93             /*
 94              * Types and definitions.
 95              */
 96             
 97             /* Error codes. */
 98             #define AFM_ERROR			1
 99             #define AFM_ERROR_MEMORY		2
100             #define AFM_ERROR_ARGUMENT		3
101             #define AFM_ERROR_UNKNOWN_FONT		4
102             #define AFM_ERROR_SYNTAX		5
103             #define AFM_ERROR_UNSUPPORTED_FORMAT	6
104             #define AFM_ERROR_FILE_IO		7
105             #define AFM_ERROR_NOT_AFM_FILE		8
106 rizwank 1.1 #define NUM_ERRORS			9
107             
108             /* Pack error and global errno. */
109             #define SYSERROR(code) (errno << 16 | (code))
110             
111             
112             /* Keys. */
113             
114             typedef enum
115             {
116               kComment,
117             
118               /* File structure. */
119               kStartFontMetrics,
120               kEndFontMetrics,
121               kStartCompFontMetrics,
122               kEndCompFontMetrics,
123               kStartDescendent,
124               kEndDescendent,
125               kStartMasterFontMetrics,
126               kEndMasterFontMetrics,
127 rizwank 1.1 
128               /* Control information. */
129               kMetricsSets,
130               kDescendents,
131               kMasters,
132               kAxes,
133             
134               /* Global font information. */
135               kFontName,
136               kFullName,
137               kFamilyName,
138               kWeight,
139               kFontBBox,
140               kVersion,
141               kNotice,
142               kEncodingScheme,
143               kMappingScheme,
144               kEscChar,
145               kCharacterSet,
146               kCharacters,
147               kIsBaseFont,
148 rizwank 1.1   kVVector,
149               kIsFixedV,
150               kCapHeight,
151               kXHeight,
152               kAscender,
153               kDescender,
154               kWeightVector,
155               kBlendDesignPositions,
156               kBlendDesignMap,
157               kBlendAxisTypes,
158             
159               /* Writing direction information. */
160               kStartDirection,
161               kEndDirection,
162               kUnderlinePosition,
163               kUnderlineThickness,
164               kItalicAngle,
165               kCharWidth,
166               kIsFixedPitch,
167             
168               /* Individual character metrics. */
169 rizwank 1.1   kStartCharMetrics,
170               kEndCharMetrics,
171               kC,
172               kCH,
173               kWX,
174               kW0X,
175               kW1X,
176               kWY,
177               kW0Y,
178               kW1Y,
179               kW,
180               kW0,
181               kW1,
182               kVV,
183               kN,
184               kB,
185               kL,
186             
187               /* Kerning data. */
188               kStartKernData,
189               kEndKernData,
190 rizwank 1.1   kStartTrackKern,
191               kEndTrackKern,
192               kTrackKern,
193               kStartKernPairs,
194               kEndKernPairs,
195               kKP,
196               kKPH,
197               kKPX,
198               kKPY,
199             
200               /* Composite character data. */
201               kStartComposites,
202               kEndComposites,
203               kCC,
204               kPCC,
205             
206               /* Axis information. */
207               kStartAxis,
208               kEndAxis,
209               kAxisType,
210               kAxisLabel,
211 rizwank 1.1 
212               /* Master Design Information */
213               kStartMaster,
214               kEndMaster
215             
216             } AFMKey;
217             
218             
219             struct afm_handle_st
220             {
221               unsigned int verbose;		/* verbose level */
222               StringHashPtr font_map;	/* fontname -> AFM filename mapping */
223             
224               /* Parse support. */
225               jmp_buf jmpbuf;
226               AFMError parse_error;		/* Error that caused longjmp(). */
227             };
228             
229             
230             /* Store library's private font data to this structure. */
231             struct afm_font_private_data_st
232 rizwank 1.1 {
233               /* Character that is used for undefined codes (' '). */
234               AFMIndividualCharacterMetrics *undef;
235             
236               StringHashPtr fontnames;	/* fontname -> character info mapping */
237               StringHashPtr compositenames;	/* composite -> AFMComposite mapping */
238             };
239             
240             
241             /*
242              * Encoding tables.
243              */
244             
245             struct encoding_table_st
246             {
247               int code;
248               char *character;
249             };
250             
251             typedef struct encoding_table_st AFMEncodingTable;
252             
253 rizwank 1.1 extern AFMEncodingTable afm_88591_encoding[];
254             extern AFMEncodingTable afm_88592_encoding[];
255             extern AFMEncodingTable afm_88593_encoding[];
256             extern AFMEncodingTable afm_88594_encoding[];
257             extern AFMEncodingTable afm_88595_encoding[];
258             extern AFMEncodingTable afm_88597_encoding[];
259             extern AFMEncodingTable afm_88599_encoding[];
260             extern AFMEncodingTable afm_885910_encoding[];
261             extern AFMEncodingTable afm_ibmpc_encoding[];
262             extern AFMEncodingTable afm_mac_encoding[];
263             extern AFMEncodingTable afm_vms_encoding[];
264             extern AFMEncodingTable afm_hp8_encoding[];
265             extern AFMEncodingTable afm_koi8_encoding[];
266             
267             
268             /*
269              * Global help functions.
270              */
271             
272             /* Print message if <level> is larger than library's verbose level. */
273             void afm_message ___P ((AFMHandle handle, unsigned int level, char *message));
274 rizwank 1.1 
275             /* Print error message to stderr. */
276             void afm_error ___P ((AFMHandle handle, char *message));
277             
278             
279             /*
280              * AFM file parsing
281              */
282             
283             /* Parse AFM file <filename> and fill up font <font>. */
284             void afm_parse_file ___P ((AFMHandle handle, const char *filename,
285             			   AFMFont font));
286             
287             #endif /* not AFMINT_H */

Rizwan Kassim
Powered by
ViewCVS 0.9.2