Sign in to follow this  

Loading fonts in linux.

This topic is 3591 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

I looked at the source from the NeHe tutorial on loading and displaying system fonts. Here is a code snippet:
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);


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

Share this post


Link to post
Share on other sites
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+..")?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this