summaryrefslogtreecommitdiff
path: root/Build/source/texk/ttfdump/include
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/ttfdump/include
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ttfdump/include')
-rw-r--r--Build/source/texk/ttfdump/include/gcache.h24
-rw-r--r--Build/source/texk/ttfdump/include/gstate.h86
-rw-r--r--Build/source/texk/ttfdump/include/loadtable.h105
-rw-r--r--Build/source/texk/ttfdump/include/os2_P.h197
-rw-r--r--Build/source/texk/ttfdump/include/protos.h22
-rw-r--r--Build/source/texk/ttfdump/include/tables.h585
-rw-r--r--Build/source/texk/ttfdump/include/ttc.h25
-rw-r--r--Build/source/texk/ttfdump/include/ttf.h187
-rw-r--r--Build/source/texk/ttfdump/include/ttfutil.h19
9 files changed, 1250 insertions, 0 deletions
diff --git a/Build/source/texk/ttfdump/include/gcache.h b/Build/source/texk/ttfdump/include/gcache.h
new file mode 100644
index 00000000000..e8785e306bd
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/gcache.h
@@ -0,0 +1,24 @@
+#ifndef __TTF_GCACHE_H
+#define __TTF_GCACHE_H
+
+#include "tables.h"
+
+/* $Id: gcache.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+typedef struct _gcache
+{
+ ULONG offset; /* offset of the glyph; this is the key
+ * for sorting/searching with the glyph
+ * cache */
+ struct _gcache *prev, *next; /* pointer to previous and next element on
+ * the LRU list */
+ struct _gcache *left, *right; /* pointer to left and right subtree on
+ * the binary search tree */
+ GLYF glyf; /* the actual place to hold the glyph data */
+}
+GlyphCache, *GlyphCachePtr;
+
+#endif /* __TTF_GCACHE_H */
+
+
+/* end of gcache.h */
diff --git a/Build/source/texk/ttfdump/include/gstate.h b/Build/source/texk/ttfdump/include/gstate.h
new file mode 100644
index 00000000000..b1ed1f840d7
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/gstate.h
@@ -0,0 +1,86 @@
+/* gstate.h -- define data structures for Graphics State, graphics states are
+ * mananged by font instructions.
+ * Copyright (C) 1996 Li-Da Lho, All right reserved.
+ */
+
+#ifndef __TTF_GSTATE_H
+#define __TTF_GSTATE_H
+
+/* $Id: gstate.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+/* unit vectors used for directional purposes */
+#define F2Dot14_ONE 1<<14
+#define F2Dot14_EPSILON 1
+
+#define F26Dot6_ONE 1L<<26
+#define F26Dot6_EPSILON 1L
+
+typedef struct
+{
+ F2Dot14 x;
+ F2Dot14 y;
+}
+TTFUnitVector;
+
+/* Unit vectors pointing into x and y direction */
+#define UnitX {F2Dot14_ONE,0}
+#define UnitY {0,F2Dot14_ONE}
+
+/* vectors used as positional vectors */
+typedef struct
+{
+ F26Dot6 x;
+ F26Dot6 y;
+}
+TTFVector;
+
+/* the types of the following fields are not well defined in the True Type
+ * Font specification.
+ * We can define them as we like.
+ */
+typedef struct
+{
+ /* boolean values */
+ BYTE auto_flip;
+
+ BYTE scan_control;
+ USHORT instruction_control;
+ SHORT round_state;
+
+ F26Dot6 control_value_cut_in;
+ F26Dot6 minimum_distance;
+ F26Dot6 single_width_cut_in;
+ FWord single_width_value;
+
+ ULONG delta_base;
+ ULONG delta_shift;
+
+ /* unit vectors */
+ TTFUnitVector dual_projection_vector;
+ TTFUnitVector freedom_vector;
+ TTFUnitVector projection_vector;
+
+ /* reference points */
+ ULONG rp0;
+ ULONG rp1;
+ ULONG rp2;
+
+ /* zone pointers: take only 0 or 1 as values */
+ ULONG zp0;
+ ULONG zp1;
+ ULONG zp2;
+
+ SHORT gep0;
+ SHORT gep1;
+ SHORT gep2;
+
+ ULONG loop;
+}
+GraphicsState;
+
+#define GS_DEFAULT
+
+#endif /* __TTF_GSTATE_H */
+
+
+/* end of gstate.h */
diff --git a/Build/source/texk/ttfdump/include/loadtable.h b/Build/source/texk/ttfdump/include/loadtable.h
new file mode 100644
index 00000000000..9bf74f0b5ab
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/loadtable.h
@@ -0,0 +1,105 @@
+#ifndef __TTF_LOADTABLE_H
+#define __TTF_LOADTABLE_H
+
+#include "tables.h"
+
+/* $Id: loadtable.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+void ttfLoadRequiredTables(TTFontPtr font);
+void ttfFreeRequiredTables(TTFontPtr font);
+void ttfLoadOptionalTables(TTFontPtr font);
+void ttfFreeOptionalTables(TTFontPtr font);
+
+void ttfInitTableDir(TTFontPtr font, ULONG offset);
+void ttfPrintTableDir(FILE *fp, TableDirPtr p);
+void ttfFreeTableDir(TableDirPtr p);
+TableDirPtr ttfLookUpTableDir(ULONG tag, TTFontPtr font);
+
+void ttfInitCMAP(TTFontPtr font);
+void ttfPrintCMAP(FILE *fp, CMAPPtr cmap);
+USHORT ttfLookUpCMAP(SubTablePtr subTable, USHORT cc);
+SubTablePtr ttfSelectCMAP(CMAPPtr cmap, USHORT PlatformID, USHORT EncodingID);
+void ttfFreeCMAP(CMAPPtr cmap);
+
+void ttfInitGLYF(TTFontPtr font);
+void ttfLoadGLYF(FILE *fp, GLYFPtr glyf, ULONG offset);
+void ttfPrintGLYF(FILE *fp, GLYFPtr glyf);
+void ttfFreeGLYF(GLYFPtr glyf);
+GLYFPtr ttfLoadGlyphIndex(TTFont * font, USHORT idx);
+GLYFPtr ttfLoadGlyphCode(TTFont * fnt, USHORT cc);
+
+void ttfInitGlyphCache(TTFontPtr font);
+void ttfCleanUpGlyphCache(TTFontPtr font);
+GLYFPtr ttfLoadGlyphCached(TTFontPtr font, ULONG offset);
+
+void ttfInitHEAD(TTFontPtr font);
+void ttfPrintHEAD(FILE *, HEADPtr head);
+void ttfFreeHEAD(HEADPtr head);
+
+void ttfInitHHEA(TTFontPtr font);
+void ttfPrintHHEA(FILE *fp, HHEAPtr hhea);
+void ttfFreeHHEA(HHEAPtr hhea);
+
+void ttfInitHMTX(TTFontPtr font);
+void ttfPrintHMTX(FILE *fp, HMTXPtr hmtx);
+void ttfFreeHMTX(HMTXPtr hmtx);
+
+void ttfInitLOCA(TTFontPtr font);
+void ttfPrintLOCA(FILE *fp, LOCAPtr loca);
+void ttfFreeLOCA(LOCAPtr loca);
+ULONG ttfLookUpGlyfLOCA(LOCAPtr loca, USHORT idx);
+
+void ttfInitMAXP(TTFontPtr font);
+void ttfPrintMAXP(FILE *fp, MAXPPtr maxp);
+void ttfFreeMAXP(MAXPPtr maxp);
+
+void ttfInitNAME(TTFontPtr font);
+void ttfPrintNAME(FILE *fp, NAMEPtr name);
+void ttfFreeNAME(NAMEPtr name);
+
+void ttfInitPOST(TTFontPtr fot);
+void ttfPrintPOST(FILE *fp, POSTPtr post);
+void ttfFreePOST(POSTPtr post);
+
+void ttfInitOS2(TTFontPtr font);
+void ttfPrintOS2(FILE *fp, OS_2Ptr os2);
+void ttfFreeOS2(OS_2Ptr os2);
+
+void ttfInitCVT(TTFontPtr font);
+void ttfPrintCVT(FILE *fp, FWord * cvt, USHORT cvtLength);
+void ttfFreeCVT(FWord * cvt);
+
+void ttfInitFPGM(TTFontPtr font);
+void ttfPrintFPGM(FILE *fp, BYTE * fpgm, USHORT length);
+void ttfFreeFPGM(BYTE * fpgm);
+
+void ttfInitGASP(TTFontPtr font);
+void ttfPrintGASP(FILE *fp, GASPPtr gasp);
+void ttfFreeGASP(GASPPtr gasp);
+
+void ttfInitHDMX(TTFontPtr font);
+void ttfPrintHDMX(FILE *fp, HDMXPtr hdmx);
+void ttfFreeHDMX(HDMXPtr hdmx);
+
+void ttfInitPREP(TTFontPtr font);
+void ttfPrintPREP(FILE *fp, BYTE * prep, USHORT length);
+void ttfFreePREP(BYTE * prep);
+
+void ttfInitLTSH(TTFontPtr font);
+void ttfPrintLTSH(FILE *fp, LTSHPtr ltsh);
+void ttfFreeLTSH(LTSHPtr ltsh);
+
+void ttfInitVDMX(TTFontPtr font);
+void ttfPrintVDMX(FILE *fp, VDMXPtr vdmx);
+void ttfFreeVDMX(VDMXPtr vdmx);
+
+void ttfInitGraphicsState(TTFontPtr font);
+void ttfInitStack(TTFontPtr font);
+void ttfInitStorageArea(TTFontPtr font);
+
+void ttfPrintInstructions(FILE *fp, BYTE * ins);
+
+#endif /* __TTF_LOADTABLE_H */
+
+
+/* end of loadtable.h */
diff --git a/Build/source/texk/ttfdump/include/os2_P.h b/Build/source/texk/ttfdump/include/os2_P.h
new file mode 100644
index 00000000000..6d4cf46a48b
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/os2_P.h
@@ -0,0 +1,197 @@
+/* Private header file for os2.c */
+#ifdef __TTF_OS2
+#ifndef __TTF_OS2_H
+#define __TTF_OS2_H
+
+static char *WeightClassName[] =
+{
+ "Thin", /* Ultra-light */
+ "Extra-light",
+ "Light",
+ "Normal", /* Semi-light */
+ "Medium",
+ "Semi-bold",
+ "Bold",
+ "Extra-Bold",
+ "Black" /* Ultra-bold */
+};
+
+static char *WidthClassName[] =
+{
+ "Ultra-condensed",
+ "Extra-condensed",
+ "Condensed",
+ "Semi-condensed",
+ "Medium",
+ "Semi-expanded",
+ "Expanded",
+ "Extra-expanded",
+ "Ultra-expanded"
+};
+
+static char *PanoseFamily[] =
+{
+ "Any",
+ "No Fit",
+ "Text and Display",
+ "Script",
+ "Decorative",
+ "Pictorial"
+};
+
+static char *PanoseSerif[] =
+{
+ "Any",
+ "No Fit",
+ "Cove",
+ "Obtuse Cove",
+ "Square Cove",
+ "Obtuse Square Cove",
+ "Square",
+ "Thin",
+ "Bone",
+ "Exaggerated",
+ "Triangle",
+ "Normal Sans",
+ "Obtuse Sans",
+ "Perp Sans",
+ "Flared",
+ "Rounded"
+};
+
+static char *PanoseWeight[] =
+{
+ "Any",
+ "No Fit",
+ "Very Light",
+ "Ligth",
+ "Thin",
+ "Book",
+ "Medium",
+ "Demi",
+ "Bold",
+ "Heavy",
+ "Black",
+ "Nord",
+};
+
+static char *PanoseProportion[] =
+{
+ "Any",
+ "No Fit",
+ "Old Style",
+ "Modern",
+ "Even Width",
+ "Expanded",
+ "Condensed",
+ "Very Expanded",
+ "Very Condensed",
+ "Monospaced"
+};
+
+static char *PanoseContrast[] =
+{
+ "Any",
+ "No Fit",
+ "None",
+ "Very Low",
+ "Low",
+ "Medium Low",
+ "Medium",
+ "Medium High",
+ "High",
+ "Very High",
+};
+
+static char *PanoseStroke[] =
+{
+ "Any",
+ "No Fit",
+ "Gradual/Diagonal",
+ "Gradual/Transitional",
+ "Gradual/Vertical",
+ "Gradual/Horizontal",
+ "Rapid/Vertical",
+ "Rapid/Horizontal",
+ "Rapid/Vertical"
+};
+
+static char *PanoseArm[] =
+{
+ "Any",
+ "No Fit"
+ "Straight Arms/Horizontal",
+ "Straight Arms/Wedge",
+ "Straight Arms/Vertical",
+ "Straight Arms/Single Serif",
+ "Straight Arms/Double Serif",
+ "Non-Straight Arms/Horizontal",
+ "Non-Straight Arms/Wedge",
+ "Non-Straight Arms/Vertical",
+ "Non-Straight Arms/Single Serif",
+ "Non-Straight Arms/Double Serif"
+};
+
+static char *PanoseLetterform[] =
+{
+ "Any",
+ "No Fit",
+ "Normal/Contact",
+ "Normal/Weighted",
+ "Normal/Boxed",
+ "Normal/Flttened",
+ "Normal/Rounded",
+ "Normal/Off Center",
+ "Normal/Square",
+ "Oblique/Contact",
+ "Oblique/Weighted",
+ "Oblique/Boxed",
+ "Oblique/Flattened",
+ "Oblique/Rounded",
+ "Oblique/Off Center",
+ "Oblique/Square"
+};
+
+static char *PanoseMidline[] =
+{
+ "Any",
+ "No Fit",
+ "Standard/Trimmed",
+ "Standard/Pointed",
+ "Standard/Serifed",
+ "High/Trimmed",
+ "High/Pointed"
+ "High/Serifed",
+ "Constant/Trimmed",
+ "Constant/Pointed",
+ "Constant/Serifed",
+ "Low/Trimmed"
+ "Low/Pointed",
+ "Low/Serifed",
+};
+
+static char *PanoseXHeight[] =
+{
+ "Any",
+ "No Fit",
+ "Constant/Small",
+ "Constant/Standard"
+ "Constant/Large"
+ "Ducking/Small",
+ "Ducking/Standard",
+ "Ducking/Large"
+};
+
+#define FS_FLAGS_ITALIC 0x01
+#define FS_FLAGS_UNDERSCORE 0x02
+#define FS_FLAGS_NEGATIVE 0x04
+#define FS_FLAGS_OUTLINED 0x08
+#define FS_FLAGS_STRIKEOUT 0x10
+#define FS_FLAGS_BOLD 0x20
+#define FS_FLAGS_REGULAR 0x40
+
+#endif /* __TTF_OS2_H */
+#endif /* __TTF_OS2 */
+
+
+/* end of os2_P.h */
diff --git a/Build/source/texk/ttfdump/include/protos.h b/Build/source/texk/ttfdump/include/protos.h
new file mode 100644
index 00000000000..66523ab808f
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/protos.h
@@ -0,0 +1,22 @@
+#ifndef __PROTOS_H
+#define __PROTOS_H
+
+extern void ttfInitKERN(TTFontPtr);
+extern void ttfInitPCLT(TTFontPtr);
+extern void ttfInitVHEA(TTFontPtr);
+extern void ttfInitVMTX(TTFontPtr);
+extern void ttfFreeKERN(KERNPtr);
+extern void ttfFreePCLT(PCLTPtr);
+extern void ttfFreeVHEA(VHEAPtr);
+extern void ttfFreeVMTX(VMTXPtr);
+extern void ttfPrintKERN(FILE*, KERNPtr);
+extern void ttfPrintPCLT(FILE*, PCLTPtr);
+extern void ttfPrintVHEA(FILE*, VHEAPtr);
+extern void ttfPrintVMTX(FILE*, VMTXPtr);
+extern BYTE ttfGetBYTE(FILE*);
+extern BYTE GetBYTE(VirtualMachine *);
+extern SHORT GetSHORT(VirtualMachine *);
+extern void Push(VirtualMachine *, LONG);
+extern LONG Pop(VirtualMachine *);
+
+#endif
diff --git a/Build/source/texk/ttfdump/include/tables.h b/Build/source/texk/ttfdump/include/tables.h
new file mode 100644
index 00000000000..cef49726cb9
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/tables.h
@@ -0,0 +1,585 @@
+/* table.h -- define data structures for various ttf file internal tables
+ * See Also: True Type Font Specification
+ */
+
+#ifndef __TTF_TABLE_H
+#define __TTF_TABLE_H
+
+/* $Id: tables.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+/* Offset Table:
+ * Into the beginning of a True Type font file
+ */
+typedef struct _OffsetTable
+{
+ Fixed version;
+ USHORT numTables;
+ USHORT searchRange;
+ USHORT entrySelector;
+ USHORT rangeShift;
+}
+OffsetTable, *OffsetTablePtr;
+
+/* Table Directory:
+ * The directory to find each table in a True Type font file
+ */
+typedef struct _TableDir
+{
+ ULONG tag;
+ ULONG checksum;
+ ULONG offset;
+ ULONG length;
+}
+TableDir, *TableDirPtr;
+
+
+/* cmap: Character to Glyph Index Mapping Table
+ * There are four kinds of cmap, format 0, 2, 4, and 6. They are defined
+ * as follows
+ */
+typedef struct
+{
+ BYTE glyphIndexArray[256];
+}
+CMAP0;
+
+typedef struct _subHeaders
+{
+ USHORT firstCode;
+ USHORT entryCount;
+ SHORT idDelta;
+ USHORT idRangeOffset;
+}
+SubHeader, *SubHeaderPtr;
+
+typedef struct
+{
+ USHORT subHeaderKeys[256];
+ SubHeaderPtr subHeaders;
+ USHORT *glyphIndexArray;
+}
+CMAP2;
+
+typedef struct
+{
+ USHORT segCountX2;
+ USHORT searchRange;
+ USHORT entrySelector;
+ USHORT rangeShift;
+ USHORT *endCount;
+ USHORT reservedPad;
+ USHORT *startCount;
+ USHORT *idDelta;
+ USHORT *idRangeOffset;
+ USHORT *glyphIndexArray;
+}
+
+CMAP4;
+typedef struct
+{
+ USHORT firstCode;
+ USHORT entryCount;
+ USHORT *glyphIndexArray;
+}
+CMAP6;
+
+/* SubTable: one for each encoding scheme */
+typedef struct
+{
+ /* encoding table */
+ USHORT PlatformID;
+ USHORT EncodingID;
+ ULONG offset;
+
+ USHORT format;
+ USHORT length;
+ USHORT version;
+ union
+ {
+ CMAP0 *cmap0;
+ CMAP2 *cmap2;
+ CMAP4 *cmap4;
+ CMAP6 *cmap6;
+ }
+ map;
+}
+SubTable, *SubTablePtr;
+
+typedef struct _cmap
+{
+ USHORT version;
+ USHORT numberOfEncodings;
+ SubTablePtr subTables; /* size = numberOfEncodings */
+}
+CMAP, *CMAPPtr;
+
+/* glyf: Glyph Data table
+ * It is necessary to load "loca" table first to know where to load a specific
+ * glyph; the "loca" table itself depends on "head" and "maxp" tables
+ */
+typedef F2Dot14 SCALE;
+
+typedef struct
+{
+ F2Dot14 xscale;
+ F2Dot14 yscale;
+}
+VECTOR;
+
+typedef struct
+{
+ F2Dot14 xscale;
+ F2Dot14 scale01;
+ F2Dot14 scale10;
+ F2Dot14 yscale;
+}
+TENSOR;
+
+typedef struct
+{
+ SHORT args[2]; /* need reconsideration */
+ union
+ {
+ SCALE scale;
+ VECTOR vector;
+ TENSOR tensor;
+ }
+ transform;
+}
+CompositeData;
+
+typedef struct _component
+{
+ USHORT flags;
+ USHORT glyphIndex;
+ CompositeData data;
+ struct _component *next, *previous; /* linked list used, no way to know
+ * how many components in advance */
+}
+Component;
+
+typedef struct
+{
+ SHORT numberOfContours;
+ FWord xMin;
+ FWord yMin;
+ FWord xMax;
+ FWord yMax;
+ /* simple glyph data */
+ USHORT *endPtsOfContours; /* size = numberOfContours */
+ USHORT instructionLength;
+ BYTE *instructions; /* size = instructionLength */
+ BYTE *flags; /* size = the total # of x,y
+ * coordinates, i.e. last number
+ * of endPtsOfContour */
+ SHORT *xCoordinates;
+ SHORT *yCoordinates;
+ Component *comp; /* a pointer to a linked list of
+ * composite components */
+}
+GLYF, *GLYFPtr;
+
+/* Flags for Coordinates */
+#define FLAGS_ON_CURVE 1
+#define FLAGS_X_SHORT_VECTOR 2
+#define FLAGS_Y_SHORT_VECTOR 4
+#define FLAGS_REPEAT 8
+#define FLAGS_X_SAME 0x10
+#define FLAGS_Y_SAME 0x20
+
+/* Flags for Composite Glyph */
+#define ARG_1_AND_2_ARE_WORDS 0x001
+#define ARGS_ARE_XY_VALUES 0x002
+#define ROUND_XY_TO_GRID 0x004
+#define WE_HAVE_A_SCALE 0x008
+#define RESERVE 0x010
+#define NO_OVERLAP 0x010
+#define MORE_COMPONENT 0x020
+#define WE_HAVE_AN_X_AND_Y_SCALE 0x040
+#define WE_HAVE_A_TWO_BY_TWO 0x080
+#define WE_HAVE_INSTRUCTIONS 0x100
+#define USE_MY_METRICS 0x200
+#define OVERLAP_COMPOUND 0x400 /* from Apple's TTF specs */
+
+typedef struct
+{
+ Fixed version;
+ Fixed fontRevision;
+ ULONG checkSumAdj;
+ ULONG magicNumber;
+ USHORT flags;
+ USHORT unitsPerEm;
+ BYTE created[8];
+ BYTE modified[8];
+ FWord xMin;
+ FWord yMin;
+ FWord xMax;
+ FWord yMax;
+ USHORT macStyle;
+ USHORT lowestRecPPEM;
+ SHORT fontDirectionHint;
+ SHORT indexToLocFormat; /* 0 => ushort, 1 => ulong */
+ SHORT glyphDataFormat;
+}
+HEAD, *HEADPtr;
+
+#define FLAGS_Y_0 1
+#define FLAGS_X_0 2
+#define FLAGS_SIZE_DEP 4
+#define FLAGS_INT_PPEM 8
+#define FLAGS_ALT_WIDTH 0x10
+#define MAC_STYLE_BOLD 1
+#define MAC_STYLE_ITALIC 2
+#define FONT_DIR_MIX 0
+#define FONT_DIR_L2R 1
+#define FONT_DIR_L2R_NEUTRALS 2
+#define FONT_DIR_R2L -1
+#define FONT_DIR_R2L_NEUTRALS -2
+#define LOCA_OFFSET_SHORT 0
+#define LOCA_OFFSET_LONG 1
+
+typedef struct
+{
+ Fixed version;
+ FWord Ascender;
+ FWord Descender;
+ FWord LineGap;
+ uFWord advanceWidthMax;
+ FWord minLeftSideBearing;
+ FWord minRightSideBearing;
+ FWord xMaxExtent;
+ SHORT caretSlopeRise;
+ SHORT caretSlopeRun;
+ SHORT reserved[5];
+ SHORT metricDataFormat;
+ USHORT numberOfHMetrics;
+}
+HHEA, *HHEAPtr;
+
+/* for a new created HMTX, one have to fill numberofHMetrics manually for
+ * hhea */
+typedef struct _longHorMetric
+{
+ uFWord advanceWidth;
+ FWord lsb;
+}
+longHorMetric;
+
+typedef struct
+{ /* depends on hhea */
+ USHORT numberOfHMetrics; /* defined in hhea */
+ USHORT numberOfLSB; /* numGlyph - numberOfHMetrics */
+ longHorMetric *hMetrics;
+ FWord *leftSideBearing;
+}
+HMTX, *HMTXPtr;
+
+/* for a newly created LOCA, one have to fill indexToLocFormat from head and
+ * numGlyphs from maxp manually */
+typedef struct
+{ /* depends on head and maxp */
+ SHORT indexToLocFormat; /* defined in head */
+ USHORT numGlyphs; /* defined in maxp */
+ ULONG *offset;
+}
+LOCA, *LOCAPtr;
+
+typedef struct
+{
+ Fixed version;
+ USHORT numGlyphs;
+ USHORT maxPoints;
+ USHORT maxContours;
+ USHORT maxCompositePoints;
+ USHORT maxCompositeContours;
+ USHORT maxZones;
+ USHORT maxTwilightPoints;
+ USHORT maxStorage;
+ USHORT maxFunctionDefs;
+ USHORT maxInstructionDefs;
+ USHORT maxStackElements;
+ USHORT maxSizeOfInstructions;
+ USHORT maxComponentElements;
+ USHORT maxComponentDepth;
+}
+MAXP, *MAXPPtr;
+
+typedef struct
+{
+ USHORT PlatformID;
+ USHORT EncodingID;
+ USHORT LanguageID;
+ USHORT NameID;
+ USHORT length;
+ USHORT offset;
+ char *data;
+}
+NameRecord, *NameRecordPtr;
+
+typedef struct
+{
+ USHORT format;
+ USHORT numberOfRecords;
+ USHORT offset;
+ NameRecordPtr NameRecords;
+}
+NAME, *NAMEPtr;
+
+typedef struct
+{
+ USHORT numGlyphs; /* Should be the same as numGlyphs defined in maxp */
+ USHORT *glyphNameIndex;
+ CHAR **GlyphName;
+}
+Format20;
+
+typedef struct
+{
+ char *offset;
+}
+Format25;
+
+typedef struct
+{
+ Fixed format;
+ Fixed italicAngle;
+ FWord underlinePosition;
+ FWord underlineThickness;
+ ULONG isFixedPitch;
+ ULONG minMemType42;
+ ULONG maxMemType42;
+ ULONG minMemType1;
+ ULONG maxMemType1;
+ /* the elements below exist only for 2.0 and 2.5 format */
+ union
+ {
+ Format20 *format20;
+ Format25 *format25;
+ }
+ name;
+}
+POST, *POSTPtr;
+
+typedef struct
+{
+ USHORT version;
+ SHORT xAvgCharWidth;
+ USHORT usWeightClass;
+ USHORT usWidthClass;
+ USHORT fsType;
+ SHORT ySubscriptXSize;
+ SHORT ySubscriptYSize;
+ SHORT ySubscriptXOffset;
+ SHORT ySubscriptYOffset;
+ SHORT ySuperscriptXSize;
+ SHORT ySuperscriptYSize;
+ SHORT ySuperscriptXOffset;
+ SHORT ySuperscriptYOffset;
+ SHORT yStrikeoutSize;
+ SHORT yStrikeoutPosition;
+ SHORT sFamilyClass;
+ CHAR panose[10];
+ ULONG ulUnicodeRange1;
+ ULONG ulUnicodeRange2;
+ ULONG ulUnicodeRange3;
+ ULONG ulUnicodeRange4;
+ CHAR achVendID[5];
+ USHORT fsSelection;
+ USHORT usFirstCharIndex;
+ USHORT usLastCharIndex;
+ SHORT sTypoAscender;
+ SHORT sTypoDescender;
+ SHORT sTypoLineGap;
+ USHORT usWinAscent;
+ USHORT usWinDescent;
+ ULONG ulCodePageRange1;
+ ULONG ulCodePageRange2;
+}
+OS_2, *OS_2Ptr;
+
+typedef struct
+{
+ USHORT rangeMaxPPEM;
+ USHORT rangeGaspBehavior;
+}
+GASPRANGE;
+
+typedef struct
+{
+ USHORT version;
+ USHORT numRanges;
+ GASPRANGE *gaspRange; /* length = numRanges */
+}
+GASP, *GASPPtr;
+
+/* flags for gasp */
+#define GASP_GRIDFIT 0x0001
+#define GASP_DOGRAY 0x0002
+
+typedef struct
+{
+ BYTE PixelSize;
+ BYTE MaxWidth;
+ BYTE *Width; /* length = numGlyphs */
+}
+DeviceRecord;
+
+typedef struct
+{
+ USHORT numGlyphs; /* defined in maxp, artifitial */
+ USHORT version;
+ SHORT numDevices;
+ LONG size;
+ DeviceRecord *Records;
+}
+HDMX, *HDMXPtr;
+
+typedef struct
+{
+ USHORT version;
+ USHORT length;
+ USHORT coverage;
+ union
+ {
+ struct
+ {
+ USHORT nPairs;
+ USHORT searchRange;
+ USHORT entrySelector;
+ USHORT rangeShift;
+ struct kernpair
+ {
+ USHORT left;
+ USHORT right;
+ FWord value;
+ }
+ *pairs;
+ }
+ kern0;
+
+ struct
+ {
+ USHORT rowWidth;
+ USHORT leftClassTable;
+ USHORT rightClassTable;
+ USHORT array;
+ }
+ kern2;
+ }
+ kern;
+}
+KernSubtable;
+
+typedef struct
+{
+ USHORT version;
+ USHORT nTables;
+ KernSubtable *subtable;
+}
+KERN, *KERNPtr;
+
+typedef struct
+{
+ USHORT version;
+ USHORT numGlyphs;
+ BYTE *yPels; /* length = numGlyphs */
+}
+LTSH, *LTSHPtr;
+
+typedef struct
+{
+ Fixed version;
+ ULONG FontNumber;
+ USHORT Pitch;
+ USHORT xHeight;
+ USHORT Style;
+ USHORT TypeFamily;
+ USHORT CapHeight;
+ USHORT SymbolSet;
+ CHAR Typeface[16];
+ CHAR CharacterComplement[8];
+ CHAR FileName[6];
+ CHAR StrokeWeight;
+ CHAR WidthType;
+ BYTE SerifStyle;
+ BYTE reserved;
+}
+PCLT, *PCLTPtr;
+
+typedef struct
+{
+ BYTE CharSet;
+ BYTE xRatio;
+ BYTE yStartRatio;
+ BYTE yEndRatio;
+}
+Ratios;
+
+typedef struct
+{
+ USHORT yPelHeight;
+ SHORT yMax;
+ SHORT yMin;
+}
+vTable;
+
+typedef struct
+{
+ USHORT recs;
+ BYTE startsz;
+ BYTE endsz;
+ vTable *entry;
+}
+Vdmx;
+
+typedef struct
+{
+ USHORT version;
+ USHORT numRecs;
+ USHORT numRatios;
+ Ratios *ratRange; /* length = numRatios */
+ USHORT *offset; /* length = numRatios */
+ Vdmx *groups;
+}
+VDMX, *VDMXPtr;
+
+typedef struct
+{
+ Fixed version;
+ SHORT ascent;
+ SHORT descent;
+ SHORT lineGap;
+ SHORT advanceHeightMax;
+ SHORT minTopSideBearing;
+ SHORT minBottomSideBearing;
+ SHORT yMaxExtent;
+ SHORT caretSlopeRise;
+ SHORT caretSlopeRun;
+ SHORT caretOffset;
+ SHORT reserved[4];
+ SHORT metricDataFormat;
+ USHORT numOfLongVerMetrics;
+}
+VHEA, *VHEAPtr;
+
+typedef struct
+{
+ uFWord advanceHeight;
+ FWord topSideBearing;
+}
+longVerMetric;
+
+typedef struct
+{
+ /* depends on vhea */
+ USHORT numOfLongVerMetrics; /* defined in vhea */
+ USHORT numOfTSB; /* numGlyph - numberOfHMetrics */
+ longVerMetric *vMetrics;
+ FWord *topSideBearing;
+}
+VMTX, *VMTXPtr;
+
+#endif /* __TTF_TABLE_H */
+
+
+/* end of tables.h */
diff --git a/Build/source/texk/ttfdump/include/ttc.h b/Build/source/texk/ttfdump/include/ttc.h
new file mode 100644
index 00000000000..7350114cec5
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/ttc.h
@@ -0,0 +1,25 @@
+#ifndef __TTF_TTC_H
+#define __TTF_TTC_H
+
+/* $Id: ttc.h,v 1.3 1998/07/06 06:07:01 werner Exp $ */
+
+#include "ttf.h"
+
+typedef struct
+{
+ ULONG TTCTag;
+ Fixed version;
+ ULONG DirCount;
+ ULONG *offset; /* length = DirCount */
+ TTFontPtr font;
+}
+TTCHeader, *TTCHeaderPtr;
+
+TTCHeaderPtr ttfLoadTTCHeader(char *filename);
+void ttfLoadTTCFont(TTCHeaderPtr ttc, FILE *fp);
+void ttfFreeTTCFont(TTCHeaderPtr ttc);
+
+#endif /* __TTF_TTC_H */
+
+
+/* end of ttc.h */
diff --git a/Build/source/texk/ttfdump/include/ttf.h b/Build/source/texk/ttfdump/include/ttf.h
new file mode 100644
index 00000000000..34c53a3f298
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/ttf.h
@@ -0,0 +1,187 @@
+/* ttf.h -- header file that defines the top level abstraction of a True Type font, as
+ * well as the usual typedefs in TTF spec.
+ * Copyright (C) 1996-1998 Li-Da Lho, All right reserved.
+ */
+
+#ifndef __TTF_H
+#define __TTF_H
+
+#include <stdio.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include "config.h"
+
+/* $Id: ttf.h,v 1.3 1998/07/06 06:07:01 werner Exp $ */
+
+typedef unsigned char BYTE;
+typedef signed char CHAR;
+typedef unsigned short USHORT;
+typedef signed short SHORT;
+
+
+#if SIZEOF_INT==4
+typedef unsigned int ULONG;
+typedef signed int LONG;
+typedef ULONG Fixed; /* 16.16 fixed point number used for
+ * version information */
+
+#elif SIZEOF_LONG==4
+typedef unsigned long ULONG;
+typedef signed long LONG;
+typedef ULONG Fixed; /* 16.16 fixed point number used for
+ * version information */
+#endif
+
+typedef USHORT FUnit;
+typedef SHORT FWord; /* pixel position in the unit of FUnit */
+typedef USHORT uFWord;
+typedef SHORT F2Dot14; /* 2.14 fixed point number used for
+ * unit vectors */
+typedef LONG F26Dot6; /* 26.6 fixed point number to specify
+ * pixel positions */
+
+#ifndef inline
+extern inline BYTE
+ttfGetBYTE(FILE *fp)
+{
+ int cc;
+
+
+ if ((cc = fgetc (fp)) == EOF)
+ {
+#if 0
+ if (feof(fp) != 0)
+ ttfError("Unexpected EOF \n");
+ else
+ ttfError("Error Getting BYTE\n");
+#endif
+ }
+ return (BYTE) cc;
+}
+#endif
+
+CHAR ttfGetCHAR(FILE *fp);
+USHORT ttfGetUSHORT(FILE *fp);
+USHORT ttfGetSHORT(FILE *fp);
+ULONG ttfGetULONG(FILE *fp);
+LONG ttfGetLONG(FILE *fp);
+Fixed ttfGetFixed(FILE *fp);
+FUnit ttfGetFUnit(FILE *fp);
+FWord ttfGetFWord(FILE *fp);
+uFWord ttfGetuFWord(FILE *fp);
+F2Dot14 ttfGetF2Dot14(FILE *fp);
+
+short ttfGetLSB16(FILE *fp);
+int ttfGetLSB32(FILE *fp);
+
+#include "tables.h"
+#include "gcache.h"
+#include "gstate.h"
+
+typedef struct
+{
+ BYTE opcode;
+ BYTE *iStream;
+}
+InstructionDef;
+
+typedef struct
+{
+ BYTE fun;
+ BYTE *iStream;
+}
+FunctionDef;
+
+typedef struct
+{
+ /* data for instructions */
+ BYTE *iStream; /* instruction stream */
+ USHORT ip; /* instruction pointer */
+ USHORT insLength; /* instruction length */
+ LONG *StorageArea; /* storage area */
+ LONG *Stack; /* stack */
+ USHORT sp; /* stack pointer */
+ USHORT stklimit; /* stack limit */
+ /* data about point size and resolution */
+ ULONG ppem; /* pixel per em */
+ ULONG xres; /* x resolution in dpi */
+ ULONG yres; /* y resolution in dpi */
+ F26Dot6 pointsize; /* the point size of the font */
+ /* data for grahpics stat and cvt */
+ F26Dot6 *cvt; /* Control value table, scaled form cvt in
+ * TTFont */
+ GraphicsState gstate; /* graphics state used for instructions */
+ GraphicsState gstate_init; /* initial graphics state after fpgm and cvt
+ * programs are executed */
+#if 0
+ /* user definded instructions and functions */
+ InstructionDef iDef; /* instruction definitions */
+ FunctionDef fDef; /* function definitions */
+#endif
+
+ int Error_State; /* error state indicate the error */
+}
+VirtualMachine;
+
+typedef struct
+{
+ /* misc informations */
+ FILE *fp;
+ char *ttfname;
+ int *refcount; /* how many instances of this font */
+ Fixed version;
+ USHORT numTables; /* it seems not necessary to hold all the
+ * OffsetTables */
+ ULONG glyphOffset; /* where the glyph table starts */
+ TableDirPtr dir; /* Pointer to Table Directories */
+ SubTablePtr encoding; /* `encoding' is the currently used encoding
+ * table */
+ USHORT numCacheElements; /* number of glyph cache elements */
+
+ VirtualMachine vm; /* the virtual machine */
+
+ GlyphCachePtr gcache; /* pointer to glyph cache */
+
+ /* required tables */
+ CMAPPtr cmap;
+ HEADPtr head;
+ HHEAPtr hhea;
+ HMTXPtr hmtx;
+ LOCAPtr loca;
+ MAXPPtr maxp;
+ NAMEPtr name;
+ POSTPtr post;
+ OS_2Ptr os2;
+
+ /* optional tables */
+ FWord *cvt; /* control value table, not scaled yet */
+ USHORT cvtLength; /* number of FWords of CVT */
+ BYTE *fpgm; /* font program */
+ USHORT fpgmLength; /* number of bytes of fpgm */
+ BYTE *prep; /* cvt program */
+ USHORT prepLength; /* number of bytes of prep */
+
+ /* those optional tables seem not to be necessary for a True Type font
+ * server */
+ GASPPtr gasp;
+ HDMXPtr hdmx;
+ KERNPtr kern;
+ LTSHPtr ltsh;
+ PCLTPtr pclt;
+ VDMXPtr vdmx;
+ VHEAPtr vhea;
+ VMTXPtr vmtx;
+}
+TTFont, *TTFontPtr;
+
+TTFontPtr ttfInitFont(char *filename);
+void ttfLoadFont(TTFontPtr font, ULONG offset);
+void ttfFreeFont(TTFontPtr font);
+
+#include "loadtable.h"
+
+#endif /* __TTF_H */
+
+
+/* end of ttf.h */
diff --git a/Build/source/texk/ttfdump/include/ttfutil.h b/Build/source/texk/ttfdump/include/ttfutil.h
new file mode 100644
index 00000000000..c29d4c5b535
--- /dev/null
+++ b/Build/source/texk/ttfdump/include/ttfutil.h
@@ -0,0 +1,19 @@
+#ifndef __TTF_UTIL_H
+#define __TTF_UTIL_H
+
+#include "ttf.h"
+
+/* $Id: ttfutil.h,v 1.2 1998/07/06 06:07:01 werner Exp $ */
+
+void FixedSplit(Fixed f, int b[]);
+void TwoByteSwap(unsigned char *buf, int nbytes);
+void FourByteSwap(unsigned char *buf, int nbytes);
+void FourByteSwap(unsigned char *buf, int nbytes);
+void ttfError(char *msg);
+
+#include "protos.h"
+
+#endif /* __TTF_UTIL_H */
+
+
+/* end of ttfutil.h */