Make ps_token() more generally available and use it to improve the formatting
authorben <ben@cda61777-01e9-0310-a592-d414129be87e>
Tue, 6 Feb 2007 23:01:42 +0000 (23:01 +0000)
committerben <ben@cda61777-01e9-0310-a592-d414129be87e>
Tue, 6 Feb 2007 23:01:42 +0000 (23:01 +0000)
of Type 42 fonts.

git-svn-id: svn://svn.tartarus.org/sgt/halibut@7245 cda61777-01e9-0310-a592-d414129be87e

bk_ps.c
in_sfnt.c
paper.h

diff --git a/bk_ps.c b/bk_ps.c
index a3d80a7..452d562 100644 (file)
--- a/bk_ps.c
+++ b/bk_ps.c
@@ -13,7 +13,6 @@
 #define PS_MAXWIDTH 255
 
 static void ps_comment(FILE *fp, char const *leader, word *words);
-static void ps_token(FILE *fp, int *cc, char const *fmt, ...);
 static void ps_string_len(FILE *fp, int *cc, char const *str, int len);
 static void ps_string(FILE *fp, int *cc, char const *str);
 
@@ -352,7 +351,7 @@ static void ps_comment(FILE *fp, char const *leader, word *words) {
     fprintf(fp, "\n");
 }
 
-static void ps_token(FILE *fp, int *cc, char const *fmt, ...) {
+void ps_token(FILE *fp, int *cc, char const *fmt, ...) {
     va_list ap;
 
     va_start(ap, fmt);
index a9108e8..346602b 100644 (file)
--- a/in_sfnt.c
+++ b/in_sfnt.c
@@ -656,6 +656,7 @@ void sfnt_writeps(font_info const *fi, FILE *ofp) {
     size_t *breaks, glyfoff, glyflen;
     void *glyfptr, *glyfend, *locaptr, *locaend;
     unsigned *loca;
+    int cc = 0;
 
     /* XXX Unclear that this is the correct format. */
     fprintf(ofp, "%%!PS-TrueTypeFont-%u-%u\n", sf->osd.scaler_type,
@@ -686,8 +687,8 @@ void sfnt_writeps(font_info const *fi, FILE *ofp) {
     fprintf(ofp, "0 1 %u{currentfile token pop exch def}bind for\n",
        sf->nglyphs - 1);
     for (i = 0; i < sf->nglyphs; i++)
-       fprintf(ofp, "/%s\n", glyph_extern(sfnt_indextoglyph(sf, i)));
-    fprintf(ofp, "end readonly def\n");
+       ps_token(ofp, &cc, "/%s", glyph_extern(sfnt_indextoglyph(sf, i)));
+    fprintf(ofp, "\nend readonly def\n");
     fprintf(ofp, "/sfnts [<");
     breaks = snewn(sf->osd.numTables + sf->nglyphs, size_t);
     for (i = 0; i < sf->osd.numTables; i++) {
diff --git a/paper.h b/paper.h
index 0f45b89..b68fd5f 100644 (file)
--- a/paper.h
+++ b/paper.h
@@ -398,6 +398,11 @@ const kern_pair *ps_std_font_kerns(char const *fontname);
 char *pdf_outline_convert(wchar_t *s, int *len);
 
 /*
+ * Function exported from bk_ps.c
+ */
+void ps_token(FILE *fp, int *cc, char const *fmt, ...);
+
+/*
  * Backend functions exported by in_pf.c
  */
 void pf_part1(font_info *fi, char **bufp, size_t *lenp);