diff options
author | Karl Berry <karl@freefriends.org> | 2021-02-25 19:22:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-02-25 19:22:25 +0000 |
commit | ad547a6b5986815fda458221149728d9d9ab1d87 (patch) | |
tree | 16296910eb3eca724371474ea9aea3994dc69614 /Build/source/texk/ttfdump/libttf/vhea.c | |
parent | 947b43de3dd21d58ccc2ffadefc4441ea1c2a813 (diff) |
restore Build,TODO from r57911
git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ttfdump/libttf/vhea.c')
-rw-r--r-- | Build/source/texk/ttfdump/libttf/vhea.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/Build/source/texk/ttfdump/libttf/vhea.c b/Build/source/texk/ttfdump/libttf/vhea.c new file mode 100644 index 00000000000..3a74c36adb0 --- /dev/null +++ b/Build/source/texk/ttfdump/libttf/vhea.c @@ -0,0 +1,84 @@ +/* vhea.c -- Vertical Header Table + * Copyright (C) 1997 Li-Da Lho, All right reserved + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include "ttf.h" +#include "ttfutil.h" + +/* $Id: vhea.c,v 1.1.1.1 1998/06/05 07:47:52 robert Exp $ */ + +static void ttfLoadVHEA(FILE *fp,VHEAPtr vhea,ULONG offset); + +void ttfInitVHEA(TTFontPtr font) +{ + ULONG tag = FT_MAKE_TAG ('v', 'h', 'e', 'a'); + TableDirPtr ptd; + + if ((ptd = ttfLookUpTableDir(tag,font)) != NULL) + { + font->vhea = XCALLOC1 (VHEA); + ttfLoadVHEA(font->fp,font->vhea,ptd->offset); + } +} + +static void ttfLoadVHEA (FILE *fp,VHEAPtr vhea,ULONG offset) +{ + int i; + + xfseek(fp, offset, SEEK_SET, "ttfLoadVHEA"); + + vhea->version = ttfGetFixed(fp); + vhea->ascent = ttfGetSHORT(fp); + vhea->descent = ttfGetSHORT(fp); + vhea->lineGap = ttfGetSHORT(fp); + vhea->advanceHeightMax = ttfGetSHORT(fp); + vhea->minTopSideBearing = ttfGetSHORT(fp); + vhea->minBottomSideBearing = ttfGetSHORT(fp); + vhea->yMaxExtent = ttfGetSHORT(fp); + vhea->caretSlopeRise = ttfGetSHORT(fp); + vhea->caretSlopeRun = ttfGetSHORT(fp); + vhea->caretOffset = ttfGetSHORT(fp); + for(i=0;i<4;i++) + (vhea->reserved)[i] = ttfGetSHORT(fp); + vhea->metricDataFormat = ttfGetSHORT(fp); + vhea->numOfLongVerMetrics = ttfGetUSHORT(fp); +} + +void ttfPrintVHEA(FILE *fp,VHEAPtr vhea) +{ + int i,b[2]; + + fprintf(fp,"'VHEA' - Vertical Header Table\n"); + fprintf(fp,"------------------------------\n"); + + FixedSplit(vhea->version,b); + + fprintf(fp,"\t version:\t %d.%d\n",b[1],b[0]); + fprintf(fp,"\t ascent:\t %d\n",vhea->ascent); + fprintf(fp,"\t descent:\t %d\n",vhea->descent); + fprintf(fp,"\t lineGap:\t %d\n",vhea->lineGap); + fprintf(fp,"\t advanceHeightMax: %d\n",vhea->advanceHeightMax); + fprintf(fp,"\t minTopSideBearing: %d\n",vhea->minTopSideBearing); + fprintf(fp,"\t minBottomBearing: %d\n",vhea->minBottomSideBearing); + fprintf(fp,"\t yMaxExtent:\t %d\n",vhea->yMaxExtent); + fprintf(fp,"\t caretSlopeRise: %d\n", vhea->caretSlopeRise); + fprintf(fp,"\t caretSlopeRun: %d\n", vhea->caretSlopeRun); + fprintf(fp,"\t caretOffset:\t %d\n", vhea->caretOffset); + for(i=0;i<4;i++) + fprintf(fp,"\t reserved %d:\t %d\n",i,(vhea->reserved)[i]); + fprintf(fp,"\t metricDataFormat:\t %d\n", vhea->metricDataFormat); + fprintf(fp,"\t numOfLongVerMetrics: %d\n",vhea->numOfLongVerMetrics); +} + +void ttfFreeVHEA(VHEAPtr vhea) +{ + if (vhea != NULL) + { + free(vhea); + } +} |