author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年07月22日 18:14:53 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年07月22日 18:14:53 +0200 |
commit | 78702ab307e9d05493cb980a25f19d340d5644a0 (patch) | |
tree | 9d24fa8f54b30674460cacce96ef8bff1ff6e6dc /agg-plot | |
parent | 92e12ee84e5db62e8d33a1a32d9a5d6289c9fffc (diff) | |
download | gsl-shell-78702ab307e9d05493cb980a25f19d340d5644a0.tar.gz |
-rw-r--r-- | agg-plot/Makefile | 2 | ||||
-rw-r--r-- | agg-plot/support_x11.cpp | 24 |
diff --git a/agg-plot/Makefile b/agg-plot/Makefile index 34786f94..d987ee22 100644 --- a/agg-plot/Makefile +++ b/agg-plot/Makefile @@ -31,7 +31,7 @@ ifeq ($(HOST_SYS),Windows) INCLUDES += -I/usr/include -I/usr/pthreads-w32/include PLATSUP_SRC_FILES = support_win32.cpp agg_platform_support_win32.cpp agg_win32_bmp.cpp else - PLATSUP_SRC_FILES = agg_platform_support_x11.cpp + PLATSUP_SRC_FILES = support_x11.cpp agg_platform_support_x11.cpp endif INCLUDES += $(AGG_INCLUDES) $(FREETYPE_INCLUDES) -I$(GSH_BASE_DIR) -I$(LUADIR)/src diff --git a/agg-plot/support_x11.cpp b/agg-plot/support_x11.cpp new file mode 100644 index 00000000..cc40d3d2 --- /dev/null +++ b/agg-plot/support_x11.cpp @@ -0,0 +1,24 @@ +#include <sys/stat.h> + +#include "agg-pixfmt-config.h" + +const char *ttf_names[] = {"freefont/FreeSans.ttf", "ttf-dejavu/DejaVuSans.ttf", 0}; + +const char *gslshell::get_font_name() +{ + const char* ttf_dir = "/usr/share/fonts/truetype/"; + unsigned len = strlen(ttf_dir); + static char pf[256]; + memcpy(pf, ttf_dir, len + 1); + for (int k = 0; ttf_names[k]; k++) + { + const char* font_name = ttf_names[k]; + memcpy(pf + len, font_name, (strlen(font_name) + 1) * sizeof(char)); + struct stat inf[1]; + int status = stat(pf, inf); + if (status == 0) + return pf; + } + + return 0; +} |