| 1 |
/* ltsh.c -- Linear Threshold table |
| 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: ltsh.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */ |
| 14 |
|
| 15 |
static void ttfLoadLTSH(FILE *fp,LTSHPtr ltsh,ULONG offset); |
| 16 |
|
| 17 |
void ttfInitLTSH(TTFontPtr font) |
| 18 |
{ |
| 19 |
ULONG tag = FT_MAKE_TAG ('L', 'T', 'S', 'H'); |
| 20 |
TableDirPtr ptd; |
| 21 |
|
| 22 |
if ((ptd = ttfLookUpTableDir(tag,font)) != NULL) |
| 23 |
{ |
| 24 |
font->ltsh = XCALLOC1 (LTSH); |
| 25 |
ttfLoadLTSH(font->fp,font->ltsh,ptd->offset); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
static void ttfLoadLTSH (FILE *fp,LTSHPtr ltsh,ULONG offset) |
| 30 |
{ |
| 31 |
xfseek(fp, offset, SEEK_SET, "ttfLoadLTSH"); |
| 32 |
|
| 33 |
ltsh->version = ttfGetUSHORT(fp); |
| 34 |
ltsh->numGlyphs = ttfGetUSHORT(fp); |
| 35 |
|
| 36 |
ltsh->yPels = ttfMakeBYTE (ltsh->numGlyphs, fp); |
| 37 |
} |
| 38 |
|
| 39 |
void ttfPrintLTSH(FILE *fp,LTSHPtr ltsh) |
| 40 |
{ |
| 41 |
int i; |
| 42 |
|
| 43 |
fprintf(fp,"'LTSH' Table - Linear Threshold Table\n"); |
| 44 |
fprintf(fp,"-------------------------------------\n"); |
| 45 |
fprintf(fp,"'LTSH' Version:\t %d\n",ltsh->version); |
| 46 |
fprintf(fp,"Number of Glyphs:\t %d\n",ltsh->numGlyphs); |
| 47 |
fprintf(fp,"\t Glyph # \t Threshold\n"); |
| 48 |
|
| 49 |
for (i=0;i<ltsh->numGlyphs;i++) |
| 50 |
{ |
| 51 |
fprintf(fp,"\t %d. \t\t %d\n",i,ltsh->yPels[i]); |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
void ttfFreeLTSH(LTSHPtr ltsh) |
| 56 |
{ |
| 57 |
if (ltsh != NULL) |
| 58 |
{ |
| 59 |
free(ltsh->yPels); |
| 60 |
free(ltsh); |
| 61 |
} |
| 62 |
} |