Jump to content
  • Advertisement
Sign in to follow this  
c_olin

Loading fonts in linux.

This topic is 3899 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
Advertisement
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  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!