Display *dpy;
XFontStruct *fontInfo;
mDisplayList = glGenLists(96);
dpy = XOpenDisplay(NULL);
fontInfo = XLoadQueryFont(dpy, face.c_str());
if (fontInfo == NULL) {
return false;
}
glXUseXFont(fontInfo->fid, 32, 96, mDisplayList);
XFreeFont(dpy, fontInfo);
XCloseDisplay(dpy);
Loading fonts in linux.
I looked at the source from the NeHe tutorial on loading and displaying system fonts. Here is a code snippet:
My question is: How do I load a font in a particular location relative to me excecutable (truetype)? And how do I specify the size?
I've googled XLoadQueryFont() but I cannot seem to answer my question.
I will continue googling...
Thanks
Use freetype library.
But if you want to use Xlib, use something like
xset +fp=path/to/font/directory
But if you want to use Xlib, use something like
xset +fp=path/to/font/directory
The problem is that I want to load the same fonts on both linux and windows build of my game.
I don't really understand the xset. Is it a function? XSet("+fp+..")?
I don't really understand the xset. Is it a function? XSet("+fp+..")?
Quote: Original post by c_olin
The problem is that I want to load the same fonts on both linux and windows build of my game.
I would also recommend trying FreeType for your situation.
Quote: Original post by c_olin
I don't really understand the xset. Is it a function? XSet("+fp+..")?
It's a command line program to tweak some X preferences (such as the font path in that example). I wouldn't bother with it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement