FB II Compiler







Disk I/O














Made with FB


Include fonts in applications

I just can't find how to include fonts in my app. I tried copying the FOND resource of a font to my app, but Resedit say 'Resource not found'.

I think i can call the FONT with:


But how do i embed it in my app ?

Also, the statement 'TEXT ID, SIZE' , will apply to all the text in the following EDIT FIELD. What if the EDIT FIELD has multiple fonts ?

Any code ?


It depends on what type of font it is; PostScript, TrueType, or Bitmapped. In general, you need to include the FOND, FONT (if any) and nfnt (if any) resources. This will only cover "screen fonts" if it's PostScript, not the printer font.

If the resource is visible, ResEdit shouldn't give you an error on "copy"... I'm not sure what you're doing. Are you trying to copy from a suitcase? If so, start by creating a suitcase that contains _only_ the one font you're working with. Then copy the whole set of resources at once.


I have a similar problem I believe. I wish to know how to enbed fonts into my program and I also would like to know how I might get all the fonts from the system. There are constants for _geneva, and all the others and most of them work but my problem is I want my font menu to be like simple text's, full of the system fonts read automatically. Also I need to make sure the user of my program has access to a few designated fonts (built in) or at least I could include a folder with the fonts that they need to add to the system folder. Then my only problem would be reading the system fonts into the menu. One other problem I am having is justification. I have an edit field with a negetive ID of course, and I want it to be capable of multible just's. (For instance, the title of the edit field would be centered and the text below would be left just. Thanks to anyone who can help me!


DOCMaker holds every fonts contained in the document in its resource fork. That's black magic to me. When looking at the resource fork of a DOCMaker document, i just can't see any FOND or FONT resources. I don't know if someone have some code to do the same in FB, but i'm sure a lot of users would like to take a look at it. (including me :-)

If someone could write code to 'copy' selected fonts into the resource fork of a FB app for later viewing on a system that doesn't have'em... I would pay for it !


I'm new to this list & missed the original post, but may I jump in?

The FOND alone merely tells the code where to find the FONT or NFNT (depending on format), which you also need to copy. Take only the one for the size you're actually using, and edit out (in ResEdit or font editor of your choice) all characters that aren't used in your application--assuming you're using it for display of specific text, or a particular type of input, whose content you can predict. This not only trims a couple of k's from the size of your application, it makes it pretty impossible for users to sneak in and steal the font.

To enlarge the subject: using copies of fonts in your own application is often an _excellent_ idea, since common fonts such as Geneva and Palatino come in many variations that affect line height and hence the appearance of displayed text.

Now, does someone out there know how to _rename_ a copied font (_newYork myBigApple) without fear of ID conflict?


DOCMaker may hold some kind of reference or pointer to the fonts used in the document in its RSRC fork, but it doesn't hold the font itself. If you launch a DOCMaker document containing a font not installed on your computer, you will get the usual warning message that a font is not installed, a guess as to what that might be, and a warning that the document may appear different (font substitution occurring).

Roger M. Clary

I was going to say this way back when, but never got around to it. I'm definitely no expert on this subject, but I have had some experience with it. I'm still not 100% sure that this is a garaunteed way to ensure that you won't have conflicts, but it hasn't failed me yet (knock on wood).

The only way I've found to make sure that font conflicts between the font in my apps and a font on a given system don't happen, is to:

1) rename the font to something that is likely never to be found on any systems
2) give it an ID above 127 - the range of ID's reserved for your use

Note: This makes the assumption that the "128 and up" rule applies to font resources just like any other. I don't actually know if this is the case. Maybe someone else can verify that. But it has not failed me yet.

I have had the opportunity to see what happens when there _is_ a font conflict between the font in an app and a font in the host system. And it isn't pretty. Things are drawn in the wrong font (usually Geneva - the application font), and it really is ugly. But doing the two things I listed above fixed the problem. And I haven't had a problem since.

David Blache

Whew. You took a _big_ risk; some of those "128 and up" numbers are reserved. I checked IM (table 4.1 in the online version of IM: Text): the font ID numbers available to you, me and Adobe Systems are the range 1024-16382. Newer font utilities go by name before number, but there don't seem to be many guidelines on this.


You should be very cautious about "hiding" fonts in your app.Unless you created the font, or have permission from the creator(s) of the font, you could be in legal doo-doo.