summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2007-02-06 23:01:42 +0000
committerBen Harris <bjh21@bjh21.me.uk>2007-02-06 23:01:42 +0000
commitb5a4f7b65579a789743e5c039c7286cc9d8e24a1 (patch)
treeb075bcd73b319d0055ac1f82ee28eb8f73663942
parent6c294ec3bd944320be32cfd1d93397c2f64350e8 (diff)
downloadhalibut-b5a4f7b65579a789743e5c039c7286cc9d8e24a1.zip
halibut-b5a4f7b65579a789743e5c039c7286cc9d8e24a1.tar.gz
halibut-b5a4f7b65579a789743e5c039c7286cc9d8e24a1.tar.bz2
halibut-b5a4f7b65579a789743e5c039c7286cc9d8e24a1.tar.xz
Make ps_token() more generally available and use it to improve the formatting
of Type 42 fonts. [originally from svn r7245]
-rw-r--r--bk_ps.c3
-rw-r--r--in_sfnt.c5
-rw-r--r--paper.h5
3 files changed, 9 insertions, 4 deletions
diff --git a/bk_ps.c b/bk_ps.c
index a3d80a7..452d562 100644
--- 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);
diff --git a/in_sfnt.c b/in_sfnt.c
index a9108e8..346602b 100644
--- 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
--- 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);