[futurebasic] Re: font list

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 1998 : Group Archive : Group : All Groups

From: rbryce@... (Bob Bryce)
Date: Tue, 18 Aug 1998 10:04:36 -0600 (CST)
BHSoftware asked;

>I'm trying to list all the fonts available in the Fonts folder in a EDIT
>field, but I have been having trouble doing it. Does anybody know how to do
>it?

Frank Turovich posted on his site a function to get the fonts from the
System. In my program MacAutoFormat I modified this and call it and
then write the resulting list to a file with;

PRINT #2, "{\fonttbl "
  FN getFONTLIST
  PRINT #2, "}"
(The fonttbl and brackets are because I am writing RTF
coding here)

Replace the above piece of code with that necessary to
write it out in an edit field.

LOCAL FN getFONTLIST    'Thank Frank for this function
  DIM fontName$(100)
  DIM origRes
  origRes=FN CURRESFILE
  'don't load; just look
  CALL SETRESLOAD(_false)
  'get res count
  theCount=FN COUNTRESOURCES(_"FOND")
  'get each res handle and info
  FOR i = 1 TO theCount
    rHndl&=FN GETINDRESOURCE(_"FOND",i)
    fontName$=rName$
    CALL GETRESINFO(rHndl&,rID,rType&,rName$)
    'fontName$(i)=rName$
    longID$=STR$(rID)
    P=LEN(longID$)
    ID$=RIGHT$(longID$,P-1)
    PRINT #2, "{\f"+ID$+"\froman "+rName$+";}" 'modify this to print
                                               'to your edit field
                                               'this is RTF fontbl code
                                               'for my program
  NEXT
  'restore normal res loading
  CALL SETRESLOAD(_zTrue)
  'put things back like we found them
END FN

LOCAL FN fontTable$     'create your own code to put in edit field
  PRINT #2, "{\fonttbl "
  FN getFONTLIST
  PRINT #2, "}"
END FN

Hope this helps.

Bob Bryce
Canadian eh?