CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/06/09 16:45:47
Modified files:
. : ChangeLog
lily : pfb.cc program-option.cc
ttftool : parse.c ps.c ttfps.c util.c
ttftool/include: proto.h ttftool.h
Log message:
* 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.
* lily/program-option.cc: rename from scm-option.cc
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3749&tr2=1.3750&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/pfb.cc.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/program-option.cc.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/parse.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/ps.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/ttfps.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/util.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/include/proto.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/include/ttftool.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3749 lilypond/ChangeLog:1.3750
--- lilypond/ChangeLog:1.3749 Thu Jun 9 14:09:30 2005
+++ lilypond/ChangeLog Thu Jun 9 16:45:46 2005
@@ -1,5 +1,13 @@
2005-06-09 Han-Wen Nienhuys <[EMAIL PROTECTED]>
+ * 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.
Index: lilypond/lily/pfb.cc
diff -u lilypond/lily/pfb.cc:1.15 lilypond/lily/pfb.cc:1.16
--- lilypond/lily/pfb.cc:1.15 Mon Jun 6 14:27:42 2005
+++ lilypond/lily/pfb.cc Thu Jun 9 16:45:47 2005
@@ -10,13 +10,14 @@
#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"
-
+
char *
pfb2pfa (Byte const *pfb, int length)
{
@@ -111,6 +112,9 @@
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 ());
@@ -146,3 +150,4 @@
return asscm;
}
+
Index: lilypond/lily/program-option.cc
diff -u lilypond/lily/program-option.cc:1.1 lilypond/lily/program-option.cc:1.2
--- lilypond/lily/program-option.cc:1.1 Thu Jun 9 14:09:33 2005
+++ lilypond/lily/program-option.cc Thu Jun 9 16:45:47 2005
@@ -53,6 +53,8 @@
"include book-titles in preview images."},
{"gs-font-load", "#f",
"load fonts via Ghostscript."},
+ {"ttf-verbosity", "0",
+ "how much verbosity for TTF font embedding?"},
{0,0,0},
};
Index: lilypond/ttftool/include/proto.h
diff -u lilypond/ttftool/include/proto.h:1.3
lilypond/ttftool/include/proto.h:1.4
--- lilypond/ttftool/include/proto.h:1.3 Wed Jun 8 13:07:11 2005
+++ lilypond/ttftool/include/proto.h Thu Jun 9 16:45:47 2005
@@ -1,7 +1,5 @@
/* Copyright (c) 1997-1998 by Juliusz Chroboczek */
-extern int verbosity;
-
struct TableDirectoryEntry *readDirectory (int fd, struct OffsetTable *ot);
char **readNamingTable (int fd);
void readHeadTable (int fd, struct HeadTable *ht);
Index: lilypond/ttftool/include/ttftool.h
diff -u lilypond/ttftool/include/ttftool.h:1.3
lilypond/ttftool/include/ttftool.h:1.4
--- lilypond/ttftool/include/ttftool.h:1.3 Wed Jun 8 13:07:11 2005
+++ lilypond/ttftool/include/ttftool.h Thu Jun 9 16:45:47 2005
@@ -5,6 +5,8 @@
void create_type42 (char const *, void *);
+ extern int ttf_verbosity;
+
#ifdef __cplusplus
}
#endif
Index: lilypond/ttftool/parse.c
diff -u lilypond/ttftool/parse.c:1.5 lilypond/ttftool/parse.c:1.6
--- lilypond/ttftool/parse.c:1.5 Wed Jun 8 13:07:11 2005
+++ lilypond/ttftool/parse.c Thu Jun 9 16:45:47 2005
@@ -4,8 +4,11 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+
#include "types.h"
#include "proto.h"
+#include "ttftool.h"
struct TableDirectoryEntry *
readDirectory (int fd, struct OffsetTable *ot)
@@ -14,9 +17,12 @@
int i;
struct TableDirectoryEntry *td;
+ if (ttf_verbosity >= 3)
+ fprintf (stderr, "");
+
surely_read (fd, ot, sizeof (struct OffsetTable));
FIX_OffsetTable (*ot);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, "%d tables\n", ot->numTables);
n = sizeof (struct TableDirectoryEntry) * ot->numTables;
td = mymalloc (n);
@@ -77,7 +83,7 @@
strings[records[i].nameID] = mymalloc (records[i].length / 2 + 1);
unistrncpy (strings[records[i].nameID],
data + records[i].offset, records[i].length);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, "%d: %s\n", records[i].nameID,
strings[records[i].nameID]);
}
@@ -97,7 +103,7 @@
strncpy (strings[id],
data + records[i].offset, records[i].length);
strings[id][records[i].length] = 0;
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, "%d: %s\n", records[i].nameID,
strings[records[i].nameID]);
}
@@ -119,7 +125,7 @@
surely_read (fd, &data, sizeof (data));
FIX_Fixed (data.version);
FIX_UH (data.nglyphs);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, " version %d.%u\n",
data.version.mantissa, data.version.fraction);
return data.nglyphs;
@@ -130,7 +136,7 @@
{
surely_read (fd, ht, sizeof (struct HeadTable));
FIX_HeadTable (*ht);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
{
fprintf (stderr, " version %d.%d\n",
ht->version.mantissa, ht->version.fraction);
@@ -139,7 +145,7 @@
}
if (ht->magicNumber != 0x5F0F3CF5)
ttf_error ("Bad magic number");
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, " %d units per Em\n", ht->unitsPerEm);
}
@@ -156,7 +162,7 @@
surely_read (fd, pt, sizeof (struct PostTable));
FIX_PostTable (*pt);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, " format type %d.%u\n",
pt->formatType.mantissa, pt->formatType.fraction);
@@ -171,7 +177,7 @@
FIX_UH (nglyphspost);
if (nglyphspost != nglyphs)
ttf_error ("Inconsistency between `maxp' and `nglyphs' tables!");
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, " %d glyphs\n", nglyphs);
glyphNameIndex = mymalloc (sizeof (USHORT) * nglyphs);
surely_read (fd, glyphNameIndex, sizeof (USHORT) * nglyphs);
@@ -203,7 +209,7 @@
glyphNamesTemp[i] = mymalloc (c + 1);
surely_read (fd, glyphNamesTemp[i], c);
glyphNamesTemp[i][c] = '\0';
- if (verbosity >= 3)
+ if (ttf_verbosity >= 3)
fprintf (stderr, " %d: %s\n", i, glyphNamesTemp[i]);
i++;
}
@@ -294,7 +300,7 @@
hhea = mymalloc (sizeof (struct HheaTable));
surely_read (fd, hhea, sizeof (struct HheaTable));
FIX_HheaTable (*hhea);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, " version %d.%u\n",
hhea->version.mantissa, hhea->version.fraction);
if (hhea->metricDataFormat != 0)
@@ -314,7 +320,7 @@
surely_read (fd, &kt, sizeof (struct KernTable));
FIX_KernTable (kt);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
{
fprintf (stderr, " version %d\n", kt.version);
fprintf (stderr, " %d subtables\n", kt.nTables);
@@ -326,7 +332,7 @@
{
surely_read (fd, &ksth, sizeof (struct KernSubTableHeader));
FIX_KernSubTableHeader (ksth);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, " analyzing subtable %d, version %d... ",
i, ksth.version);
if ((ksth.coverage & kernHorizontal) &&
@@ -336,7 +342,7 @@
{
surely_read (fd, &kst, sizeof (struct KernSubTable0));
FIX_KernSubTable0 (kst);
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, "reading %d entries.\n", kst.nPairs);
nke[i] = kst.nPairs;
ke[i] = mymalloc (kst.nPairs * sizeof (struct KernEntry0));
@@ -346,7 +352,7 @@
}
else
{
- if (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, "skipping.\n");
surely_lseek (fd, ksth.length - sizeof (struct KernSubTableHeader),
SEEK_CUR);
Index: lilypond/ttftool/ps.c
diff -u lilypond/ttftool/ps.c:1.6 lilypond/ttftool/ps.c:1.7
--- lilypond/ttftool/ps.c:1.6 Mon Jun 6 14:27:42 2005
+++ lilypond/ttftool/ps.c Thu Jun 9 16:45:47 2005
@@ -7,8 +7,7 @@
#include "types.h"
#include "proto.h"
-#define ALIAS_FILE_TO_FILECOOKIE
-
+#include "ttftool.h"
#include "libc-extension.hh"
#define CHUNKSIZE 65534
@@ -141,7 +140,7 @@
default:
if (postType != 1)
{
- if (verbosity > -2)
+ if (ttf_verbosity > -2)
fprintf (stderr,
"No glyph name table; assuming MacGlyphEncoding\n");
}
Index: lilypond/ttftool/ttfps.c
diff -u lilypond/ttftool/ttfps.c:1.7 lilypond/ttftool/ttfps.c:1.8
--- lilypond/ttftool/ttfps.c:1.7 Thu Jun 9 10:45:18 2005
+++ lilypond/ttftool/ttfps.c Thu Jun 9 16:45:47 2005
@@ -13,7 +13,7 @@
static void endianness_test (void);
static void usage (char *);
-int verbosity = 0;
+int ttf_verbosity = 0;
void
create_type42 (const char *infile, void *out)
@@ -47,13 +47,13 @@
}
td = readDirectory (fd, &ot);
- if (verbosity >= 2)
+ 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 (verbosity >= 2)
+ if (ttf_verbosity >= 2)
fprintf (stderr, "Found `%c%c%c%c' table\n",
(char) (td[i].tag >> 24),
(char) (td[i].tag >> 16) & 255,
@@ -92,35 +92,35 @@
if (maxpOff == 0 || headOff == 0 || postOff == 0 || nameOff == 0)
ttf_error ("Incomplete TTF file\n");
- if (verbosity >= 1)
+ if (ttf_verbosity >= 1)
fprintf (stderr, "Processing `maxp' table\n");
surely_lseek (fd, maxpOff, SEEK_SET);
nglyphs = readMaxpTable (fd);
- if (verbosity >= 1)
+ if (ttf_verbosity >= 1)
fprintf (stderr, " %d glyphs\n", nglyphs);
- if (verbosity >= 1)
+ 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 (verbosity >= 1)
+ 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);
- if (verbosity >= 1)
+ if (ttf_verbosity >= 1)
fprintf (stderr, "Processing `name' table\n");
surely_lseek (fd, nameOff, SEEK_SET);
strings = readNamingTable (fd);
- if (verbosity >= 1)
+ if (ttf_verbosity >= 1)
fprintf (stderr, "Generating PS file\n");
printPSFont (out, ht, strings, nglyphs, postType, pt, gnt, fd);
lily_cookie_fclose (out);
- if (verbosity >= 1)
+ if (ttf_verbosity >= 1)
fprintf (stderr, "Done.\n");
close (fd);
}
Index: lilypond/ttftool/util.c
diff -u lilypond/ttftool/util.c:1.8 lilypond/ttftool/util.c:1.9
--- lilypond/ttftool/util.c:1.8 Thu Jun 9 10:45:18 2005
+++ lilypond/ttftool/util.c Thu Jun 9 16:45:47 2005
@@ -9,9 +9,8 @@
#include "types.h"
#include "proto.h"
-
#include "libc-extension.hh"
-
+#include "ttftool.h"
void *
@@ -75,12 +74,16 @@
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);
- syserror (s);
+ sprintf (s, "trying again yields %d", read (fildes, buf, nbyte - n));
+ syserror (s);
}
return n;
}
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs