Hey guys

Hey guys,

Has anyone have tried to import a custom .ttf font to a Windows Firemonkey application yet? I was only able to find links for Android and iOS, but not related to desktop supported platforms.

Thanks in advance.

Comments

  1. on VCL you use this to load a font
         addfontresource(pchar());
         sendmessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
    and this to unload it
        removefontresource(pchar());
    this is Windows related, don't know if it works for other platforms or Firemonkey. Give it a try.

    ReplyDelete
  2. Heinz Toskano isn't that also locking the font file for security reasons? I remember something witness the idea loading a font in a similar manner and not being able to start twice because of the lock.

    ReplyDelete
  3. Jeroen Wiert Pluimers I used that method many times, and never hit any lock that I remember. The font you load is available at system level until you unload it. I wrote a font manager for myself that way, very long time ago!

    What happened too me once while debuging, I terminate the program abnormaly, the fonts loaded were kept in system and I was unable to unload or reload them again. A reboot was needed to solve that issue.

    ReplyDelete
  4. Found back my post: http://wiert.me/2011/09/29/editorlineends-ttr-what-is-it/
    The editorlineends font is loaded using the CreateScalableFontResource API call which locks the file when either of these are installed KB2982791 or KB2993651

    ReplyDelete
  5. That's another beast, something you must avoid IMO. The correct API calls are the ones I refer in my previous comment. Just don't load something in debuging mode and you're safe.

    ReplyDelete

Post a Comment