Loading the Windows system font in freetype2

Started by
1 comment, last by kuroioranda 13 years, 6 months ago
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.
Advertisement
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)
-Matt S.
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!

This topic is closed to new replies.

Advertisement