Debian Codegraph @

texk/ttfdump/libttf/fpgm.c

raw
1 /* fpgm.c -- Font Program
2 * Copyright (C) 1996 Li-Da Lho, All right reserved
3 */
4 #ifdef HAVE_CONFIG_H
5 #include <config.h>
6 #endif
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include "ttf.h"
11 #include "ttfutil.h"
12
13 /* $Id: fpgm.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
14
15 static void ttfLoadFPGM(FILE *fp,BYTE *fpgm,USHORT lenght,ULONG offset);
16
17 void ttfInitFPGM(TTFontPtr font)
18 {
19 ULONG tag = FT_MAKE_TAG ('f', 'p', 'g', 'm');
20 TableDirPtr ptd;
21
22 if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
23 {
24 font->fpgmLength = ptd->length;
25 font->fpgm = XCALLOC (font->fpgmLength, BYTE);
26 ttfLoadFPGM(font->fp,font->fpgm,font->fpgmLength,ptd->offset);
27 }
28 }
29
30 static void ttfLoadFPGM(FILE *fp,BYTE *fpgm,USHORT length,ULONG offset)
31 {
32 xfseek(fp, offset, SEEK_SET, "ttfLoadFPGM");
33
34 if (fread(fpgm, sizeof(BYTE), length, fp) != length)
35 ttfError("Error when getting CVT\n");
36 }
37
38 void ttfPrintFPGM(FILE *fp, BYTE *fpgm, USHORT length)
39 {
40 ttfPrintInstructions(fp, fpgm);
41 }
42
43 void ttfFreeFPGM(BYTE *fpgm)
44 {
45 if (fpgm != NULL)
46 free(fpgm);
47 }