I want to use a custom TrueTypeFont I made myself in my application.
What’s the standard way to transfer the font to users along the app? so the proper font shows inside the app?
[quote=116898:@Radium Radiovich]I want to use a custom TrueTypeFont I made myself in my application.
What’s the standard way to transfer the font to users along the app? so the proper font shows inside the app?[/quote]
Please try to post in Mac OS X instead of General next time you start a thread concerning that platform. It will be a lot clearer for all.
Sorry for some reason I forgot all about Xojo being a cross-platform suite.
bump
anybody?
you can copy the file into a folder inside the app. That won’t make it available unless you do something to “activate” the font when the application launches. I know MBS has some functions on activating/deactivating fonts on the fly.
Yes, I use the activate font methods from MBS and they work well on Windows as well on Mac.
Any tip for Linux?
Try asking Christian if he has a solution for Linux.
[quote=117238:@Radium Radiovich]bump
anybody?[/quote]
I see you ‘liked’ it. Have you been to the link I posted ? Everything is in there, from the most simple to the most elaborate declare. All work.
Repost of the simplest method :
Allright. I have found a way to have custom fonts without extraneous steps, without dependencies everywhere, and sorry without MBS. I post it here in the hope of saving frustration to countless other poor souls who may not like seing that something is ‘very easy’ without any hint of solution.
Add a Copy Files to the project build steps (insert) and copy all fonts into the Resources folder in a subfolder called appfonts (in this example, any name will do)
Build an app. In the package contents folder, pick the info.plist file, copy it into your development folder, and add to it the following line:
<key>ATSApplicationFontsPath</key>
<string>appfonts</string>
- Add a Copy Files which copies the modified info.plist back into the Contents folder.
Voilà. That’s it.
I found that it is easier to install the fonts in the system to have a correct display in the IDE, but at runtime, the app will use the fonts within itself.
If you are looking for original fonts, look for FontMenu.com. They may not be free, but they are extremely affordable. And I can grant usage rights to friendly Xojo developers. If you need fonts created to your specs, I do that too.
Michel Bujardet
Match Software
This looks like a way you can use to install fonts in code :
http://xmodulo.com/2013/07/how-to-install-custom-fonts-in-linux-desktop.html
There does not seem to be quite the equivalent of temporary installation like Windows, or custom application fonts like Mac OS X. For Windows, though, I usually have the installer install the fonts in the system. It is a lot simpler.
There is a nice discussion about installers for Linux at
Thanks Michel,
but I am searching an equivalent of the per app use (like Win or OSX)
For my web and desktop apps I use a font for in app icons (toolbar, custom button and so on), less resource, only a couple of methods (and another couple for win at startup and at shutdown), hires ready.
Every app has its custom font embedded with a copy file step.
Really simple and efficient!
Now I want to port one of these app to linux. It’s all ok, but I need a x app font (a font to use as an app resource)
[quote=117413:@Antonio Rinaldi]Thanks Michel,
but I am searching an equivalent of the per app use (like Win or OSX)
For my web and desktop apps I use a font for in app icons (toolbar, custom button and so on), less resource, only a couple of methods (and another couple for win at startup and at shutdown), hires ready.
Every app has its custom font embedded with a copy file step.
Really simple and efficient!
Now I want to port one of these app to linux. It’s all ok, but I need a x app font (a font to use as an app resource)[/quote]
Sorry, That was all I could find as custom fonts for Linux. Unlike Apple Developer Library and Microsoft Developer Network, Linux does not seem to provide a centralized reference.
I have been selling fonts for over 15 years, yet I have no idea what an “x app font” is. Neither does Google.
Mac OS X has two methods for fonts available only to the app, and Windows has an API that will activate a font and deactivate it at will. I am completely ignorant about Linux declares and would not even know where to find an API reference for it. The only place where there seem to be some knowledge about the Linux API is MonkeyBread software, and they do not seem to have a solution equivalent to activate fonts.
Maybe you can try to install the font like described at http://xmodulo.com/2013/07/how-to-install-custom-fonts-in-linux-desktop.html but instead of copying the font file, simply create a symbolic link in the Fonts folder. And the original would be in ApplicationData. Windows does that. It is possible that it works in Linux.
Another approach would be to install the font when your program starts and remove it when it closes. If it is at all possible.
Good luck in the chase