Article View: comp.lang.postscript
Article #3210Re: unAdobe & unMac (was: downloadable font formats)
From: Paul Nash
Date: Thu, 27 Sep 1990 22:06
Date: Thu, 27 Sep 1990 22:06
109 lines
3607 bytes
3607 bytes
paul@frcs.UUCP (Paul Nash) writes:
>In response to a number of requests for unAdobe for the MAC
>(which Robert sent to me) and my own unMac for the PC, I
>have posted both to the net.
However, I have finally managed to lay my hands on a genuine
PostScript printer, and found that the generated fonts did
not work :-(. I have fixed the bugs in unMac, so here is
the new, improved, unMac version 1.1.
Just to recap (for those who tuned in late), unMac is a PC
program to convert PostScribble fonts in Mac format into
straight ASCII format. The fonts are stored in the resource
fork of the Mac file, which can be copied off with the
Dayna `dosmount' utility. This program converts such a
DOS version of a resource fork into an ASCII file. It works
on a Qume Scripten, with various Adobe (TM) fonts.
/*
An extremely quick and nasty hack to convert the DOS version of a MAC
resource containing an Adobe font (whew!) copied with ``dosmount'',
into something that I can download to a laser printer from anything.
Copyright (c) Flagship, 1990. Use at your own risk.
*/
#include <stdio.h>
#include <stdlib.h>
main ( int argc, char *argv[] )
{
FILE *inf, *outf;
int i;
int ch;
union LENGTH {
char c[4];
long l;
} length;
union BIT {
char c[2];
int i;
} bit;
if ( argc != 3 ) {
fprintf( stderr, "Wrong! UnMac macresource pcfont\n" );
exit( -1 );
}
if ( ( inf = fopen( argv[1], "rb" ) ) == NULL ) {
fprintf( stderr, "Can't open input %s\n", argv[1] );
exit( -2 );
}
if ( ( outf = fopen( argv[2], "w" ) ) == NULL ) {
fprintf( stderr, "Can't open output %s\n", argv[2] );
fclose( inf );
exit( -2 );
}
printf( "OK, reading MAC resource %s, writing PC postscript %s\n",
argv[1], argv[2] );
fseek( inf, 0x100L, SEEK_SET ); /* skip the first bit */
while ( 1 == 1 ) {
for ( i = 3; i >= 0; i-- )
length.c[i] = (char) fgetc( inf );
for ( i = 1; i >= 0; i-- )
bit.c[i] = (char) fgetc( inf );
printf( "Reading bit 0x%02X, length %li (0x%04lX)\n",
bit.i, length.l, length.l );
if ( bit.i == 0x500 || length.l == 2 ) {
printf( "Finished!\n" );
break;
}
if ( length.l < 2 ) {
printf( "Fuck off! I can't go _backwards_ ...\n" );
exit( -2 );
}
length.l -=2;
i = 0;
while ( length.l-- > 0 ) {
ch = fgetc( inf );
if ( bit.i == 256 ) {
if ( ch == '\r' ) fputc( '\n' , outf );
else fputc( ch, outf );
}
else if ( bit.i == 512 ) {
fprintf( outf, "%02X", ch );
if ( ++i > 38 ) {
fputc( '\n', outf );
i = 0;
}
}
else {
printf( "Shit! unknown ``bit'' type -- aborting\n" );
exit( -1 );
}
}
fputc( '\n', outf ); fputc( '\n', outf );
}
fclose( inf ); fclose( outf );
return 0;
}
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Paul Nash Flagship Wide Area Networks (Pty) Ltd
paul@frcs.UUCP ...!ddsw1!proxima!frcs!paul
Technical Details
Message-ID:
<99@frcs.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!mintaka!olivea!orc!inews!iwarp.intel.com!gargoyle!ddsw1!olsa99!frcs!paulReferences:
<88@frcs.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!mintaka!olivea!orc!inews!iwarp.intel.com!gargoyle!ddsw1!olsa99!frcs!paul From: paul@frcs.UUCP (Paul Nash) Newsgroups: comp.lang.postscript Subject: Re: unAdobe & unMac (was: downloadable font formats) Message-ID: <99@frcs.UUCP> Date: 27 Sep 90 22:06:56 GMT References: <88@frcs.UUCP> Distribution: comp Organization: Flagship Wide Area Networks (Pty) Ltd Lines: 110