Is there a way to specify loading the font from the main running folder? Don't necessarily want to install a bunch of fonts to a user's desktop (this is for a Steam app). :)
Put them in the lib folder with a copyStep command (after build)
I use a font folder inside and then to load the fonts I use
#if TargetWin32 dim f as FolderItem=app.ExecutableFile.Parent.Child(app.ExecutableFile.Name.Replace(".exe"," Libs")) if f.Exists then f=f.Child("fonts") if f.Exists then for i as Integer=1 to f.Count fonts.Append f.Item(i) next end if end if for i as integer=0 to Fonts.Ubound TemporarilyInstallFont(fonts(i)) next #endif
fonts is an array that I use then for the UninstallTemporaryFont call
The copy step is simple:
create one after build, set applies to Both, subdirectory font, destination framework folder (that's the Lib folder for win build)
Here's an example Xojo project that shows how to use custom app fonts in Windows, macOS and Linux applications: CustomAppFonts
The fonts are not being installed on the OS - they are only available while the Application is running. This may be necessary, depending on the license of your fonts. On Windows and Linux it's even possible to load/unload during runtime
Note that this app, like others built with MBS ActivateFontMBS, does not work under Windows in anything > 2016R3, because apparently Direct2D does not support dynamic font activation.
This thread is old now. There have been other threads about the same topic where that particular issue was discussed. So far no workaround has been found AFAIK.