diff options
author | Russ Cox <rsc@swtch.com> | 2008-01-31 16:58:38 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2008-01-31 16:58:38 -0500 |
commit | 9daa3ca74ebd673d00ba52667c50fe4a0046d100 (patch) | |
tree | 1a0f6d6c860f6dbd9cd26223f1a40914ead10013 /src/cmd/postscript | |
parent | 57a6108c76c357cd4f71c26c84baec92a9fb91b5 (diff) | |
download | plan9port-9daa3ca74ebd673d00ba52667c50fe4a0046d100.tar.gz plan9port-9daa3ca74ebd673d00ba52667c50fe4a0046d100.tar.bz2 plan9port-9daa3ca74ebd673d00ba52667c50fe4a0046d100.zip |
tr2post: rename charlib files to not be case-dependent (OS X)
Diffstat (limited to 'src/cmd/postscript')
-rw-r--r-- | src/cmd/postscript/tr2post/mkfile | 4 | ||||
-rw-r--r-- | src/cmd/postscript/tr2post/test.tr | 65 | ||||
-rw-r--r-- | src/cmd/postscript/tr2post/tr2post.c | 23 |
3 files changed, 90 insertions, 2 deletions
diff --git a/src/cmd/postscript/tr2post/mkfile b/src/cmd/postscript/tr2post/mkfile index 4a5f47d4..2c716c1b 100644 --- a/src/cmd/postscript/tr2post/mkfile +++ b/src/cmd/postscript/tr2post/mkfile @@ -36,3 +36,7 @@ CFLAGS=$CFLAGS -c -D'PROGRAMVERSION="0.1"' -D'DOROUND=1' -I$COMMONDIR %.$O: $COMMONDIR/%.c $CC $CFLAGS $COMMONDIR/$stem.c + +test.ps:V: $O.tr2post + 9 troff -ms test.tr | $O.tr2post | psfonts >test.ps + diff --git a/src/cmd/postscript/tr2post/test.tr b/src/cmd/postscript/tr2post/test.tr new file mode 100644 index 00000000..6702a5ed --- /dev/null +++ b/src/cmd/postscript/tr2post/test.tr @@ -0,0 +1,65 @@ +.fp 8 S +~= \f8\(~=\fP +.sp +☺ +.sp +12 \(12 +.sp +14 \(14 +.sp +34 \(34 +.sp +bx \(bx +.sp +ci \fS\(ci\fP +.sp +DG \(DG +.sp +FA \(FA +.sp +.ig +ff \(ff +.sp +Fi \f7\(Fi\fP +.sp +Fl \(Fl +.sp +.. +L1 \(L1 +.sp +LA \(LA +.sp +lc \(lc +.sp +lf \(lf +.sp +lh \(lh +.sp +lH \(lH +.sp +LH \(LH +.sp +LV \(LV +.sp +ob \(ob +.sp +PC \(PC +.sp +pw \(pw +.sp +rc \(rc +.sp +.ig +RC \(RC +.sp +.. +rf \(rf +.sp +rh \(rh +.sp +rH \(rH +.sp +Sl \(Sl +.sp +sq \(sq +.sp diff --git a/src/cmd/postscript/tr2post/tr2post.c b/src/cmd/postscript/tr2post/tr2post.c index 5a22ac72..5ca1b328 100644 --- a/src/cmd/postscript/tr2post/tr2post.c +++ b/src/cmd/postscript/tr2post/tr2post.c @@ -85,9 +85,28 @@ prologues(void) { /* output Build character info from charlib if necessary. */ for (i=0; i<build_char_cnt; i++) { - sprint(charlibname, "%s/%s", CHARLIB, build_char_list[i]->name); + // Rewrite file name for case-insensitive or non-UTF-8 file systems. + // _x means a lowercase x; #1234 means Unicode 0x1234. + char buf[100]; + char *r, *w; + for(w=buf, r=build_char_list[i]->name; *r && w<buf+sizeof buf-8; ){ + if((uchar)*r >= 0x80){ + Rune rr; + r += chartorune(&rr, r); + sprint(w, "#%04x", rr); + w += strlen(w); + continue; + } + if(('a' <= *r && *r <= 'z') || *r == '_') + *w++ = '_'; + if(*r == '#') + *w++ = '#'; + *w++ = *r++; + } + *w = 0; + sprint(charlibname, "%s/%s", CHARLIB, buf); if (cat(unsharp(charlibname))) - Bprint(Bstderr, "cannot open %s\n", charlibname); + Bprint(Bstderr, "cannot open %s\n", charlibname); } Bprint(Bstdout, "%s", ENDSETUP); |