Sign in to follow this  

Loading the Windows system font in freetype2

This topic is 2627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all. I'm currently adding a Lua console to my game, but I don't want to have to bundle a font file with the executable just for the console, so I'd like to load a built in Windows font instead. I've googled around, but come up blank on how to do this with Freetype2.

So my question is basically: How do I load a built-in Windows font into Freetype2 (using only libraries accessible from non-managed c++)? Ideally I'd like to load the system font used for command/dos windows.

Share this post


Link to post
Share on other sites
For getting fonts folder:

char buffer[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, buffer)

that will give you the font directory (usually %WINDIR%/Fonts)

As for the system terminal it uses a raster font, I would suggest just using using Courier New (or perhaps seeing if consolas is available on the computer and falling back to Courier New)

Share this post


Link to post
Share on other sites
Quote:
Original post by ender_341
For getting fonts folder:

char buffer[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, buffer)

that will give you the font directory (usually %WINDIR%/Fonts)

As for the system terminal it uses a raster font, I would suggest just using using Courier New (or perhaps seeing if consolas is available on the computer and falling back to Courier New)


Awesome, thanks!

Share this post


Link to post
Share on other sites

This topic is 2627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this