May 26, 2019, 03:19:39 AM

Author Topic: TGuiFont to TImageFont?  (Read 303 times)

Offline chalky

  • Jr. Member
  • **
  • Posts: 36
TGuiFont to TImageFont?
« on: October 16, 2018, 12:29:52 AM »
I am trying to create a custom gadget which would ideally use the same font as standard window controls so that it blends into the GUI. Although I can find the required fonts via:
Code: [Select]

I cannot use these to draw text on a canvas, as SetImageFont wants a TImageFont object and fails with an "Unable to convert" error. Is there a way to create a TImageFont from a TGuiFont so it can be used with the the SetImageFont and DrawText commands?

Offline Henri

  • Full Member
  • ***
  • Posts: 199
Re: TGuiFont to TImageFont?
« Reply #1 on: October 16, 2018, 01:13:38 PM »

TGuiFont has a handle to font (along with some attributes). TImageFont has raw pixmap data to be shown in graphic content. Both are originally from the same source (true type font , .ttf) , image font is just converted to images. I don't believe you can get TImageFont from TGuiFont font handle (someone can prove me wrong though), but you can copy the source font from system to your program folder and load that directly with LoadImageFont.

There are also some nice 3rd party fonts to choose from. See

- Got 01100011 problems, but the bit ain't 00000001