From 1e631c87d1f5c1e5c448c8604e1d2f7b2ff9b5be Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 21 Jun 2005 23:25:40 +0000 Subject: [PATCH] * lily/GNUmakefile (MODULE_INCLUDES): remove ttftool * GNUmakefile.in (SUBDIRS): remove ttftool subdirectory. * lily/ttf.cc (print_header): new file. Convert to type42, using FreeType to parse the TTF. --- VERSION | 2 +- lily/ttf.cc | 12 +- ttftool/include/GNUmakefile | 9 -- ttftool/include/proto.h | 71 ---------- ttftool/include/ttftool.h | 12 -- ttftool/include/types.h | 265 ------------------------------------ 6 files changed, 7 insertions(+), 364 deletions(-) delete mode 100644 ttftool/include/GNUmakefile delete mode 100644 ttftool/include/proto.h delete mode 100644 ttftool/include/ttftool.h delete mode 100644 ttftool/include/types.h diff --git a/VERSION b/VERSION index 8c82ca5453..297d0f6dba 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=5 -PATCH_LEVEL=31 +PATCH_LEVEL=32 MY_PATCH_LEVEL= diff --git a/lily/ttf.cc b/lily/ttf.cc index b30a275ac2..a40155e48d 100644 --- a/lily/ttf.cc +++ b/lily/ttf.cc @@ -9,7 +9,6 @@ #include "freetype.hh" - #include #include "lily-proto.hh" @@ -18,7 +17,7 @@ #include "lily-guile.hh" #include "main.hh" -void +static void print_header (void *out, FT_Face face) { lily_cookie_fprintf (out, "%%!PS-TrueTypeFont\n"); @@ -86,7 +85,7 @@ print_header (void *out, FT_Face face) #define CHUNKSIZE 65534 -void +static void print_body (void *out, String name) { FILE *fd = fopen (name.to_str0 (), "rb"); @@ -121,7 +120,7 @@ print_body (void *out, String name) fclose (fd); } -void +static void print_trailer (void *out, FT_Face face) { @@ -148,7 +147,8 @@ print_trailer (void *out, 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); @@ -172,7 +172,7 @@ LY_DEFINE (ly_ttf_to_pfa, "ly:ttf->pfa", 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 ()); diff --git a/ttftool/include/GNUmakefile b/ttftool/include/GNUmakefile deleted file mode 100644 index 6bcedbb14b..0000000000 --- a/ttftool/include/GNUmakefile +++ /dev/null @@ -1,9 +0,0 @@ -# ttftool/lib/include/Makefile - -depth = ../.. - -STEPMAKE_TEMPLATES=c - -include $(depth)/make/stepmake.make - - diff --git a/ttftool/include/proto.h b/ttftool/include/proto.h deleted file mode 100644 index 604c91995b..0000000000 --- a/ttftool/include/proto.h +++ /dev/null @@ -1,71 +0,0 @@ -/* 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 diff --git a/ttftool/include/ttftool.h b/ttftool/include/ttftool.h deleted file mode 100644 index 43f35ca7b8..0000000000 --- a/ttftool/include/ttftool.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef __cplusplus -extern "C" -{ -#endif - - - void create_type42 (char const *, void *); - extern int ttf_verbosity; - -#ifdef __cplusplus -} -#endif diff --git a/ttftool/include/types.h b/ttftool/include/types.h deleted file mode 100644 index 469e6951d1..0000000000 --- a/ttftool/include/types.h +++ /dev/null @@ -1,265 +0,0 @@ -/* 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; -}; -- 2.39.2