How do you get all fonts and styles listed in Delphi?

Hello,

I know that you are using Delphi to develop Font Creator, and I was wondering how you get around the limitations of the VCL which seems unable to handle fonts with styles as introduced in Windows 7.

Screen.Fonts

The issue seems to come from an incorrect use of the EnumFontFamiliesEx() WinAPI call.

  • The call to EnumFontFamilies should occur twice, once parameter-less to get a list of all the font families, and then for each family name found, using that family name as parameter, to then obtain all the styles of that family.

  • It would seem that the VCL just calls the enum once, getting the list of font families, but never goes the extra step of listing all the styles of each family (this is why the tweaking of the AvenirRoman, discussed earlier, where we created one family per font, works with the VCL, as all it looks at are the family names obtained from the first iteration of EnumFontFamilies).

TFontDialog

There is also a problem in the implementation of the TFontDialog in the VCL, whereby, after the Windows ChooseFont() dialog returns, the VCL tries to guess the style of the returned font, in the function TFontDialog.UpdateFromLogFont(), using the lfWeight parameter of the TLogFont returned by ChooseFont(), instead of getting the exact name of the style from the lpszStyle field of the TChooseFont record returned from the Windows ChooseFont() dialog.

The result is that using the TFontDialog to select one of the basic Windows fonts (such as Tahoma), fails, while my tweaked version of TFontDialog returns the full font name and style (see attached TFontDialog.png).

I am wondering how you got around these issues ?

Very best regards,

Olivier

We have been developing software for Delphi since its first release back in 1995. Over the years we have implemented our own way of working with fonts as the components and tools that come with Delphi are indeed insufficient.

Best you can do is to open a support ticket at Embarcadero and ask to fix your mentioned issues in a future release.

Helle Erwin,

Thank you very much for the prompt response.

I did reach out to Marco and Dave at the “What’s New in Delphi 11” webinar and logged a detailed report with screenshots and test projects at RSP-35667 a few years ago. But, every time I post a “any news?” comment, I am told that it is essentially to complicated to do and not a priority. Very frustrating.

Very best regards,

Olivier