How to include font with app

Mac OSX specific forum
WilliamL
Addict
Addict
Posts: 1252
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

How to include font with app

Post by WilliamL »

I have a program that uses a font (New York) that doesn't seem to be pre-installed on the new Macs. I would like to put the font in the 'Contents' folder so the app can use that font. Is there any way to do that?

Right now my strategy is to try to load the preferred font and if that fails then load a font that is part of the system (at least I think Geneva is required).

Code: Select all

Global font$
Enumeration 1 ; font #s
    #fontsize14
    #fontsize18
    #fontsize12
EndEnumeration
font$="New York"
If LoadFont(#fontsize14,font$,16)
    LoadFont(#fontsize12,font$,12)
    LoadFont(#fontsize18,font$,18)
Else
    font$="Geneva"
    ;MessageRequester("Loading fonts...","Preferred font not found"+Chr(13)+"...will use Geneva.")
    LoadFont(#fontsize14,font$,14)
    LoadFont(#fontsize12,font$,12)
    LoadFont(#fontsize18,font$,18)
EndIf
How do you suggest I handle it?
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20
User avatar
Airr
User
User
Posts: 49
Joined: Tue Oct 04, 2005 4:29 am
Contact:

Re: How to include font with app

Post by Airr »

You would want to place the font in Contents/Resources, and then use the ATSFontActivateFromFileReference api to notify the system that the font is available (you can set it so that only your app knows about the font, or the globally for the system).

Here's the link to the Apple Type Services Documentation...

AIR.
"Programming is like Poetry. Sometimes the words just escape you..." -me, to my manager.
Post Reply