| 1 |
/* prep.c -- Control Value 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: prep.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */ |
| 14 |
|
| 15 |
static void ttfLoadPREP(FILE *fp,BYTE *prep,USHORT lenght,ULONG offset); |
| 16 |
|
| 17 |
void ttfInitPREP(TTFontPtr font) |
| 18 |
{ |
| 19 |
ULONG tag = FT_MAKE_TAG ('p', 'r', 'e', 'p'); |
| 20 |
TableDirPtr ptd; |
| 21 |
|
| 22 |
if ((ptd = ttfLookUpTableDir(tag,font)) != NULL) |
| 23 |
{ |
| 24 |
font->prepLength = ptd->length; |
| 25 |
font->prep = XCALLOC (font->prepLength, BYTE); |
| 26 |
ttfLoadPREP(font->fp,font->prep,font->prepLength,ptd->offset); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
static void ttfLoadPREP(FILE *fp,BYTE *prep,USHORT length,ULONG offset) |
| 31 |
{ |
| 32 |
xfseek(fp, offset, SEEK_SET, "ttfLoadPREP"); |
| 33 |
|
| 34 |
if (fread(prep, sizeof(BYTE), length, fp) != length) |
| 35 |
ttfError("Error when getting PREP\n"); |
| 36 |
} |
| 37 |
|
| 38 |
void ttfPrintPREP(FILE *fp, BYTE *prep, USHORT length) |
| 39 |
{ |
| 40 |
ttfPrintInstructions(fp, prep); |
| 41 |
} |
| 42 |
|
| 43 |
void ttfFreePREP(BYTE *prep) |
| 44 |
{ |
| 45 |
if (prep != NULL) |
| 46 |
free(prep); |
| 47 |
} |