Ticket #36: find_X11_fontpaths.cpp

File find_X11_fontpaths.cpp, 657 bytes (added by paul.wratt, 8 years ago)

outputs FontPath as found in "xset q" output, /usr/share/font == "built-ins" on Debian

Line 
1/*
2g++ -Wall -O3 -lm -lX11 -o find_X11_fontpaths find_X11_fontpaths.cpp
3// g++ `sdl-config --cflags` -Wall -O3 -DLINUX -DVERSION=\"0.0.1\" `sdl-config --libs` -lSDL_image -lSDL_ttf -o find_X11_fontpaths find_X11_fontpaths.cpp
4*/
5
6#include <string.h>
7#include <stdlib.h>
8#include <stdio.h>
9// #include <SDL_ttf.h>
10#include <X11/Xlib.h>
11
12int main(int argc, char *argv[])
13{
14 int i,number;
15 Display* dpy = XOpenDisplay(NULL);
16 char** font_path_list = XGetFontPath(dpy,&number);
17 XCloseDisplay(dpy);
18
19 for(i=0;i<number;i++)
20 printf("%s\n",*(font_path_list+i));
21
22 XFreeFontPath(font_path_list);
23
24 return(0);
25}