Hi,
how I can load a font file in PureBasic on Mac OS X? On Windows I use "AddFontResource_()" to do that.
http://www.purebasic.fr/english/viewtop ... 05#p257005
Thanks.
Load a font from file (like AddFontResource_)
Re: Load a font from file (like AddFontResource_)
See Custom font in a Cocoa application and ATSApplicationFontsPath and
Embedding Fonts in an Application.
Just adding ATSApplicationFontsPath key to your Info.plist seems the way to go to
import your own fonts from Resources directory within your .app file.
Embedding Fonts in an Application.
Just adding ATSApplicationFontsPath key to your Info.plist seems the way to go to
import your own fonts from Resources directory within your .app file.
Re: Load a font from file (like AddFontResource_)
Any hope for a snippet? 

Re: Load a font from file (like AddFontResource_)
Example: Embedded_font_in_app.zip (51KB)
Code: Select all
;
; 1.) Compile your .app
;
; 2.) Create the "Resources" directory within your .app/Contents/ directory
;
; 3.) Create a "fonts" directory within the Resources directory and copy your fonts there
;
; 4.) Add the following key and string to your Info.plist:
; <key>ATSApplicationFontsPath</key>
; <string>fonts</string>
;
; the string "fonts" is the name of the directory
; within your Resources folder, where your fonts are located
;
;
;
; The embedded font is „Crystal“ by Allen R Walden:
; http://www.fontspace.com/allen-r-walden/crystal
;
crystal = LoadFont(#PB_Any,"Crystal", 100, #PB_Font_HighQuality)
image = CreateImage(#PB_Any, 800,600, 32, RGB(255,255,255))
If StartDrawing( ImageOutput(image) )
DrawingFont( FontID(crystal) )
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(10,10,"CRYSTAL FONT",RGB(0,0,0))
StopDrawing()
EndIf
OpenWindow(0,0,0,800,600,"Load embedded font from .app",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ImageGadget(0,0,0,800,600,ImageID(image))
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
Re: Load a font from file (like AddFontResource_)
Thank you very much for that.
Re: Load a font from file (like AddFontResource_)
Thank you Danilo, could be useful 

"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review