Jump to content
Marty001

Load font into TStringlist

Recommended Posts

I have a Font (ttf) added to my resource file, It is a graphical in-house font that has icons for Tbutton etc, however is there a way to add the font to a TImageList? so that each character is a separate image?

 

Using Delphi 11.2 on Windows 11 Pro 64bit

Edited by Marty001

Share this post


Link to post

This article explain how to use a font without installing it. This is not Delphi but make almost only use of Windows API which you can use from Delphi. Once the font is loaded, you can use it to paint individual characters to bitmaps and add them to TImageList.

Share this post


Link to post

Remember that font glyphs are usually vector images and so rasterising into an image list may not be ideal, depending on your usage. My guess is that rasterising every glyph from a font ahead of time is terribly wasteful. You may run out of resources. Why don't you just draw each glyph on demand when you need to? 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×