/* -------------------------------------------------------------*/
/* Final Writer 3/4 Arexx Macro - FontCataloguer  		*/
/* ©1994 Marcin Orîowski					*/
/* E-mail: carlos@felix.univ.szczecin.pl			*/
/*                                                              */
/* mODiFiCATiONS & iMPROVEMENTS bY: fRACTAL gURU - tEKNO rAGE'95*/
/*                                                              */
/* This macro will display all fonts from selected font drawer  */
/* by its name written twice - once using standard font and     */
/* then using font itself to show how the font looks like       */
/* You can type your own pattern to filter those fonts you want */
/* -------------------------------------------------------------*/
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..." "Choose font path" "' FontPath '"'
FontPath = Result
'RequestText "Font pattern..." "Choose font pattern" "#?"'
FontPattern = Result
'RequestText "Font Size ..." "Choose the font size " "20"'
Tamanho = 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
		'Font ' || FullFontName
		'FontSize 'TAMANHO'' 
		'Type ' || FontName
		'NewParagraph'
                'Type ' || 'ABC abc 123 ÁÉáé'
                'NewParagraph'
		END
END
address command 'delete >nil: ' Tempfile
