* GNUmakefile.in (SUBDIRS): remove ttftool subdirectory.
* lily/ttf.cc (print_header): new file. Convert to type42, using
FreeType to parse the TTF.
PACKAGE_NAME=LilyPond
MAJOR_VERSION=2
MINOR_VERSION=5
-PATCH_LEVEL=31
+PATCH_LEVEL=32
MY_PATCH_LEVEL=
#include "freetype.hh"
-
#include <freetype/tttables.h>
#include "lily-proto.hh"
#include "lily-guile.hh"
#include "main.hh"
-void
+static void
print_header (void *out, FT_Face face)
{
lily_cookie_fprintf (out, "%%!PS-TrueTypeFont\n");
#define CHUNKSIZE 65534
-void
+static void
print_body (void *out, String name)
{
FILE *fd = fopen (name.to_str0 (), "rb");
fclose (fd);
}
-void
+static void
print_trailer (void *out,
FT_Face face)
{
lily_cookie_fprintf (out, "FontName currentdict end definefont pop\n");
}
-void print_ps_font (void *out, String name)
+static void
+create_type42_font (void *out, String name)
{
FT_Face face = open_ft_face (name);
Memory_out_stream stream;
- print_ps_font (&stream, file_name);
+ create_type42_font (&stream, file_name);
SCM asscm = scm_from_locale_stringn (stream.get_string (),
stream.get_length ());
+++ /dev/null
-# ttftool/lib/include/Makefile
-
-depth = ../..
-
-STEPMAKE_TEMPLATES=c
-
-include $(depth)/make/stepmake.make
-
-
+++ /dev/null
-/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-
-struct TableDirectoryEntry *readDirectory (FILE *fd, struct OffsetTable *ot);
-char **readNamingTable (FILE *fd);
-void readHeadTable (FILE *fd, struct HeadTable *ht);
-int readPostTable (FILE *fd, int root_nglyphs,
- struct PostTable *pt, USHORT *nglyphs,
- struct GlyphName **gnt);
-int readMaxpTable (FILE *fd);
-void *readLocaTable (FILE *fd, int nglyphs, int format);
-struct Box *readGlyfTable (FILE *fd, int nglyphs, int format, void *loca);
-longHorMetric *readHmtxTable (FILE *fd, int nummetrics);
-struct HheaTable *readHheaTable (FILE *fd);
-int readKernTable (FILE *fd, int **nke, struct KernEntry0 ***ke);
-
-void printPSFont (void * out, struct HeadTable *ht,
- char **strings, int nglyphs, int postType,
- struct PostTable *pt,
- USHORT png,
- struct GlyphName *gnt, FILE *fd);
-
-void printPSHeader (void * out, struct HeadTable *ht,
- char **strings, struct PostTable *pt);
-void printPSData (void * out, FILE *fd);
-void printPSTrailer (void * out, int nglyphs,
- int postType, USHORT pnt, struct GlyphName *gnt);
-
-void printAFM (FILE * afm, struct HeadTable *ht,
- char **strings, int nglyphs, int postType,
- struct PostTable *pt, struct GlyphName *gnt,
- struct Box *glyf, struct HheaTable *hhea, longHorMetric * hmtx,
- int nkern, int *nke, struct KernEntry0 **ke);
-void printAFMHeader (FILE * afm, struct HeadTable *ht,
- char **strings, struct PostTable *pt);
-void printAFMMetrics (FILE * afm, struct HeadTable *ht,
- int nglyphs, int postType, struct GlyphName *gnt,
- struct Box *bbox,
- struct HheaTable *hhea, longHorMetric * hmtx);
-void printOneAFMMetric (FILE * afm,
- int index, int code, char *name,
- struct HeadTable *ht,
- struct Box *bbox,
- struct HheaTable *hhea, longHorMetric * hmtx);
-void printAFMKerning (FILE * afm, struct HeadTable *ht,
- int postType, struct GlyphName *gnt,
- int nkern, int *nke, struct KernEntry0 **ke);
-
-extern char *macGlyphEncoding[];
-extern char *adobeStandardEncoding[];
-
-void *mymalloc (size_t size);
-void *mycalloc (size_t nelem, size_t elsize);
-void *myrealloc (void *ptr, size_t size);
-void ttf_error (char *string);
-void syserror (char *string);
-ssize_t surely_read (FILE *fildes, void *buf, size_t nbyte);
-char *unistrncpy (char *dst, char *str, size_t length);
-void fputpss (char *s, void * stream);
-void surely_lseek (FILE *fildes, off_t offset, int whence);
-unsigned hash (char *string);
-struct hashtable *make_hashtable (int size);
-int puthash (struct hashtable *t, char *key, int value);
-int gethash (struct hashtable *t, char *key);
-
-#ifdef TEST_TTFTOOL
-#define lily_cookie_fclose fclose
-#define lily_cookie_fprintf fprintf
-#define lily_cookie_putc fputc
-#else
-#include "file-cookie.hh"
-#endif
+++ /dev/null
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
- void create_type42 (char const *, void *);
- extern int ttf_verbosity;
-
-#ifdef __cplusplus
-}
-#endif
+++ /dev/null
-/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-
-
-typedef unsigned char BYTE;
-typedef signed char CHAR;
-typedef unsigned short USHORT;
-typedef short SHORT;
-typedef unsigned long ULONG;
-typedef long LONG;
-
-/* Endianness conversions */
-#ifdef SMALLENDIAN
-#define H(x) ((SHORT)((((SHORT)(x))&0xFF)<<8)+(((USHORT)(x))>>8))
-#define UH(x) ((USHORT)((((USHORT)(x))&0xFF)<<8)+(((USHORT)(x))>>8))
-#define L(x) ((LONG)(((LONG)UH((x)&0xFFFF))<<16)+UH(((ULONG)(x))>>16))
-#define UL(x) ((ULONG)(((ULONG)UH((x)&0xFFFF))<<16)+UH(((ULONG)(x))>>16))
-#else
-#define H(x) ((SHORT)x)
-#define UH(x) ((USHORT)x)
-#define L(x) ((LONG)x)
-#define UL(x) ((ULONG)x)
-#endif
-
-#define FIX_H(x) x=H(x)
-#define FIX_UH(x) x=UH(x)
-#define FIX_L(x) x=L(x)
-#define FIX_UL(x) x=UL(x)
-
-/* We are assuming that the compiler will not pad the following
- * structures; note that their members are intrinsically properly
- * aligned. This will probably break on some machines. */
-
-typedef struct
-{
- SHORT mantissa;
- USHORT fraction;
-} Fixed;
-
-#define FIX_Fixed(x) {(x).mantissa=H((x).mantissa); (x).fraction=UH((x).fraction);}
-
-typedef struct
-{
- BYTE data[8];
-} longDateTime;
-
-typedef USHORT uFWord;
-typedef SHORT FWord;
-typedef USHORT F2Dot14;
-
-#define MAKE_ULONG(a,b,c,d) ((ULONG)(((ULONG)(a)<<24)|((b)<<16)|((c)<<8)|(d)))
-
-/*------------------------------------------------------------*/
-
-struct OffsetTable
-{
- Fixed version;
- USHORT numTables;
- USHORT searchRange;
- USHORT entrySelector;
- USHORT rangeShift;
-};
-#define FIX_OffsetTable(x) \
- {FIX_Fixed((x).version);\
- FIX_UH((x).numTables);\
- FIX_UH((x).searchRange);\
- FIX_UH((x).entrySelector);}
-
-struct TableDirectoryEntry
-{
- ULONG tag;
- ULONG checkSum;
- ULONG offset;
- ULONG length;
-};
-#define FIX_TableDirectoryEntry(x) \
- {FIX_UL((x).tag); FIX_UL((x).checkSum);\
- FIX_UL((x).offset); FIX_UL((x).length);}
-
-/*------------------------------------------------------------*/
-
-struct HeadTable
-{
- Fixed version;
- Fixed fontRevision;
- ULONG checkSumAdjustment;
- ULONG magicNumber;
- USHORT flags;
- USHORT unitsPerEm;
- longDateTime created;
- longDateTime modified;
- FWord xMin;
- FWord yMin;
- FWord xMax;
- FWord yMax;
- USHORT macStyle;
- USHORT lowestRecPPEM;
- SHORT fontDirectionHint;
- SHORT indexToLocFormat;
- SHORT glyphDataFormat;
-};
-#define FIX_HeadTable(x) \
- {FIX_Fixed((x).version); FIX_Fixed((x).fontRevision);\
- FIX_UL((x).checkSumAdjustment); FIX_UL((x).magicNumber);\
- FIX_UH((x).flags); FIX_UH((x).unitsPerEm);\
- FIX_UH((x).xMin); FIX_UH((x).yMin); FIX_UH((x).xMax); FIX_UH((x).yMax);\
- FIX_UH((x).macStyle); FIX_UH((x).lowestRecPPEM);\
- FIX_H((x).fontDirectionHint); FIX_H((x).indexToLocFormat);\
- FIX_H((x).glyphDataFormat);}
-
-
-/*------------------------------------------------------------*/
-
-struct NameRecord
-{
- USHORT platformID;
- USHORT encodingID;
- USHORT languageID;
- USHORT nameID;
- USHORT length;
- USHORT offset;
-};
-#define FIX_NameRecord(x) \
- {FIX_UH((x).platformID); FIX_UH((x).encodingID); FIX_UH((x).languageID);\
- FIX_UH((x).nameID); FIX_UH((x).length); FIX_UH((x).offset);}
-
-
-
-/*------------------------------------------------------------*/
-
-struct PostTable
-{
- Fixed formatType;
- Fixed italicAngle;
- FWord underlinePosition;
- FWord underlineThickness;
- ULONG isFixedPitch;
- ULONG minMemType42;
- ULONG maxMemType42;
- ULONG minMemType1;
- ULONG maxMemType1;
-};
-#define FIX_PostTable(x) \
- {FIX_Fixed((x).formatType); FIX_Fixed((x).italicAngle);\
- FIX_H((x).underlinePosition); FIX_H((x).underlineThickness);\
- FIX_UL((x).isFixedPitch);\
- FIX_UL((x).minMemType42); FIX_UL((x).maxMemType42);\
- FIX_UL((x).minMemType1); FIX_UL((x).maxMemType1); }
-
-struct GlyphName
-{
- int type;
- union
- {
- int index;
- char *name;
- } name;
-};
-
-/*-----------------------------------------------------------------*/
-struct HheaTable
-{
- 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;
-};
-#define FIX_HheaTable(x) \
- {FIX_Fixed((x).version); FIX_H((x).Ascender); FIX_H((x).Descender); FIX_H((x).LineGap);\
- FIX_UH((x).advanceWidthMax);\
- FIX_H((x).minLeftSideBearing); FIX_H((x).minRightSideBearing);\
- FIX_H((x).xMaxExtent); FIX_H((x).caretSlopeRise); FIX_H((x).caretSlopeRun);\
- FIX_H((x).metricDataFormat); FIX_UH((x).numberOfHMetrics);}
-
-struct Box
-{
- FWord xMin;
- FWord yMin;
- FWord xMax;
- FWord yMax;
-};
-#define FIX_Box(x) {FIX_H((x).xMin); FIX_H((x).yMin); FIX_H((x).xMax); FIX_H((x).yMax);}
-
-typedef struct
-{
- uFWord advanceWidth;
- FWord lsb;
-} longHorMetric;
-#define FIX_longHorMetric(x) {FIX_UH((x).advanceWidth); FIX_H((x).lsb);}
-
-/*------------------------------------------------------------*/
-struct KernTable
-{
- USHORT version;
- USHORT nTables;
-};
-#define FIX_KernTable(x) {FIX_UH((x).version); FIX_UH((x).nTables);}
-
-struct KernSubTableHeader
-{
- USHORT version;
- USHORT length;
- USHORT coverage;
-};
-#define FIX_KernSubTableHeader(x) \
- {FIX_UH((x).version); FIX_UH((x).length); FIX_UH((x).coverage);}
-
-
-#define kernHorizontal 0x0001
-#define kernMinimum 0x0002
-#define kernCrossStream 0x0004
-#define kernOverride 0x0008
-#define kernFormat(coverage) ((coverage)>>8)
-
-struct KernSubTable0
-{
- USHORT nPairs;
- USHORT searchRange;
- USHORT entrySelector;
- USHORT rangeShift;
-};
-
-#define FIX_KernSubTable0(x) \
- {FIX_UH((x).nPairs); FIX_UH((x).searchRange);\
- FIX_UH((x).entrySelector); FIX_UH((x).rangeShift);}
-
-struct KernEntry0
-{
- USHORT left;
- USHORT right;
- FWord value;
-};
-#define FIX_KernEntry0(x) \
- {FIX_UH((x).left); FIX_UH((x).right); FIX_H((x).value);}
-
-
-/*------------------------------------------------------------*/
-/* Hashtables */
-
-struct hashtable_entry
-{
- char *key;
- int value;
-};
-
-struct hashtable_bucket
-{
- int size;
- int nentries;
- struct hashtable_entry *entries;
-};
-
-struct hashtable
-{
- int size;
- struct hashtable_bucket **buckets;
-};