home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Computers
/
CreativeComputers.iso
/
shareware
/
text
/
dvi_3.62
/
source
/
dvisrc.lha
/
dviarexx.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-02-01
|
3KB
|
88 lines
/*
** Datei: DVIAREXX.C
** Autor: Markus Zahn
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <proto/dos.h>
#include <dos/dostags.h>
#include "dvi.h"
#include "dviarexx.h"
/* Verwendete Funktionen aus "dvirdpk.c" */
extern void fnt_pkname( char *name, char *schab, char *fn, int isize, int rsize );
extern FILE *fnt_pklocate(fnt_t *f);
extern BPTR out_handle;
FILE *fnt_arexxlocate( fnt_t *f )
{
/*
* Die Optionsvariable CALLMF kann mit einem ARexx-Script
* belegt werden, das die Fonterzeugung oder die Erstellung
* eines dazu geeigneten Batchfiles uebernimmt.
* ( analog zur PasTeX-Implementation :-)
*/
FILE *pk = NULL;
double size = (double)f->s*dvi_info.mag / 1e3 / (double)f->d;
int dbl_magstep; /* magstep * 2 um auch halbe magsteps zu erfassen */
int isize = iround( size * 1000.0 );
int rsize = iround( size * (double)op.hres );
char command[256] = "SYS:Rexxc/rx "; /* fuer das aufzurufende ARexx-Script */
char pkname[MAX_PATH_LEN];
long error;
if( *op.pk_callmf != '\0' )
{
dbl_magstep = iround( 2.0 * log( size ) / log( 1.2 ) );
if( fabs( exp( (double)dbl_magstep / 2.0 * log( 1.2 ) ) - size ) > 5e-4 )
dbl_magstep = -1;
else
{
size = exp( (double)dbl_magstep / 2.0 * log( 1.2 ) );
isize = iround( size * 1000.0 );
rsize = iround( size * (double)op.hres );
}
fnt_pkname( pkname, op.pk_path, f->n, isize, rsize );
strcat( command, op.pk_callmf );
/*
* Jetzt noch das MakePKFont.rexx Anhaengsel:
* Fontname, magstep / magnification, dpi und pkfullname
*/
if( dbl_magstep != -1 )
{
sprintf( command + strlen( command ),
" font=%s magstep=%.1lf dpi=%d hres=%d vres=%d pkfull=%s",
f->n, (double)dbl_magstep / 2.0, rsize, op.hres, op.vres, pkname );
}
else
{
sprintf( command + strlen( command ),
" font=%s mag=%.10lf dpi=%d hres=%d vres=%d pkfull=%s",
f->n, size, rsize, op.hres, op.vres, pkname );
}
print( "Creating new font %s...", pkname );
if( DOSBase && ( DOSBase->dl_lib.lib_Version > 36 ) )
{
if( BADDR( out_handle ) != NULL )
error = SystemTags( command, SYS_UserShell, TRUE,
SYS_Output, out_handle, TAG_DONE );
else
error = SystemTags( command, SYS_UserShell, TRUE, TAG_DONE );
}
else
/* externes Programm starten */
error = system( command );
if( error == 0 )
pk = fnt_pklocate( f );
}
return( pk );
}