summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-11-13 21:54:42 +0000
committerComment <tim@gray.(none)>2013-11-13 21:54:42 +0000
commitc95f125f3296d75789685fe1ababe48abe161973 (patch)
treea79daa68e855f7d7a1763d2dd6ecb9bf6ed7d06a
parent053f57745ac8e6848e3ae6060162bddebb36bcef (diff)
looking at fontconfig
-rw-r--r--rotord/src/nodes_drawing.h3
-rw-r--r--working/make_test_fontconfig1
-rw-r--r--working/test_fontconfig.cpp35
3 files changed, 38 insertions, 1 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h
index a3af7c9..d5f3578 100644
--- a/rotord/src/nodes_drawing.h
+++ b/rotord/src/nodes_drawing.h
@@ -3,6 +3,7 @@
#include "rotor.h"
#include <cairo.h>
+//#include <fontconfig.h>
namespace Rotor {
class Draw_node: public Image_node {
@@ -68,7 +69,7 @@ namespace Rotor {
else text=attributes["text"]->value;
cairo_text_extents_t te;
cairo_set_source_rgb(cr, colour.Rfloat(),colour.Gfloat(),colour.Bfloat());
- cairo_select_font_face (cr, "Georgia",
+ cairo_select_font_face (cr, "DejaVu",
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 120);
cairo_text_extents(cr, text.c_str(), &te);
diff --git a/working/make_test_fontconfig b/working/make_test_fontconfig
new file mode 100644
index 0000000..04ecab2
--- /dev/null
+++ b/working/make_test_fontconfig
@@ -0,0 +1 @@
+g++ test_fontconfig.cpp -o test_fontconfig -I /usr/include/fontconfig/ -lfontconfig
diff --git a/working/test_fontconfig.cpp b/working/test_fontconfig.cpp
new file mode 100644
index 0000000..a6a6411
--- /dev/null
+++ b/working/test_fontconfig.cpp
@@ -0,0 +1,35 @@
+#include <fontconfig.h>
+#include <cstddef>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main() {
+ FcBool success = FcInit ();
+ if ( !success ) {
+ return false;
+ }
+
+ FcConfig *config = FcInitLoadConfigAndFonts ();
+ if(!config) {
+ return false;
+ }
+
+ FcChar8 *s, *file;
+
+ FcPattern *p = FcPatternCreate();
+ FcObjectSet *os = FcObjectSetBuild (FC_FAMILY,NULL);
+ FcFontSet *fs = FcFontList(config, p, os);
+
+ printf("Total fonts: %d\n", fs->nfont);
+ for (int i=0; fs && i < fs->nfont; i++) {
+ FcPattern *font = fs->fonts[i];
+
+ s = FcNameUnparse(font);
+ printf("Font: %s\n", s);
+ free(s);
+
+ if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) {
+ printf("Filename: %s\n", file);
+ }
+ }
+} \ No newline at end of file