]> git.donarmstrong.com Git - lilypond.git/commitdiff
* GNUmakefile.in (SUBDIRS): remove ttftool subdirectory.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 21 Jun 2005 23:17:38 +0000 (23:17 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 21 Jun 2005 23:17:38 +0000 (23:17 +0000)
* ttftool/parse.c (readPostTable): ugh. Kludge: nglyphs in maxp
and post table may differ. Pass around post_nglyphs as well.

ChangeLog
THANKS
ttftool/GNUmakefile [deleted file]
ttftool/README [deleted file]
ttftool/SConscript [deleted file]
ttftool/encodings.c [deleted file]
ttftool/parse.c [deleted file]
ttftool/ps.c [deleted file]
ttftool/test.c [deleted file]
ttftool/ttfps.c [deleted file]
ttftool/util.c [deleted file]

index eb35b1088ea7ec7370f31da9bab976a311c0e6a1..ccb5387d98ffbfb98b1c86b1ad31598b5f4318fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-06-22  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * ttftool/*: remove ttftool subdirectory.
+
        * GNUmakefile.in (SUBDIRS): remove ttftool subdirectory.
 
        * lily/ttf.cc (print_header): new file. Convert to type42, using
diff --git a/THANKS b/THANKS
index 3ee2065fdec6bbc25ccb2ffe255ed23a2988bfe3..eacbbf17d8224a9c4252fe1213a406e60c35159c 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -22,7 +22,6 @@ Heikki Junes
 John Williams
 Jonatan Liljedahl
 Juergen Reuter
-Juliusz Chroboczek
 Mats Bengtsson
 Matthias Neeracher
 Mathieu Giraud
diff --git a/ttftool/GNUmakefile b/ttftool/GNUmakefile
deleted file mode 100644 (file)
index 21777db..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# title           top level makefile for FlowerLib
-# file    flower/Makefile
-
-# should reinstate versioning if shared libs are enabled.
-
-depth = ..
-
-NAME = ttftool
-MODULE_NAME = ttftool
-SUBDIRS = include 
-
-SCRIPTS = 
-README_FILES = README
-EXTRA_DIST_FILES = $(README_FILES) $(SCRIPTS)
-STEPMAKE_TEMPLATES = library c po
-
-MODULE_CFLAGS = $(TTFTOOL_ENDIAN)
-
-include $(depth)/make/stepmake.make 
-
-
diff --git a/ttftool/README b/ttftool/README
deleted file mode 100644 (file)
index 0d64fe1..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-This is the ttfps 0.3 utility by Juliusz Chroboczek,
-
-  http://www.pps.jussieu.fr/~jch/software/file/
-
-ttfps is effectively in the public domain, given the copyright notice
-by Juliusz,
-
-
-       Copying
-       *******
-
-       This software is provided with no guarantee, not even of any kind.
-
-       Feel free to do whatever you wish with it as long as you don't ask me
-       to maintain it.
-
-
diff --git a/ttftool/SConscript b/ttftool/SConscript
deleted file mode 100644 (file)
index b3a1bea..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*-python-*-
-
-Import ('env', 'src_glob')
-sources = src_glob ('*.c')
-includes = src_glob ('include/*.h')
-outdir = Dir ('.').path
-
-name = 'ttftool'
-e = env.Copy ()
-e.Append (CPPPATH = ['#/flower/include', '#/ttftool/include', outdir],
-         # sigh
-         CPPDEFINES = ['-D${BYTEORDER}ENDIAN', '-DSMALLENDIAN=LITTLEENDIAN'],)
-if env['static']:
-       e.Library (name, sources) 
-if not env['static'] or env['shared']:
-       e.SharedLibrary (name, sources)
-
-po = env.Command ('lilypond.po', sources + includes, env['pocommand'])
-env.Alias ('po-update', po)
diff --git a/ttftool/encodings.c b/ttftool/encodings.c
deleted file mode 100644 (file)
index e0eff36..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-
-#define NULL ((void *)0)
-
-/* char *macEncoding[]={ */
-/*   ".notdef", NULL, NULL, NULL, NULL, NULL, */
-/*   NULL, NULL, NULL, NULL, NULL, NULL, */
-/*   NULL, NULL, NULL, NULL, NULL, NULL, */
-/*   NULL, NULL, NULL, NULL, NULL, NULL, */
-/*   NULL, NULL, NULL, NULL, NULL, NULL, */
-/*   NULL, NULL, "space", "exclam", "quotedbl", "numbersign", */
-/*   "dollar", "percent", "ampersand", "quoteright", "parenleft", */
-/*   "parenright", "asterisk", "plus", "comma", "hyphen", "period", */
-/*   "slash", "zero", "one", "two", "three", "four", "five", "six", */
-/*   "seven", "eight", "nine", "colon", "semicolon", "less", "equal", */
-/*   "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", */
-/*   "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", */
-/*   "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", */
-/*   "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", */
-/*   "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", */
-/*   "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", */
-/*   "tilde", NULL, "Adieresis", "Aring", "Ccedilla", "Eacute", */
-/*   "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", */
-/*   "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", */
-/*   "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", */
-/*   "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", */
-/*   "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", */
-/*   "degree", "cent", "sterling", "section", "bullet", "paragraph", */
-/*   "germandbls", "registered", "copyright", "trademark", "acute", */
-/*   "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", */
-/*   "lessequal", "greaterequal", "yen", "mu", "partialdiff", "Sigma", */
-/*   "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", */
-/*   "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", */
-/*   "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", */
-/*   "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", */
-/*   "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", */
-/*   "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", */
-/*   "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", */
-/*   "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", */
-/*   "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", */
-/*   "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", */
-/*   "Ocircumflex", NULL, "Ograve", "Uacute", "Ucircumflex", "Ugrave", */
-/*   "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", */
-/*   "ring", "cedilla", "hungarumlaut", "ogonek", "caron"}; */
-
-char *macGlyphEncoding[] = {
-  ".notdef", ".null", "CR", "space", "exclam", "quotedbl", "numbersign",
-  "dollar", "percent", "ampersand", "quotesingle", "parenleft",
-  "parenright", "asterisk", "plus", "comma", "hyphen", "period",
-  "slash", "zero", "one", "two", "three", "four", "five", "six",
-  "seven", "eight", "nine", "colon", "semicolon", "less", "equal",
-  "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H",
-  "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
-  "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright",
-  "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f",
-  "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
-  "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright",
-  "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde",
-  "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex",
-  "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave",
-  "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex",
-  "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis",
-  "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger",
-  "degree", "cent", "sterling", "section", "bullet", "paragraph",
-  "germandbls", "registered", "copyright", "trademark", "acute",
-  "dieresis", "notequal", "AE", "Oslash", "infinity", "plusinus",
-  "lessequal", "greaterequal", "yen", "mu1", "partialdiff", "summation",
-  "product", "pi", "integral", "ordfeminine", "ordmasculine", "Ohm",
-  "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical",
-  "florin", "approxequal", "increment", "guillemotleft",
-  "guillemotright", "ellipsis", "nbspace", "Agrave", "Atilde", "Otilde",
-  "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright",
-  "quoteleft", "quoteright", "divide", "lozenge", "ydieresis",
-  "Ydieresis", "fraction", "currency", "guilsingleft", "guilsingright",
-  "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase",
-  "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute",
-  "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave",
-  "Oacute", "Ocircumflex", "applelogo", "Ograve", "Uacute",
-  "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde",
-  "overscore", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut",
-  "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron",
-  "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn",
-  "thorn", "minus", "multiply", "onesuperior", "twosuperior",
-  "threesuperior", "onehalf", "onequarter", "threequarters", "franc",
-  "Gbreve", "gbreve", "Idot", "Scedilla", "scedilla", "Cacute",
-  "cacute", "Ccaron", "ccaron", "dmacron"
-};
-
-char *adobeStandardEncoding[] = {
-  ".notdef", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  "space", "exclam", "quotedbl", "numbersign", "dollar", "percent",
-    "ampersand", "quoteright",
-  "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period",
-    "slash",
-  "zero", "one", "two", "three", "four", "five", "six", "seven",
-  "eight", "nine", "colon", "semicolon", "less", "equal", "greater",
-    "question",
-  "at", "A", "B", "C", "D", "E", "F", "G",
-  "H", "I", "J", "K", "L", "M", "N", "O",
-  "P", "Q", "R", "S", "T", "U", "V", "W",
-  "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum",
-    "underscore",
-  "quoteleft", "a", "b", "c", "d", "e", "f", "g",
-  "h", "i", "j", "k", "l", "m", "n", "o",
-  "p", "q", "r", "s", "t", "u", "v", "w",
-  "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, "exclamdown", "cent", "sterling", "fraction", "yen", "florin",
-    "section",
-  "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft",
-    "guilsinglright", "fi", "fl",
-  NULL, "endash", "dagger", "daggerdbl", "periodcentered", NULL, "paragraph",
-    "bullet",
-  "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright",
-    "ellipsis", "perthousand", NULL, "questiondown",
-  NULL, "grave", "acute", "circumflex", "tilde", "macron", "breve",
-    "dotaccent",
-  "dieresis", NULL, "ring", "cedilla", NULL, "hungarumlaut", "ogonek",
-    "caron",
-  "emdash", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-  NULL, "AE", NULL, "ordfeminine", NULL, NULL, NULL, NULL,
-  "Lslash", "Oslash", "OE", "ordmasculine", NULL, NULL, NULL, NULL,
-  NULL, "ae", NULL, NULL, NULL, "dotlessi", NULL, NULL,
-  "lslash", "oslash", "oe", "germandbls", NULL, NULL, NULL, NULL
-};
diff --git a/ttftool/parse.c b/ttftool/parse.c
deleted file mode 100644 (file)
index 1f7f06f..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-
-/*
-  TODO: junk this  in favor of Freetype.
- */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "types.h"
-#include "proto.h"
-#include "ttftool.h"
-
-struct TableDirectoryEntry *
-readDirectory (FILE *fd, struct OffsetTable *ot)
-{
-  unsigned n;
-  int i;
-
-  struct TableDirectoryEntry *td;
-  
-  surely_read (fd, ot, sizeof (struct OffsetTable));
-  FIX_OffsetTable (*ot);
-  if (ttf_verbosity >= 2)
-    fprintf (stderr, "%d tables\n", ot->numTables);
-
-  n = sizeof (struct TableDirectoryEntry) * ot->numTables;
-  td = mymalloc (n);
-  surely_read (fd, td, n);
-  for (i = 0; i < ot->numTables; i++)
-    FIX_TableDirectoryEntry (td[i]);
-  return td;
-}
-
-char **
-readNamingTable (FILE *fd)
-{
-  USHORT format;
-  USHORT nrecords;
-  off_t position;
-  USHORT offset;
-  int i, index, maxIndex;
-  struct NameRecord *records;
-  char *data;
-  char **strings;
-
-  position = ftell (fd);
-
-  surely_read (fd, &format, sizeof (USHORT));
-  FIX_UH (format);
-  if (format != 0)
-    ttf_error ("Format should be 0\n");
-
-  surely_read (fd, &nrecords, sizeof (USHORT));
-  FIX_UH (nrecords);
-  surely_read (fd, &offset, sizeof (USHORT));
-  FIX_UH (offset);
-  records = mymalloc (nrecords * sizeof (struct NameRecord));
-  surely_read (fd, records, nrecords * sizeof (struct NameRecord));
-
-  for (i = 0, maxIndex = -1; i < nrecords; i++)
-    {
-      FIX_NameRecord (records[i]);
-      index = records[i].offset + records[i].length;
-      maxIndex = maxIndex > index ? maxIndex : index;
-    }
-  data = mymalloc (maxIndex);
-  surely_lseek (fd, position + offset, SEEK_SET);
-  surely_read (fd, data, maxIndex);
-
-  strings = mymalloc (8 * sizeof (char *));
-  for (i = 0; i < 8; i++)
-    strings[i] = NULL;
-
-  for (i = 0; i < nrecords; i++)
-    {
-      if
-       ((records[i].platformID == 3 && /* Microsoft */
-         records[i].encodingID == 1 && /* UGL */
-         records[i].languageID == 0x0409 &&    /* US English */
-         records[i].nameID <= 7))
-       {
-         strings[records[i].nameID] = mymalloc (records[i].length / 2 + 1);
-         unistrncpy (strings[records[i].nameID],
-                     data + records[i].offset, records[i].length);
-         if (ttf_verbosity >= 2)
-           fprintf (stderr, "%d: %s\n", records[i].nameID,
-                    strings[records[i].nameID]);
-       }
-    }
-
-
-  for (i = 0; i < nrecords; i++)
-    {
-      int id = records[i].nameID;
-      if (records[i].platformID == 1 &&        /* Apple */
-         records[i].encodingID == 0 && /* 8bit */
-         id <= 7 &&
-         !strings[id]
-        )
-       {
-         strings[id] = mymalloc (records[i].length + 1);
-         strncpy (strings[id],
-                  data + records[i].offset, records[i].length);
-         strings[id][records[i].length] = 0;
-         if (ttf_verbosity >= 2)
-           fprintf (stderr, "%d: %s\n", records[i].nameID,
-                    strings[records[i].nameID]);
-       }
-    }
-
-  free (records);
-  free (data);
-  return strings;
-}
-
-int
-readMaxpTable (FILE *fd)
-{
-  struct
-  {
-    Fixed version;
-    USHORT nglyphs;
-  } data;
-  surely_read (fd, &data, sizeof (data));
-  FIX_Fixed (data.version);
-  FIX_UH (data.nglyphs);
-  if (ttf_verbosity >= 2)
-    fprintf (stderr, "  version %d.%u\n",
-            data.version.mantissa, data.version.fraction);
-  return data.nglyphs;
-}
-
-void
-readHeadTable (FILE *fd, struct HeadTable *ht)
-{
-  surely_read (fd, ht, sizeof (struct HeadTable));
-  FIX_HeadTable (*ht);
-  if (ttf_verbosity >= 2)
-    {
-      fprintf (stderr, "  version %d.%d\n",
-              ht->version.mantissa, ht->version.fraction);
-      fprintf (stderr, "  font revision %d.%d\n",
-              ht->fontRevision.mantissa, ht->fontRevision.fraction);
-    }
-  if (ht->magicNumber != 0x5F0F3CF5)
-    ttf_error ("Bad magic number");
-  if (ttf_verbosity >= 2)
-    fprintf (stderr, "  %d units per Em\n", ht->unitsPerEm);
-}
-
-int
-readPostTable (FILE *fd, int root_nglyphs, struct PostTable *pt,
-              USHORT *nglyphs, struct GlyphName **gt)
-{
-  USHORT *glyphNameIndex;
-  struct GlyphName *glyphNames;
-  char **glyphNamesTemp;
-  int i, maxIndex;
-  CHAR c;
-
-  *nglyphs = 0; 
-  surely_read (fd, pt, sizeof (struct PostTable));
-  FIX_PostTable (*pt);
-  if (ttf_verbosity >= 2)
-    fprintf (stderr, "  format type %d.%u\n",
-            pt->formatType.mantissa, pt->formatType.fraction);
-
-  switch (pt->formatType.mantissa)
-    {
-    case 1:
-      return 1;                        /* MacGlyphEncoding */
-    case 2:
-      if (pt->formatType.fraction != 0)
-       ttf_error ("Unsupported `post' table format");
-      surely_read (fd, nglyphs, sizeof (USHORT));
-
-      /*from freetype2:
-       */
-      /*
-       UNDOCUMENTED!  The number of glyphs in this table can be smaller
-       than the value in the maxp table (cf. cyberbit.ttf).             
-       */
-      FIX_UH (*nglyphs);
-      if (*nglyphs > root_nglyphs)
-       {
-         fprintf (stderr, "More glyphs in 'post' table than in 'maxp' table");
-       }
-      
-      if (ttf_verbosity >= 2)
-       fprintf (stderr, "  %d glyphs\n", *nglyphs);
-      glyphNameIndex = mymalloc (sizeof (USHORT) * *nglyphs);
-      surely_read (fd, glyphNameIndex, sizeof (USHORT) * *nglyphs);
-      glyphNames = mymalloc (sizeof (struct GlyphName) * *nglyphs);
-      for (i = 0, maxIndex = -1; i < *nglyphs; i++)
-       {
-         FIX_UH (glyphNameIndex[i]);
-         if (glyphNameIndex[i] < 258)
-           {
-             glyphNames[i].type = 0;
-             glyphNames[i].name.index = glyphNameIndex[i];
-           }
-         else
-           {
-             int index;
-             glyphNames[i].type = 1;
-             index = glyphNameIndex[i] - 258;
-             glyphNames[i].name.index = index;
-             maxIndex = maxIndex > index ? maxIndex : index;
-           }
-       }
-      free (glyphNameIndex);
-
-      i = 0;
-      glyphNamesTemp = mymalloc (sizeof (char *) * (maxIndex + 1));
-      while (i <= maxIndex)
-       {
-         surely_read (fd, &c, 1);
-         glyphNamesTemp[i] = mymalloc (c + 1);
-         surely_read (fd, glyphNamesTemp[i], c);
-         glyphNamesTemp[i][c] = '\0';
-         if (ttf_verbosity >= 3)
-           fprintf (stderr, "    %d: %s\n", i, glyphNamesTemp[i]);
-         i++;
-       }
-      for (i = 0; i < *nglyphs; i++)
-       if (glyphNames[i].type == 1)
-         glyphNames[i].name.name = glyphNamesTemp[glyphNames[i].name.index];
-      free (glyphNamesTemp);
-      *gt = glyphNames;
-      return 2;
-    case 3:
-      return 3;                        /* no name table */
-    default:
-      return 0;
-    }
- /*NOTREACHED*/}
-
-void *
-readLocaTable (FILE *fd, int nglyphs, int format)
-{
-  int i;
-  switch (format)
-    {
-    case 0:
-      {
-       USHORT *offsets;
-       offsets = mymalloc ((nglyphs + 1) * sizeof (USHORT));
-       surely_read (fd, offsets, (nglyphs + 1) * sizeof (USHORT));
-       for (i = 0; i <= nglyphs; i++)
-         FIX_UH (offsets[i]);
-       return offsets;
-      }
-     /*NOTREACHED*/ case 1:
-      {
-       ULONG *offsets;
-       offsets = mymalloc ((nglyphs + 1) * sizeof (ULONG));
-       surely_read (fd, offsets, (nglyphs + 1) * sizeof (ULONG));
-       for (i = 0; i <= nglyphs; i++)
-         FIX_UL (offsets[i]);
-       return offsets;
-      }
-     /*NOTREACHED*/ default:
-      ttf_error ("Unknown `loca' table format");
-     /*NOTREACHED*/}
- /*NOTREACHED*/}
-
-struct Box *
-readGlyfTable (FILE *fd, int nglyphs, int format, void *loca)
-{
-  int i;
-  struct Box *bbox;
-  off_t base, offset;
-
-  base = ftell (fd);
-
-  bbox = mymalloc (nglyphs * sizeof (struct Box));
-  for (i = 0; i < nglyphs; i++)
-    {
-      if (format == 0)
-       offset = 2 * ((USHORT *) loca)[i];
-      else
-       offset = ((ULONG *) loca)[i];
-      surely_lseek (fd, base + offset + sizeof (SHORT), SEEK_SET);
-      surely_read (fd, bbox + i, sizeof (struct Box));
-      FIX_Box (bbox[i]);
-    }
-  return bbox;
-}
-
-longHorMetric *
-readHmtxTable (FILE *fd, int nummetrics)
-{
-  longHorMetric *metrics;
-  int i;
-
-  metrics = mymalloc (nummetrics * sizeof (longHorMetric));
-  surely_read (fd, metrics, nummetrics * sizeof (longHorMetric));
-  for (i = 0; i < nummetrics; i++)
-    {
-      FIX_longHorMetric (metrics[i]);
-    }
-  return metrics;
-}
-
-struct HheaTable *
-readHheaTable (FILE *fd)
-{
-  struct HheaTable *hhea;
-  hhea = mymalloc (sizeof (struct HheaTable));
-  surely_read (fd, hhea, sizeof (struct HheaTable));
-  FIX_HheaTable (*hhea);
-  if (ttf_verbosity >= 2)
-    fprintf (stderr, "  version %d.%u\n",
-            hhea->version.mantissa, hhea->version.fraction);
-  if (hhea->metricDataFormat != 0)
-    ttf_error ("Unknown metric data format");
-  return hhea;
-}
-
-int
-readKernTable (FILE *fd, int **nkep, struct KernEntry0 ***kep)
-{
-  struct KernTable kt;
-  struct KernSubTableHeader ksth;
-  struct KernSubTable0 kst;
-  int i, j;
-  int *nke;
-  struct KernEntry0 **ke;
-
-  surely_read (fd, &kt, sizeof (struct KernTable));
-  FIX_KernTable (kt);
-  if (ttf_verbosity >= 2)
-    {
-      fprintf (stderr, "  version %d\n", kt.version);
-      fprintf (stderr, "  %d subtables\n", kt.nTables);
-    }
-  nke = mymalloc (kt.nTables * sizeof (int));
-  ke = mymalloc (kt.nTables * sizeof (struct KernEntry0 *));
-
-  for (i = 0; i < kt.nTables; i++)
-    {
-      surely_read (fd, &ksth, sizeof (struct KernSubTableHeader));
-      FIX_KernSubTableHeader (ksth);
-      if (ttf_verbosity >= 2)
-       fprintf (stderr, "  analyzing subtable %d, version %d... ",
-                i, ksth.version);
-      if ((ksth.coverage & kernHorizontal) &&
-         !(ksth.coverage & kernMinimum) &&
-         !(ksth.coverage & kernCrossStream) &&
-         (kernFormat (ksth.coverage) == 0))
-       {
-         surely_read (fd, &kst, sizeof (struct KernSubTable0));
-         FIX_KernSubTable0 (kst);
-         if (ttf_verbosity >= 2)
-           fprintf (stderr, "reading %d entries.\n", kst.nPairs);
-         nke[i] = kst.nPairs;
-         ke[i] = mymalloc (kst.nPairs * sizeof (struct KernEntry0));
-         surely_read (fd, ke[i], kst.nPairs * sizeof (struct KernEntry0));
-         for (j = 0; j < kst.nPairs; j++)
-           FIX_KernEntry0 (ke[i][j]);
-       }
-      else
-       {
-         if (ttf_verbosity >= 2)
-           fprintf (stderr, "skipping.\n");
-         surely_lseek (fd, ksth.length - sizeof (struct KernSubTableHeader),
-                       SEEK_CUR);
-       }
-    }
-  *nkep = nke;
-  *kep = ke;
-  return kt.nTables;
-}
diff --git a/ttftool/ps.c b/ttftool/ps.c
deleted file mode 100644 (file)
index 882a50c..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "types.h"
-#include "proto.h"
-
-#include "ttftool.h"
-
-#define CHUNKSIZE 65534
-
-#define NAMEOF(i) \
-        ((i)==0?\
-         ".notdef":\
-         ((postType==2)?\
-          ((gnt[i].type==0)?\
-           (gnt[i].name.index==0?NULL:macGlyphEncoding[gnt[i].name.index]):\
-           gnt[i].name.name):\
-          ((i)<258?macGlyphEncoding[i]:NULL)))
-
-
-void
-printPSFont (void *out, struct HeadTable *ht,
-            char **strings, int nglyphs, int postType,
-            struct PostTable *pt,
-            USHORT post_nglyphs,
-            struct GlyphName *gnt, FILE *fd)
-{
-  printPSHeader (out, ht, strings, pt);
-  printPSData (out, fd);
-  printPSTrailer (out, nglyphs, post_nglyphs, postType, gnt);
-}
-
-void
-printPSHeader (void *out, struct HeadTable *ht,
-              char **strings, struct PostTable *pt)
-{
-  lily_cookie_fprintf (out, "%%!PS-TrueTypeFont\n");
-  if (pt->maxMemType42)
-    lily_cookie_fprintf (out, "%%%%VMUsage: %ld %ld\n", pt->minMemType42,
-            pt->maxMemType42);
-  lily_cookie_fprintf (out, "%d dict begin\n", 11);
-  lily_cookie_fprintf (out, "/FontName /%s def\n", strings[6] ? strings[6] : "Unknown");
-  lily_cookie_fprintf (out, "/Encoding StandardEncoding def\n");
-  lily_cookie_fprintf (out, "/PaintType 0 def\n/FontMatrix [1 0 0 1 0 0] def\n");
-  lily_cookie_fprintf (out, "/FontBBox [%ld %ld %ld %ld] def\n",
-          ht->xMin * 1000L / ht->unitsPerEm,
-          ht->yMin * 1000L / ht->unitsPerEm,
-          ht->xMax * 1000L / ht->unitsPerEm,
-          ht->yMax * 1000L / ht->unitsPerEm);
-  lily_cookie_fprintf (out, "/FontType 42 def\n");
-  lily_cookie_fprintf (out, "/FontInfo 8 dict dup begin\n");
-  lily_cookie_fprintf (out, "/version (%d.%d) def\n",
-          ht->fontRevision.mantissa, ht->fontRevision.fraction);
-  if (strings[0])
-    {
-      lily_cookie_fprintf (out, "/Notice (");
-      fputpss (strings[0], out);
-      lily_cookie_fprintf (out, ") def\n");
-    }
-  if (strings[4])
-    {
-      lily_cookie_fprintf (out, "/FullName (");
-      fputpss (strings[4], out);
-      lily_cookie_fprintf (out, ") def\n");
-    }
-  if (strings[1])
-    {
-      lily_cookie_fprintf (out, "/FamilyName (");
-      fputpss (strings[1], out);
-      lily_cookie_fprintf (out, ") def\n");
-    }
-  lily_cookie_fprintf (out, "/isFixedPitch %s def\n",
-          pt->isFixedPitch ? "true" : "false");
-  lily_cookie_fprintf (out, "/UnderlinePosition %ld def\n",
-          pt->underlinePosition * 1000L / ht->unitsPerEm);
-  lily_cookie_fprintf (out, "/UnderlineThickness %ld def\n",
-          pt->underlineThickness * 1000L / ht->unitsPerEm);
-  lily_cookie_fprintf (out, "end readonly def\n");
-}
-
-void
-printPSData (void *out, FILE *fd)
-{
-  static char xdigits[] = "0123456789ABCDEF";
-
-  unsigned char *buffer;
-  int i, j;
-
-  surely_lseek (fd, 0, SEEK_SET);
-
-  buffer = mymalloc (CHUNKSIZE);
-
-  lily_cookie_fprintf (out, "/sfnts [");
-  for (;;)
-    {
-      i = fread (buffer, 1, CHUNKSIZE, fd);
-      if (i == 0)
-       break;
-      lily_cookie_fprintf (out, "\n<");
-      for (j = 0; j < i; j++)
-       {
-         if (j != 0 && j % 36 == 0)
-           lily_cookie_putc ('\n', out);
-         /* lily_cookie_fprintf (out,"%02X",(int)buffer[j]) is too slow */
-         lily_cookie_putc (xdigits[(buffer[j] & 0xF0) >> 4], out);
-         lily_cookie_putc (xdigits[buffer[j] & 0x0F], out);
-       }
-      lily_cookie_fprintf (out, "00>");        /* Adobe bug? */
-      if (i < CHUNKSIZE)
-       break;
-    }
-  lily_cookie_fprintf (out, "\n] def\n");
-  free (buffer);
-}
-
-void
-printPSTrailer (void *out, int nglyphs, int postType,
-               USHORT postNGlyphs, struct GlyphName *gnt)
-{
-  int i, n;
-  char *name;
-
-  lily_cookie_fprintf (out, "/CharStrings %d dict dup begin\n", nglyphs);
-  switch (postType)
-    {
-    case 2:
-      for (n = i = 0; i < nglyphs; i++)
-       {
-         if (n != 0 && n % 4 == 0)
-           lily_cookie_fprintf (out, "\n");
-         name = NAMEOF (i);
-         if (name)
-           {
-             lily_cookie_fprintf (out, "/%s %d def ", name, i);
-             n++;
-           }
-       }
-      break;
-    default:
-      if (postType != 1)
-       {
-         if (ttf_verbosity > -2)
-           fprintf (stderr,
-                    "No glyph name table; assuming MacGlyphEncoding\n");
-       }
-      for (i = 0; i < 258 && i < nglyphs; i++)
-       {
-         lily_cookie_fprintf (out, "/%s %d def ", macGlyphEncoding[i], i);
-         if (i != 0 && i % 4 == 0)
-           lily_cookie_fprintf (out, "\n");
-       }
-      break;
-    }
-  lily_cookie_fprintf (out, "end readonly def\n");
-  lily_cookie_fprintf (out, "FontName currentdict end definefont pop\n");
-}
diff --git a/ttftool/test.c b/ttftool/test.c
deleted file mode 100644 (file)
index 49f653e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifdef TEST_TTFTOOL
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include "ttftool.h"
-
-
-main (int argc, char **argv)
-{
-  FILE *in, *out;
-  if (argc != 3)
-    {
-      fprintf (stderr, "%s input.ttf output.pfa", argv[0]);
-      exit (2);
-    }
-
-  out = fopen (argv[2], "w");
-  assert(out);
-  create_type42 (argv[1], (void*) out);
-}
-
-#endif
diff --git a/ttftool/ttfps.c b/ttftool/ttfps.c
deleted file mode 100644 (file)
index de9a88a..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "types.h"
-#include "proto.h"
-
-
-static void endianness_test (void);
-static void usage (char *);
-
-int ttf_verbosity = 0;
-
-void
-create_type42 (const char *infile, void *out)
-{
-  FILE *fd = 0;
-  int  i;
-  struct OffsetTable ot;
-  struct HeadTable *ht;
-  struct PostTable *pt;
-  struct TableDirectoryEntry *td;
-  void *loca = NULL;
-  struct HheaTable *hhea = NULL;
-  struct Box *bbox = NULL;
-  longHorMetric *hmtx = NULL;
-  char **strings = NULL;
-  struct GlyphName *gnt = NULL;
-  struct KernEntry0 **ke;
-  USHORT post_nglyphs = 0;
-  int *nke;
-  int nglyphs, postType, nkern;
-  off_t headOff = 0, maxpOff = 0, postOff = 0, nameOff = 0,
-    locaOff = 0, glyfOff = 0, hheaOff = 0, hmtxOff = 0, kernOff = 0;
-
-  extern char *optarg;
-  extern int optind;
-  int c;
-
-  endianness_test ();
-
-  if ((fd = fopen (infile, "rb")) == NULL)
-    {
-      syserror ("Error opening input file");
-    }
-
-  td = readDirectory (fd, &ot);
-  if (ttf_verbosity >= 2)
-    fprintf (stderr, "True type version %d.%u\n",
-            ot.version.mantissa, ot.version.fraction);
-
-  for (i = 0; i < ot.numTables; i++)
-    {
-      if (ttf_verbosity >= 2)
-       fprintf (stderr, "Found `%c%c%c%c' table\n",
-                (char) (td[i].tag >> 24),
-                (char) (td[i].tag >> 16) & 255,
-                (char) (td[i].tag >> 8) & 255, (char) td[i].tag & 255);
-      switch (td[i].tag)
-       {
-       case MAKE_ULONG ('m', 'a', 'x', 'p'):
-         maxpOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('h', 'e', 'a', 'd'):
-         headOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('p', 'o', 's', 't'):
-         postOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('n', 'a', 'm', 'e'):
-         nameOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('l', 'o', 'c', 'a'):
-         locaOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('g', 'l', 'y', 'f'):
-         glyfOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('h', 'h', 'e', 'a'):
-         hheaOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('h', 'm', 't', 'x'):
-         hmtxOff = td[i].offset;
-         break;
-       case MAKE_ULONG ('k', 'e', 'r', 'n'):
-         kernOff = td[i].offset;
-         break;
-       }
-    }
-  if (maxpOff == 0 || headOff == 0 || postOff == 0 || nameOff == 0)
-    ttf_error ("Incomplete TTF file\n");
-
-  if (ttf_verbosity >= 1)
-    fprintf (stderr, "Processing `maxp' table\n");
-  surely_lseek (fd, maxpOff, SEEK_SET);
-  nglyphs = readMaxpTable (fd);
-  if (ttf_verbosity >= 1)
-    fprintf (stderr, "  %d glyphs\n", nglyphs);
-
-  if (ttf_verbosity >= 1)
-    fprintf (stderr, "Processing `head' table\n");
-  surely_lseek (fd, headOff, SEEK_SET);
-  ht = mymalloc (sizeof (struct HeadTable));
-  readHeadTable (fd, ht);
-
-  if (ttf_verbosity >= 1)
-    fprintf (stderr, "Processing `post' table\n");
-  surely_lseek (fd, postOff, SEEK_SET);
-  pt = mymalloc (sizeof (struct PostTable));
-  
-  postType = readPostTable (fd, nglyphs, pt, &post_nglyphs, &gnt);
-
-  if (ttf_verbosity >= 1)
-    fprintf (stderr, "Processing `name' table\n");
-  surely_lseek (fd, nameOff, SEEK_SET);
-  strings = readNamingTable (fd);
-
-  if (ttf_verbosity >= 1)
-    fprintf (stderr, "Generating PS file\n");
-  printPSFont (out, ht, strings, nglyphs, postType, pt, post_nglyphs, gnt, fd);
-  lily_cookie_fclose (out);
-  if (ttf_verbosity >= 1)
-    fprintf (stderr, "Done.\n");
-  fclose (fd);
-}
-
-
-static void
-endianness_test ()
-{
-  union
-  {
-    BYTE b[4];
-    ULONG l;
-  } x;
-  ULONG v;
-
-  x.b[0] = 1;
-  x.b[1] = 2;
-  x.b[2] = 3;
-  x.b[3] = 4;
-
-  v = UL (x.l);
-
-  if (v != (((((1 << 8) + 2) << 8) + 3) << 8) + 4)
-    {
-      fprintf (stderr, "Code badly compiled for this architecture\n");
-      fprintf (stderr, "Please set SMALLENDIAN and recompile\n");
-      exit (2);
-    }
-}
diff --git a/ttftool/util.c b/ttftool/util.c
deleted file mode 100644 (file)
index d06a4fc..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "types.h"
-#include "proto.h"
-#include "ttftool.h"
-
-
-void *
-mymalloc (size_t size)
-{
-  void *p;
-  if ((p = malloc (size)) == NULL)
-    ttf_error ("Unable to allocate memory\n");
-  return p;
-}
-
-void *
-mycalloc (size_t nelem, size_t elsize)
-{
-  void *p;
-  if ((p = calloc (nelem, elsize)) == NULL)
-    ttf_error ("Unable to allocate memory\n");
-  return p;
-}
-
-void
-ttf_error (char *string)
-{
-  fprintf (stderr, "TTF tool: %s\n", string);
-  exit (3);
- /*NOTREACHED*/
-}
-
-void
-syserror (char *string)
-{
-  char *sys_err = strerror (errno);
-  fprintf (stderr, "TTF tool: %s (%s)\n",
-          string,
-          sys_err);
-  exit (3);
-}
-
-void *
-myrealloc (void *ptr, size_t size)
-{
-  void *p;
-  if ((p = realloc (ptr, size)) == NULL)
-    ttf_error ("Unable to allocate memory\n");
-  return p;
-}
-
-void
-show_fpos (int fd)
-{
-  off_t here = lseek (fd, 0, SEEK_CUR);
-  off_t end = lseek (fd, 0, SEEK_END);
-  fprintf (stderr, "here %d end %d", here, end);
-  lseek (fd, here, SEEK_SET);
-}
-
-void
-surely_lseek (FILE *fildes, off_t offset, int whence)
-{
-  if (ttf_verbosity >= 3)
-    fprintf (stderr, "Seeking to %d %d\n", whence, offset);
-  
-  off_t result;
-  if ((result = fseek (fildes, (long) offset, whence)) < 0)
-    {
-      char s[100];
-      sprintf (s, "Cannot seek");
-      syserror (s);
-    }
-}
-
-ssize_t
-surely_read (FILE *fildes, void *buf, size_t nbyte)
-{
-  if (ttf_verbosity >= 3)
-    fprintf (stderr, "Reading %d bytes\n", nbyte);
-  if (nbyte == 0)
-    return 0;
-  
-  int items = fread (buf, nbyte, 1,  fildes);
-  return nbyte;
-}
-
-char *
-unistrncpy (char *dst, char *str, size_t length)
-{
-  int i, j;
-
-  for (i = j = 0; i < length; i += 2)
-    if (str[i] == 0)
-      dst[j++] = str[i + 1];
-  dst[j] = '\0';
-  return dst;
-}
-
-void
-fputpss (char *s, void *stream)
-{
-  while (*s)
-    {
-      if ((*s & 0200) == 0 && *s >= 040 && *s != '(' && *s != ')')
-       lily_cookie_putc (*s, stream);
-      else
-       lily_cookie_fprintf (stream, "\\%03o", (unsigned char) *s);
-      s++;
-    }
-}
-
-/* Hashtables */
-
-unsigned
-hash (char *string)
-{
-  int i;
-  unsigned u = 0;
-  for (i = 0; string[i] != '\0'; i++)
-    u = (u << 2) + string[i];
-  return u;
-}
-
-struct hashtable *
-make_hashtable (int size)
-{
-  struct hashtable *t;
-
-  t = mymalloc (sizeof (struct hashtable));
-  t->size = size;
-  t->buckets = mycalloc (size, sizeof (struct hashtable_bucket *));
-
-  return t;
-}
-
-int
-puthash (struct hashtable *t, char *key, int value)
-{
-  int i;
-
-  i = hash (key) % t->size;
-
-  if (t->buckets[i] == 0)
-    {
-      t->buckets[i] = mymalloc (sizeof (struct hashtable_bucket));
-      t->buckets[i]->entries = mymalloc (4 * sizeof (struct hashtable_entry));
-      t->buckets[i]->size = 4;
-      t->buckets[i]->nentries = 0;
-    }
-
-  if (t->buckets[i]->nentries >= t->buckets[i]->size)
-    {
-      t->buckets[i]->entries = myrealloc (t->buckets[i]->entries,
-                                         t->buckets[i]->size * 2 *
-                                         sizeof (struct hashtable_entry));
-      t->buckets[i]->size *= 2;
-    }
-
-  t->buckets[i]->entries[t->buckets[i]->nentries].key = key;
-  t->buckets[i]->entries[t->buckets[i]->nentries].value = value;
-  t->buckets[i]->nentries++;
-
-  return value;
-}
-
-int
-gethash (struct hashtable *t, char *key)
-{
-  int i, j;
-
-  i = hash (key) % t->size;
-  if (t->buckets[i])
-    for (j = 0; j < t->buckets[i]->nentries; j++)
-      if (!strcmp (key, t->buckets[i]->entries[j].key))
-       return t->buckets[i]->entries[j].value;
-  return -1;
-}