This topic is 3899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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);

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 on other sites
Use freetype library.
But if you want to use Xlib, use something like
xset +fp=path/to/font/directory

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 on other sites
Quote:
 Original post by c_olinThe 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_olinI 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.

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 98
• 11
• Forum Statistics

• Total Topics
632974
• Total Posts
3009654
• Who's Online (See full list)

There are no registered users currently online

×