~ubuntu-branches/ubuntu/jaunty/texlive-bin/jaunty-security

« back to all changes in this revision

Viewing changes to build/TeX/texk/ttfdump/libttf/cvt.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-06-26 23:14:59 UTC
  • mfrom: (2.1.30 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080626231459-y02rjsrgtafu83yr
Tags: 2007.dfsg.2-3
add missing source roadmap.fig of roadmap.eps in fontinst documentation
(Closes: #482915) (urgency medium due to RC bug)
(new patch add-missing-fontinst-source)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* cvt.c -- Control Value Table
2
 
 * Copyright (C) 1996 Li-Da Lho, All right reserved 
3
 
 */
4
 
#include <stdio.h>
5
 
#include <stdlib.h>
6
 
#include "config.h"
7
 
#include "ttf.h"
8
 
#include "ttfutil.h"
9
 
 
10
 
#ifdef MEMCHECK
11
 
#include <dmalloc.h>
12
 
#endif
13
 
 
14
 
/*      $Id: cvt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $    */
15
 
 
16
 
#ifndef lint
17
 
static char vcid[] = "$Id: cvt.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $";
18
 
#endif /* lint */
19
 
static void ttfLoadCVT(FILE *fp,FWord *cvt,USHORT lenght,ULONG offset);
20
 
 
21
 
void ttfInitCVT(TTFontPtr font)
22
 
{
23
 
    ULONG tag = 'c' | 'v' << 8 | 't' << 16 | ' ' << 24;
24
 
    TableDirPtr ptd;
25
 
 
26
 
    if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
27
 
        {
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);
32
 
        }
33
 
}
34
 
 
35
 
static void ttfLoadCVT(FILE *fp,FWord *cvt,USHORT length,ULONG offset)
36
 
{
37
 
    if (fseek(fp,offset,SEEK_SET) !=0)
38
 
        ttfError("Fseek Failed in ttfLoadCVT \n");
39
 
 
40
 
    if (fread(cvt, sizeof(FWord), length, fp) != length)
41
 
        ttfError("Error when getting CVT\n");
42
 
 
43
 
#ifndef WORDS_BIGENDIAN
44
 
    TwoByteSwap((unsigned char *) cvt,length*sizeof(FWord));
45
 
#endif
46
 
}
47
 
 
48
 
void ttfPrintCVT(FILE *fp, FWord *cvt, USHORT cvtLength)
49
 
{
50
 
    USHORT i;
51
 
 
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),
55
 
            cvtLength);
56
 
 
57
 
    for (i=0;i<cvtLength;i++)
58
 
        {
59
 
            fprintf(fp,"\t %4d. \t %d\n",i,cvt[i]);
60
 
        }
61
 
    fprintf(fp,"\n");
62
 
}
63
 
 
64
 
void ttfFreeCVT(FWord *cvt)
65
 
{
66
 
    if (cvt != NULL)
67
 
        free(cvt);
68
 
}