XylemFlow 8 Posted October 21, 2022 I'm looking for a component or code sample that allows a user to select a font family. An example is shown attached, which is taken from Inkscape. I already have code to collect a list of the installed fonts from Windows. The selector should show the list of fonts as well as a sample using the actual font. It should also have a search functionality that allows you to type in and it will filter the list based on the input. I would have thought that something similar would be included. I've already made some progress with making my own using a TListBox with custom styles, but thought I would ask in case something is already available online? Share this post Link to post
SwiftExpat 65 Posted October 21, 2022 Commerical from TMS FNC UI Pack. https://download.tmssoftware.com/doc/tmsfncuipack/components/ttmsfncfontnamepicker/ Tradiational picker as well https://download.tmssoftware.com/doc/tmsfncuipack/components/ttmsfncfontdialog/ 1 Share this post Link to post
XylemFlow 8 Posted November 14, 2022 (edited) I've made some progress on this, which you can see in the attached demo. I've made my own font selector which automatically collects installed fonts from Windows, has autocomplete when typing and shows each font in its own font for preview. However, there are a couple of issues that I could use some help with. There's quite a lot of lag sometimes when scrolling through the list using the scrollbar. It will often lock up and take several seconds to recover, during which time the CPU is fully occupied with something. I do have 528 fonts in the list, which is likely part of the issue, but similar font selectors in other apps, such as Inkscape don't have a similar issue. If I comment out the code for setting the font family of the list items (lines 109-111 of FontSelector.pas), then there's no such issue. I'd like the cursor to show crDefault when over the dropdown button instead of the text bar. I think this is due to the parent of the TButton being the TEdit. Any suggestions for solving these issues or other general improvements are welcome. FontSelector.zip Edited November 14, 2022 by XylemFlow Share this post Link to post
XylemFlow 8 Posted November 16, 2022 I've solved some of the issues with the font selector. The cursor now changes correctly. I'm quite happy with it now. The locking issue still happens but I discovered that this was not due to the number of fonts in the list but a particular font that is slow to render that I have installed (Surfing Capital). If I remove that font from the list then all is fine. I found that this font is also causing issues with the font selectors in other apps such as MS Paint, so it may not be worth doing anything about. FontSelector_v2.zip Share this post Link to post