summaryrefslogtreecommitdiff
path: root/Build/source/texk/ttfdump/libttf/maxp.c
blob: 1b36fb2690baad4e734646a671890050cb39018e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "ttf.h"
#include "ttfutil.h"

/* 	$Id: maxp.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $	 */

static void ttfLoadMAXP(FILE *fp,MAXPPtr maxp,ULONG offset);

void ttfInitMAXP(TTFontPtr font)
{
    ULONG tag = FT_MAKE_TAG ('m', 'a', 'x', 'p');
    TableDirPtr ptd;

    if ((ptd = ttfLookUpTableDir(tag,font)) != NULL)
	{
	    font->maxp = XCALLOC1 (MAXP);
	    ttfLoadMAXP(font->fp,font->maxp,ptd->offset);
	}
}

static void ttfLoadMAXP(FILE *fp,MAXPPtr maxp,ULONG offset)
{
    xfseek(fp, offset, SEEK_SET, "ttfLoadMAXP");

    maxp->version = ttfGetFixed(fp);
    maxp->numGlyphs = ttfGetUSHORT(fp);
    maxp->maxPoints = ttfGetUSHORT(fp);
    maxp->maxContours = ttfGetUSHORT(fp);
    maxp->maxCompositePoints = ttfGetUSHORT(fp);
    maxp->maxCompositeContours = ttfGetUSHORT(fp);
    maxp->maxZones = ttfGetUSHORT(fp);
    maxp->maxTwilightPoints = ttfGetUSHORT(fp);
    maxp->maxStorage = ttfGetUSHORT(fp);
    maxp->maxFunctionDefs = ttfGetUSHORT(fp);
    maxp->maxInstructionDefs = ttfGetUSHORT(fp);
    maxp->maxStackElements = ttfGetUSHORT(fp);
    maxp->maxSizeOfInstructions = ttfGetUSHORT(fp);
    maxp->maxComponentElements = ttfGetUSHORT(fp);
    maxp->maxComponentDepth = ttfGetUSHORT(fp);
}

void ttfPrintMAXP(FILE *fp,MAXPPtr maxp)
{
    int b[2];
    
    FixedSplit(maxp->version,b);

    fprintf(fp,"'maxp' Table - Maximum Profile\n");
    fprintf(fp,"------------------------------\n");
    fprintf(fp,"\t 'maxp' version:\t %d.%d\n",b[1],b[0]);
    fprintf(fp,"\t numGlyphs:\t\t %d\n",maxp->numGlyphs);
    fprintf(fp,"\t maxPoints:\t\t %d\n",maxp->maxPoints);
    fprintf(fp,"\t maxContours:\t\t %d\n",maxp->maxContours);
    fprintf(fp,"\t maxCompositePoints:\t %d\n",maxp->maxCompositePoints);
    fprintf(fp,"\t maxCompositeContours:\t %d\n",maxp->maxCompositeContours);
    fprintf(fp,"\t maxZones:\t\t %d\n",maxp->maxZones);
    fprintf(fp,"\t maxTwilightPoints:\t %d\n",maxp->maxTwilightPoints);
    fprintf(fp,"\t maxStorage:\t\t %d\n",maxp->maxStorage);
    fprintf(fp,"\t maxFunctionDefs:\t %d\n",maxp->maxFunctionDefs);
    fprintf(fp,"\t maxInstructionDefs:\t %d\n",maxp->maxInstructionDefs);
    fprintf(fp,"\t maxStackElements:\t %d\n",maxp->maxStackElements);
    fprintf(fp,"\t maxSizeOfInstructions:\t %d\n",maxp->maxSizeOfInstructions);
    fprintf(fp,"\t maxComponentElements:\t %d\n",maxp->maxComponentElements);
    fprintf(fp,"\t maxCompoenetDepth:\t %d\n",maxp->maxComponentDepth);
}

void ttfFreeMAXP(MAXPPtr maxp)
{
    free(maxp);
}