How do I retrieve a font from the system in SDL-TTF? TTF_OpenFont really wants an absolute path. I'm trying to code cross-platform as much as possible.
Non-working code ready to drop in working code:
public static IntPtr ResolveFont(string font, int size)
{
var pfont = TTF_OpenFont(font + ".ttf", size);
if (pfont == IntPtr.Zero) throw new InvalidOperationException(SDL_GetError());
return pfont;
}
I found a related question to get a list of fonts however this is not that. I intend to fetch only fonts I know exist (in the end, by using a package manager and declaring a dependency on the font package).
(This question is langauge agnostic: C# tag is needed only for syntax highlighting.)