1
/* cvt.c -- Control Value Table
2
* Copyright (C) 1996 Li-Da Lho, All right reserved
14
/* $Id: cvt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */
17
static char vcid[] = "$Id: cvt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
19
static void ttfLoadCVT(FILE *fp,FWord *cvt,USHORT lenght,ULONG offset);
21
void ttfInitCVT(TTFontPtr font)
23
ULONG tag = 'c' | 'v' << 8 | 't' << 16 | ' ' << 24;
26
if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
28
font->cvtLength = ptd->length / sizeof(FWord);
29
font->cvt = (FWord *) calloc(font->cvtLength, sizeof(FWord));
30
if (font->cvt != NULL)
31
ttfLoadCVT(font->fp,font->cvt,font->cvtLength,ptd->offset);
35
static void ttfLoadCVT(FILE *fp,FWord *cvt,USHORT length,ULONG offset)
37
if (fseek(fp,offset,SEEK_SET) !=0)
38
ttfError("Fseek Failed in ttfLoadCVT \n");
40
if (fread(cvt, sizeof(FWord), length, fp) != length)
41
ttfError("Error when getting CVT\n");
43
#ifndef WORDS_BIGENDIAN
44
TwoByteSwap((unsigned char *) cvt,length*sizeof(FWord));
48
void ttfPrintCVT(FILE *fp, FWord *cvt, USHORT cvtLength)
52
fprintf(fp,"'cvt ' Table - Control Value Table\n");
53
fprintf(fp,"----------------------------------\n");
54
fprintf(fp,"Size = %d bytes, %d entries\n",cvtLength*sizeof(FWord),
57
for (i=0;i<cvtLength;i++)
59
fprintf(fp,"\t %4d. \t %d\n",i,cvt[i]);
64
void ttfFreeCVT(FWord *cvt)