Skip to content

Instantly share code, notes, and snippets.

@khajavi
Forked from take-cheeze/font_path_list.cxx
Created April 20, 2013 11:25
Show Gist options
  • Save khajavi/5425676 to your computer and use it in GitHub Desktop.
Save khajavi/5425676 to your computer and use it in GitHub Desktop.
// g++ font_path_list.cxx $(pkg-config x11 --libs --cflags)
#include <X11/Xlib.h>
#include <cassert>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <iterator>
int main()
{
Display* const d = XOpenDisplay(NULL); assert(d);
int const s = DefaultScreen(d);
int fontListSize;
char** const fontList = XGetFontPath(d, &fontListSize); assert(fontList);
std::copy( fontList, fontList + fontListSize,
std::ostream_iterator<char const*>(std::cout, "\n") );
XFreeFontPath(fontList);
XCloseDisplay(d);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment