CVSROOT: /cvsroot/lilypond Module name: lilypond Branch: Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/06/21 22:05:51
Modified files: . : ChangeLog ttftool : parse.c ps.c ttfps.c ttftool/include: proto.h Log message: (readPostTable): ugh. Kludge: nglyphs in maxp and post table may differ. Pass around post_nglyphs as well. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3802&tr2=1.3803&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/parse.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/ps.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/ttfps.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/include/proto.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text Patches: Index: lilypond/ChangeLog diff -u lilypond/ChangeLog:1.3802 lilypond/ChangeLog:1.3803 --- lilypond/ChangeLog:1.3802 Tue Jun 21 21:43:35 2005 +++ lilypond/ChangeLog Tue Jun 21 22:05:44 2005 @@ -1,3 +1,8 @@ +2005-06-22 Han-Wen Nienhuys <[EMAIL PROTECTED]> + + * ttftool/parse.c (readPostTable): ugh. Kludge: nglyphs in maxp + and post table may differ. Pass around post_nglyphs as well. + 2005-06-20 Han-Wen Nienhuys <[EMAIL PROTECTED]> * ly/music-functions-init.ly (musicMap): new music function Index: lilypond/ttftool/include/proto.h diff -u lilypond/ttftool/include/proto.h:1.5 lilypond/ttftool/include/proto.h:1.6 --- lilypond/ttftool/include/proto.h:1.5 Sun Jun 12 16:33:21 2005 +++ lilypond/ttftool/include/proto.h Tue Jun 21 22:05:51 2005 @@ -3,8 +3,9 @@ struct TableDirectoryEntry *readDirectory (FILE *fd, struct OffsetTable *ot); char **readNamingTable (FILE *fd); void readHeadTable (FILE *fd, struct HeadTable *ht); -int readPostTable (FILE *fd, int nglyphs, - struct PostTable *pt, struct GlyphName **gnt); +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); @@ -14,13 +15,15 @@ void printPSFont (void * out, struct HeadTable *ht, char **strings, int nglyphs, int postType, - struct PostTable *pt, struct GlyphName *gnt, FILE *fd); + 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, struct GlyphName *gnt); + int postType, USHORT pnt, struct GlyphName *gnt); void printAFM (FILE * afm, struct HeadTable *ht, char **strings, int nglyphs, int postType, Index: lilypond/ttftool/parse.c diff -u lilypond/ttftool/parse.c:1.9 lilypond/ttftool/parse.c:1.10 --- lilypond/ttftool/parse.c:1.9 Tue Jun 21 21:43:36 2005 +++ lilypond/ttftool/parse.c Tue Jun 21 22:05:51 2005 @@ -1,5 +1,9 @@ /* Copyright (c) 1997-1998 by Juliusz Chroboczek */ +/* + TODO: junk this in favor of Freetype. + */ + #include <sys/types.h> #include <unistd.h> #include <stdio.h> @@ -150,15 +154,15 @@ int readPostTable (FILE *fd, int root_nglyphs, struct PostTable *pt, - struct GlyphName **gt) + USHORT *nglyphs, struct GlyphName **gt) { - USHORT nglyphs; 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) @@ -172,7 +176,7 @@ case 2: if (pt->formatType.fraction != 0) ttf_error ("Unsupported `post' table format"); - surely_read (fd, &nglyphs, sizeof (USHORT)); + surely_read (fd, nglyphs, sizeof (USHORT)); /*from freetype2: */ @@ -180,18 +184,18 @@ 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) + 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++) + 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) @@ -222,7 +226,7 @@ fprintf (stderr, " %d: %s\n", i, glyphNamesTemp[i]); i++; } - for (i = 0; i < nglyphs; i++) + for (i = 0; i < *nglyphs; i++) if (glyphNames[i].type == 1) glyphNames[i].name.name = glyphNamesTemp[glyphNames[i].name.index]; free (glyphNamesTemp); Index: lilypond/ttftool/ps.c diff -u lilypond/ttftool/ps.c:1.9 lilypond/ttftool/ps.c:1.10 --- lilypond/ttftool/ps.c:1.9 Sun Jun 12 18:42:49 2005 +++ lilypond/ttftool/ps.c Tue Jun 21 22:05:51 2005 @@ -24,11 +24,13 @@ void printPSFont (void *out, struct HeadTable *ht, char **strings, int nglyphs, int postType, - struct PostTable *pt, struct GlyphName *gnt, FILE *fd) + struct PostTable *pt, + USHORT post_nglyphs, + struct GlyphName *gnt, FILE *fd) { printPSHeader (out, ht, strings, pt); printPSData (out, fd); - printPSTrailer (out, nglyphs, postType, gnt); + printPSTrailer (out, nglyphs, post_nglyphs, postType, gnt); } void @@ -115,7 +117,8 @@ } void -printPSTrailer (void *out, int nglyphs, int postType, struct GlyphName *gnt) +printPSTrailer (void *out, int nglyphs, int postType, + USHORT postNGlyphs, struct GlyphName *gnt) { int i, n; char *name; Index: lilypond/ttftool/ttfps.c diff -u lilypond/ttftool/ttfps.c:1.9 lilypond/ttftool/ttfps.c:1.10 --- lilypond/ttftool/ttfps.c:1.9 Sun Jun 12 16:33:21 2005 +++ lilypond/ttftool/ttfps.c Tue Jun 21 22:05:51 2005 @@ -30,6 +30,7 @@ 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, @@ -109,7 +110,8 @@ fprintf (stderr, "Processing `post' table\n"); surely_lseek (fd, postOff, SEEK_SET); pt = mymalloc (sizeof (struct PostTable)); - postType = readPostTable (fd, nglyphs, pt, &gnt); + + postType = readPostTable (fd, nglyphs, pt, &post_nglyphs, &gnt); if (ttf_verbosity >= 1) fprintf (stderr, "Processing `name' table\n"); @@ -118,7 +120,7 @@ if (ttf_verbosity >= 1) fprintf (stderr, "Generating PS file\n"); - printPSFont (out, ht, strings, nglyphs, postType, pt, gnt, fd); + printPSFont (out, ht, strings, nglyphs, postType, pt, post_nglyphs, gnt, fd); lily_cookie_fclose (out); if (ttf_verbosity >= 1) fprintf (stderr, "Done.\n"); _______________________________________________ Lilypond-cvs mailing list Lilypond-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-cvs