[comp.sys.mac.programmer] Font Resource

ib@apolling (Ivan N. Bach) (03/26/89)

I am trying to create some Macintosh resources of type FONT.  After
studying a description of this type of resource in the "Inside Macintosh"
books and the Macintosh Technical Notes, I still have the following three
questions:

    1. What exactly is the format of the 112-byte block of data
       in the resource header that is reserved for system use,
       and what should my program write into these 112 bytes?
     
    2. What exactly is the format of the 128-byte block of data
       in the resource header that is reserved for application
       data, and what should my program write into these 128 bytes?
       On p. I-129 of "Inside Macintosh," it says that the application 
       data may be whatever you want, but the T. Note #62 says that
       this area SHOULD NOT be used by an application because it is
       used by the Resource Manager.

    3. A resource data area is supposed to start with a 4-byte resource
       length, followed by resource data.  When I looked at a dump of
       a resource of type FONT, I found a 256-byte resource header
       followed by:
 
       RESOURCE DATA
                 length of resource?
                ?         | proportional font
                |         |         |
                V         V         V
                0000 0000 0000 0ad0 9000 0000 00da 000f

       Why does this resource data area start with 4 bytes set to
       zeros, followed by a 4-byte resource length, followed by a
       2-byte font type (the first field in a font resource)?

oster@dewey.soe.berkeley.edu (David Phillip Oster) (03/27/89)

In article <3233@imagen.UUCP> ib@apolling (Ivan N. Bach) writes:
>I am trying to create some Macintosh resources of type FONT. 

The resource manager data structures are for debugging use only!
If you want to create a font, just put the data in a handle and do:

CreateResFile("\pmyFontFile");
OpenResFIle("\pmyFontFile");
AddResource(fontHandle, 'FONT', 128, "\pmyFontName");
CloseResFile(CurResFile());

Don't muck with resource manager data structures directly. Don't rely on
Inside Mac Vol 1 to tell you the format of a FONT resource: read the Font
Manager chapters in Inside Mac vol 4, and 5.

--- David Phillip Oster            --"When we replace the mouse with a pen,
Arpa: oster@dewey.soe.berkeley.edu --3 button mouse fans will need saxophone
Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu --lessons." - Gasee