Alexandre Julliard : Avoid outputting trailing spaces in sfd files.

Alexandre Julliard julliard at winehq.org
Fri Feb 20 13:12:02 CST 2009


Module: fontforge
Branch: master
Commit: 37fa1cd216930f21081059b7e8b5bf9473711340
URL:    http://source.winehq.org/git/fontforge.git/?a=commit;h=37fa1cd216930f21081059b7e8b5bf9473711340

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Feb 20 19:17:13 2009 +0100

Avoid outputting trailing spaces in sfd files.

---

 fontforge/sfd.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/fontforge/sfd.c b/fontforge/sfd.c
index adb7481..9d5f2a2 100644
--- a/fontforge/sfd.c
+++ b/fontforge/sfd.c
@@ -191,7 +191,6 @@ static void SFDDumpUTF7Str(FILE *sfd, const char *_str) {
 	utf7_encode(sfd,prev);
     }
     putc('"',sfd);
-    putc(' ',sfd);
 }
 
 
@@ -701,7 +700,7 @@ static void SFDDumpAnchorPoints(FILE *sfd,SplineChar *sc) {
     for ( ap = sc->anchor; ap!=NULL; ap=ap->next ) {
 	fprintf( sfd, "AnchorPoint: " );
 	SFDDumpUTF7Str(sfd,ap->anchor->name);
-	fprintf( sfd, "%g %g %s %d",
+	fprintf( sfd, " %g %g %s %d",
 		(double) ap->me.x, (double) ap->me.y,
 		ap->type==at_centry ? "entry" :
 		ap->type==at_cexit ? "exit" :
@@ -1382,7 +1381,10 @@ static void SFDDumpChar(FILE *sfd,SplineChar *sc,EncMap *map,int *newgids) {
 		    "LCarets2:", NULL };
 	    fprintf( sfd, "%s ", keywords[pst->type] );
 	    if ( pst->subtable!=NULL )
+	    {
 		SFDDumpUTF7Str(sfd,pst->subtable->subtable_name );
+		putc(' ',sfd);
+	    }
 	    if ( pst->type==pst_position ) {
 		fprintf( sfd, "dx=%d dy=%d dh=%d dv=%d",
 			pst->u.pos.xoff, pst->u.pos.yoff,
@@ -1408,9 +1410,9 @@ static void SFDDumpChar(FILE *sfd,SplineChar *sc,EncMap *map,int *newgids) {
 		putc('\n',sfd);
 	    } else if ( pst->type==pst_lcaret ) {
 		int i;
-		fprintf( sfd, "%d ", pst->u.lcaret.cnt );
+		fprintf( sfd, "%d", pst->u.lcaret.cnt );
 		for ( i=0; i<pst->u.lcaret.cnt; ++i )
-		    fprintf( sfd, "%d ", pst->u.lcaret.carets[i] );
+		    fprintf( sfd, " %d", pst->u.lcaret.carets[i] );
 		fprintf( sfd, "\n" );
 	    } else
 		fprintf( sfd, "%s\n", pst->u.lig.components );
@@ -1515,8 +1517,12 @@ static int SFDDumpBitmapFont(FILE *sfd,BDFFont *bdf,EncMap *encm,int *newgids,
     int err = false;
 
     ff_progress_next_stage();
-    fprintf( sfd, "BitmapFont: %d %d %d %d %d %s\n", bdf->pixelsize, bdf->glyphcnt,
-	    bdf->ascent, bdf->descent, BDFDepth(bdf), bdf->foundry?bdf->foundry:"" );
+    if (bdf->foundry)
+        fprintf( sfd, "BitmapFont: %d %d %d %d %d %s\n", bdf->pixelsize, bdf->glyphcnt,
+                 bdf->ascent, bdf->descent, BDFDepth(bdf), bdf->foundry );
+    else
+        fprintf( sfd, "BitmapFont: %d %d %d %d %d\n", bdf->pixelsize, bdf->glyphcnt,
+                 bdf->ascent, bdf->descent, BDFDepth(bdf) );
     if ( bdf->prop_cnt>0 ) {
 	fprintf( sfd, "BDFStartProperties: %d\n", bdf->prop_cnt );
 	for ( i=0; i<bdf->prop_cnt; ++i ) {
@@ -1574,10 +1580,13 @@ static void SFDDumpPrivate(FILE *sfd,struct psdict *private) {
 
 static void SFDDumpLangName(FILE *sfd, struct ttflangname *ln) {
     int i, end;
-    fprintf( sfd, "LangName: %d ", ln->lang );
+    fprintf( sfd, "LangName: %d", ln->lang );
     for ( end = ttf_namemax; end>0 && ln->names[end-1]==NULL; --end );
     for ( i=0; i<end; ++i )
+    {
+	putc(' ',sfd);
 	SFDDumpUTF7Str(sfd,ln->names[i]);
+    }
     putc('\n',sfd);
 }
 
@@ -1914,10 +1923,10 @@ static int SFD_Dump(FILE *sfd,SplineFont *sf,EncMap *map,EncMap *normal,
 	for ( i=1; i<sf->mark_class_cnt; ++i ) {	/* Class 0 is unused */
 	    SFDDumpUTF7Str(sfd, sf->mark_class_names[i]);
 	    if ( sf->mark_classes[i]!=NULL )
-		fprintf( sfd, "%d %s\n", (int) strlen(sf->mark_classes[i]),
+		fprintf( sfd, " %d %s\n", (int) strlen(sf->mark_classes[i]),
 			sf->mark_classes[i] );
 	    else
-		fprintf( sfd, "0 \n" );
+		fprintf( sfd, " 0 \n" );
 	}
     }
     fprintf( sfd, "DEI: 91125\n" );
@@ -2169,8 +2178,9 @@ static int SFD_Dump(FILE *sfd,SplineFont *sf,EncMap *map,EncMap *normal,
     }
     if ( sf->anchor!=NULL ) {
 	AnchorClass *an;
-	fprintf(sfd, "AnchorClass2: ");
+	fprintf(sfd, "AnchorClass2:");
 	for ( an=sf->anchor; an!=NULL; an=an->next ) {
+	    putc(' ',sfd);
 	    SFDDumpUTF7Str(sfd,an->name);
 	    putc(' ',sfd);
 	    SFDDumpUTF7Str(sfd,an->subtable->subtable_name );




More information about the wine-cvs mailing list