How to get font name?
Blitz3D Forums/Blitz3D Programming/How to get font name?
| ||
Using Blitz3D, does anybody know a way to get a list of all the names of installed fonts? Is there a DLL or something knocking around to do this? I thought about just parsing all the .ttf files in the fonts directory to get the names, but this appears to be more difficult than I hoped. I did find an article on the web explaning how to do it in C++ but I'd like to know if there's a simpler way first, before getting bogged down trying to figure that out. :) Thanks in advamce. |
| ||
take a look for info on using the EnumFonts API call |
| ||
Thanks, but I know nothing about the windows API. :) |
| ||
OK I have a stupid idea... You could just open the fonts folder in Windows and list them (I suppose you could count them as well but I have no idea how to do that without a for/next loop) then do what you will with them... How about using BLITZui or one of the others... BCF??? Rook |
| ||
Someone recently had the same question over on BlitzCoder: http://www.blitzcoder.com/cgi-bin/ubb-cgi/postdisplay.cgi?forum=Forum6&topic=001733 I havn't tried the solution given but I think it just parses the fonts directory, as you suggested. |
| ||
@big10p: I have posted a bit of extra info to your 'bug' report - not particularly helpful for your predicament, but it should explain what is going on. One possible solution to this would be to load a standard version of the font and then perform your own italic shearing and emboldening in your Blitz app. [I tried messing about with padding the string with spaces, but it looks like the em-space thing is the problem - a (c) character gets clipped anyway] |
| ||
Rook: If only it were that easy. :) The TTF file names are not necessarily the name of the actual font - that information is embedded in the TTF, itself. Dazman: Thanks for the heads up! :) It does, at least, seem to be a partial solution - it can't get 'extended' names, though, so "Ransom Bold" and "Ransom Italic" both come back as just "Ransom". Maybe I can improve on this, but if not, it'll be fine as it is. BlackJumper: Cheers. I'll go take a look in bug reports. ;) |
| ||
Actually there is something in the file section of the archives here that is supposed to get the actual font names. http://www.blitzbasic.com/codearcs/codearcs.php?code=893 Have not tried it myself though. |
| ||
Wooo, thanks DJW. ;) I didn't even think to look in the achives, for some strange reason. :/ |