
/* -------------------------------------------------------------*/
/*								*/
/* Final Writer 3 Arexx Macro - FontCatalogue 			*/
/* ©1994 Marcin Orîowski					*/
/*								*/
/* E-mail: carlos@felix.univ.szczecin.pl			*/
/*								*/
/* Dit script toont alle fonts uit de geselekteerde font dir.   */
/* Het font schrijft zijn naam 2X, eentje in het standaard font */
/* en eentje in het geselekteerde font.                         */
/*								*/
/* -------------------------------------------------------------*/

address "FINALW.1"
options results

NL = '0A'X
TempFile = "T:FWFontCatalogue"

'status FontPath'
FontName = Result

pos = LASTPOS('/', FontName)
IF ( pos ~= 0 ) 
then	/* If we found it, then DELSTR */
	FontPath = DELSTR(FontName, pos)
ELSE 	DO /* If no '/' is found, then search for ':' (volume name) */
	pos = LASTPOS(':', FontName)
	IF ( pos ~= 0 ) 
	THEN	/* If we found it, then DELSTR */
		FontPath = DELSTR(FontName, pos + 1)
	ELSE 	EXIT 20
	END

'RequestText "Path selection..." "Select font path" "' FontPath '"'
FontPath = Result
'RequestText "Font pattern..." "Select font pattern" "#?.pfb"'
FontPattern = Result

address command 'list ' FontPath || ' to=' TempFile || ' pat=' || FontPattern || ' files lformat "%s%s"'
address command 'sort ' Tempfile Tempfile

IF ~OPEN('infile', TempFile, "R")
THEN
EXIT 10

DO WHILE 1				/* DO Forever - We'll EXIT on EOF) */
	FullFontName = ReadLn('infile')
	IF EOF('infile') THEN EXIT 20

	IF LENGTH(FullFontName) = 0 
		THEN 	Iterate
		/* We'll strip the path from the name for display */
		pos = LASTPOS('/', FullFontName)

	IF ( pos ~= 0 ) 
	THEN	/* If we found it, then DELSTR */
		FontName = RIGHT(FullFontName, LENGTH(FullFontName) - pos)
	ELSE 	DO
		pos = LASTPOS(':', FullFontName)
		IF ( pos ~= 0 ) 
		THEN	/* If we found it, then DELSTR */
			FontName = Right(FullFontName, LENGTH(FullFontName) - pos)
		ELSE
		 	EXIT 20
		END

	'Font ' || FullFontName		/* make sure we can use it */
	IF RC = 0 
	THEN	DO
		'FontSize 14'
		'Font SoftSans'  	/* We'll always display the font name in SoftSans */
		'Type ' || FontName
		'Type 		' 	/* 2 TABs are here! */
		'Font ' || FullFontName
		'FontSize 36' 
		'Type ' || FontName
		'NewParagraph'
		END
END

address command 'delete >nil: ' Tempfile
