home *** CD-ROM | disk | FTP | other *** search
- /* AVAILABLE FONTS -- A arexx script that uses AmigaLibHost. */
-
- /* USAGE: rx avfonts */
-
-
- /* Access arexx host. */
-
- call ADDLIB 'AmigaLibHost',-20
-
-
- /* Ask host to open a library. If can't, scram. */
-
- DISKFONTBASE = FINDLIB('diskfont.library',0)
-
- if DISKFONTBASE = 0 then do
- say 'Can''t open diskfont.library'
- exit
- end
-
- /* We'll be calling this function. */
-
- AVAILFONTS.BASE = DISKFONTBASE
- AVAILFONTS.LVO = -36
- AVAILFONTS.CALL = '(BUFFER,BUFBYTES,FLAGS)(A0,D0/D1)'
-
- AVAILFONTS.BUFFER = 'LONG'
-
-
- /* Get memory for buffer. */
-
- mem = getspace(1000)
-
-
- /* Ask system to find all known memory and disk fonts. */
-
- need = SENDLIB('AVAILFONTS',mem,1000,3)
-
- /* if need greater that zero, need bigger buffer. */
-
- if need ~= 0 then do
-
- freespace(mem,1000)
- mem = getspace(1000 + need)
-
- need = SENDLIB('AVAILFONTS',mem,1000 + need,3)
-
- /* If failed this time, scram. */
-
- if need ~= 0 then do
- say 'Unable to get available fonts'
- exit
- end
- end
-
-
- /* Convert from 'packed' variable to rexx number. */
-
- rxmem = c2d(mem,4)
-
- num = PEEK(rxmem,2)
- say 'Found ' || num || ' fonts in memory and/or on disk.'
-
- do i = 0 to num - 1
-
- /* Get font location. */
-
- val = PEEK(rxmem + 2 + i * 10,2)
- if val = 1 then where = 'MEMORY: '
- if val = 2 then where = 'DISK : '
- if val = 3 then where = 'BOTH : '
-
- /* Get font name. */
-
- val = PEEK(rxmem + 4 + i * 10,4)
- name = import(d2c(val,4))
-
- /* Get font size. */
-
- val = PEEK(rxmem + 8 + i * 10,2)
-
- say where || name || " - size " || val
- end
-
-
- /* Close library. */
-
- call DONELIB(DISKFONTBASE)
-
- exit /* don't let 'internal functions' get executed */
-
-
- /* Peek function -- sort of like BASIC. */
-
- PEEK:
- arg location,size
- return c2d( import( d2c(location,4),size ),size )
-
-
- /* Poke function -- sort of like BASIC. */
-
- POKE:
- arg location,value,size
- call export( d2c(location,4),d2c(value,size),size )
- return
-