program option.
* ttftool/include/ttftool.h ("C"): rename verbosity to
ttf_verbosity. Add to public interface.
* lily/program-option.cc: rename from scm-option.cc
2005-06-09 Han-Wen Nienhuys <hanwen@xs4all.nl>
2005-06-09 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/pfb.cc (LY_DEFINE): set ttf_verbosity from ttf-verbosity
+ program option.
+
+ * ttftool/include/ttftool.h ("C"): rename verbosity to
+ ttf_verbosity. Add to public interface.
+
+ * scm/music-functions.scm (unfold-repeats): remove debugging display.
+
* lily/program-option.cc: rename from scm-option.cc
* lily/scm-option.cc (LY_DEFINE): handle no-foobar option setting.
* lily/program-option.cc: rename from scm-option.cc
* lily/scm-option.cc (LY_DEFINE): handle no-foobar option setting.
#include <cstdio>
#include <cstring>
#include <cstdio>
#include <cstring>
+#include "program-option.hh"
#include "source-file.hh"
#include "memory-stream.hh"
#include "ttftool.h"
#include "open-type-font.hh"
#include "main.hh"
#include "warn.hh"
#include "source-file.hh"
#include "memory-stream.hh"
#include "ttftool.h"
#include "open-type-font.hh"
#include "main.hh"
#include "warn.hh"
char *
pfb2pfa (Byte const *pfb, int length)
{
char *
pfb2pfa (Byte const *pfb, int length)
{
Memory_out_stream stream;
Memory_out_stream stream;
+ ttf_verbosity =
+ robust_scm2int (ly_get_option (ly_symbol2scm ("ttf-verbosity")), 0);
+
create_type42 (file_name.to_str0 (), (void*) &stream);
SCM asscm = scm_from_locale_stringn (stream.get_string (),
stream.get_length ());
create_type42 (file_name.to_str0 (), (void*) &stream);
SCM asscm = scm_from_locale_stringn (stream.get_string (),
stream.get_length ());
"include book-titles in preview images."},
{"gs-font-load", "#f",
"load fonts via Ghostscript."},
"include book-titles in preview images."},
{"gs-font-load", "#f",
"load fonts via Ghostscript."},
+ {"ttf-verbosity", "0",
+ "how much verbosity for TTF font embedding?"},
/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
struct TableDirectoryEntry *readDirectory (int fd, struct OffsetTable *ot);
char **readNamingTable (int fd);
void readHeadTable (int fd, struct HeadTable *ht);
struct TableDirectoryEntry *readDirectory (int fd, struct OffsetTable *ot);
char **readNamingTable (int fd);
void readHeadTable (int fd, struct HeadTable *ht);
void create_type42 (char const *, void *);
void create_type42 (char const *, void *);
+ extern int ttf_verbosity;
+
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "types.h"
#include "proto.h"
#include "types.h"
#include "proto.h"
struct TableDirectoryEntry *
readDirectory (int fd, struct OffsetTable *ot)
struct TableDirectoryEntry *
readDirectory (int fd, struct OffsetTable *ot)
int i;
struct TableDirectoryEntry *td;
int i;
struct TableDirectoryEntry *td;
+ if (ttf_verbosity >= 3)
+ fprintf (stderr, "");
+
surely_read (fd, ot, sizeof (struct OffsetTable));
FIX_OffsetTable (*ot);
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);
fprintf (stderr, "%d tables\n", ot->numTables);
n = sizeof (struct TableDirectoryEntry) * ot->numTables;
td = mymalloc (n);
strings[records[i].nameID] = mymalloc (records[i].length / 2 + 1);
unistrncpy (strings[records[i].nameID],
data + records[i].offset, records[i].length);
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]);
}
fprintf (stderr, "%d: %s\n", records[i].nameID,
strings[records[i].nameID]);
}
strncpy (strings[id],
data + records[i].offset, records[i].length);
strings[id][records[i].length] = 0;
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]);
}
fprintf (stderr, "%d: %s\n", records[i].nameID,
strings[records[i].nameID]);
}
surely_read (fd, &data, sizeof (data));
FIX_Fixed (data.version);
FIX_UH (data.nglyphs);
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;
fprintf (stderr, " version %d.%u\n",
data.version.mantissa, data.version.fraction);
return data.nglyphs;
{
surely_read (fd, ht, sizeof (struct HeadTable));
FIX_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, " version %d.%d\n",
ht->version.mantissa, ht->version.fraction);
}
if (ht->magicNumber != 0x5F0F3CF5)
ttf_error ("Bad magic number");
}
if (ht->magicNumber != 0x5F0F3CF5)
ttf_error ("Bad magic number");
+ if (ttf_verbosity >= 2)
fprintf (stderr, " %d units per Em\n", ht->unitsPerEm);
}
fprintf (stderr, " %d units per Em\n", ht->unitsPerEm);
}
surely_read (fd, pt, sizeof (struct PostTable));
FIX_PostTable (*pt);
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);
fprintf (stderr, " format type %d.%u\n",
pt->formatType.mantissa, pt->formatType.fraction);
FIX_UH (nglyphspost);
if (nglyphspost != nglyphs)
ttf_error ("Inconsistency between `maxp' and `nglyphs' tables!");
FIX_UH (nglyphspost);
if (nglyphspost != nglyphs)
ttf_error ("Inconsistency between `maxp' and `nglyphs' tables!");
+ if (ttf_verbosity >= 2)
fprintf (stderr, " %d glyphs\n", nglyphs);
glyphNameIndex = mymalloc (sizeof (USHORT) * nglyphs);
surely_read (fd, glyphNameIndex, sizeof (USHORT) * nglyphs);
fprintf (stderr, " %d glyphs\n", nglyphs);
glyphNameIndex = mymalloc (sizeof (USHORT) * nglyphs);
surely_read (fd, glyphNameIndex, sizeof (USHORT) * nglyphs);
glyphNamesTemp[i] = mymalloc (c + 1);
surely_read (fd, glyphNamesTemp[i], c);
glyphNamesTemp[i][c] = '\0';
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++;
}
fprintf (stderr, " %d: %s\n", i, glyphNamesTemp[i]);
i++;
}
hhea = mymalloc (sizeof (struct HheaTable));
surely_read (fd, hhea, sizeof (struct HheaTable));
FIX_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)
fprintf (stderr, " version %d.%u\n",
hhea->version.mantissa, hhea->version.fraction);
if (hhea->metricDataFormat != 0)
surely_read (fd, &kt, sizeof (struct KernTable));
FIX_KernTable (kt);
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);
{
fprintf (stderr, " version %d\n", kt.version);
fprintf (stderr, " %d subtables\n", kt.nTables);
{
surely_read (fd, &ksth, sizeof (struct KernSubTableHeader));
FIX_KernSubTableHeader (ksth);
{
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) &&
fprintf (stderr, " analyzing subtable %d, version %d... ",
i, ksth.version);
if ((ksth.coverage & kernHorizontal) &&
{
surely_read (fd, &kst, sizeof (struct KernSubTable0));
FIX_KernSubTable0 (kst);
{
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));
fprintf (stderr, "reading %d entries.\n", kst.nPairs);
nke[i] = kst.nPairs;
ke[i] = mymalloc (kst.nPairs * sizeof (struct KernEntry0));
+ if (ttf_verbosity >= 2)
fprintf (stderr, "skipping.\n");
surely_lseek (fd, ksth.length - sizeof (struct KernSubTableHeader),
SEEK_CUR);
fprintf (stderr, "skipping.\n");
surely_lseek (fd, ksth.length - sizeof (struct KernSubTableHeader),
SEEK_CUR);
#include "types.h"
#include "proto.h"
#include "types.h"
#include "proto.h"
-#define ALIAS_FILE_TO_FILECOOKIE
-
#include "libc-extension.hh"
#define CHUNKSIZE 65534
#include "libc-extension.hh"
#define CHUNKSIZE 65534
default:
if (postType != 1)
{
default:
if (postType != 1)
{
+ if (ttf_verbosity > -2)
fprintf (stderr,
"No glyph name table; assuming MacGlyphEncoding\n");
}
fprintf (stderr,
"No glyph name table; assuming MacGlyphEncoding\n");
}
static void endianness_test (void);
static void usage (char *);
static void endianness_test (void);
static void usage (char *);
void
create_type42 (const char *infile, void *out)
void
create_type42 (const char *infile, void *out)
}
td = readDirectory (fd, &ot);
}
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++)
{
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,
fprintf (stderr, "Found `%c%c%c%c' table\n",
(char) (td[i].tag >> 24),
(char) (td[i].tag >> 16) & 255,
if (maxpOff == 0 || headOff == 0 || postOff == 0 || nameOff == 0)
ttf_error ("Incomplete TTF file\n");
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);
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);
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);
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, &gnt);
fprintf (stderr, "Processing `post' table\n");
surely_lseek (fd, postOff, SEEK_SET);
pt = mymalloc (sizeof (struct PostTable));
postType = readPostTable (fd, nglyphs, pt, &gnt);
+ if (ttf_verbosity >= 1)
fprintf (stderr, "Processing `name' table\n");
surely_lseek (fd, nameOff, SEEK_SET);
strings = readNamingTable (fd);
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, gnt, fd);
lily_cookie_fclose (out);
fprintf (stderr, "Generating PS file\n");
printPSFont (out, ht, strings, nglyphs, postType, pt, gnt, fd);
lily_cookie_fclose (out);
+ if (ttf_verbosity >= 1)
fprintf (stderr, "Done.\n");
close (fd);
}
fprintf (stderr, "Done.\n");
close (fd);
}
#include "types.h"
#include "proto.h"
#include "types.h"
#include "proto.h"
#include "libc-extension.hh"
#include "libc-extension.hh"
ssize_t
surely_read (int fildes, void *buf, size_t nbyte)
{
ssize_t
surely_read (int fildes, void *buf, size_t nbyte)
{
+ if (ttf_verbosity >= 3)
+ fprintf (stderr, "Reading %d bytes\n", nbyte);
+
ssize_t n;
if ((n = read (fildes, buf, nbyte)) < nbyte)
{
char s[100];
sprintf (s, "read too little in surely_read(), expect %d got %d", nbyte, n);
ssize_t n;
if ((n = read (fildes, buf, nbyte)) < nbyte)
{
char s[100];
sprintf (s, "read too little in surely_read(), expect %d got %d", nbyte, n);
+ sprintf (s, "trying again yields %d", read (fildes, buf, nbyte - n));
+ syserror (s);