diff --git a/Common/Context.h b/Common/Context.h
index 2c530bd4b163c7834c0d0ba68ea44a2231daba44..565c7b3181d3f5a6ffae44d5ae70cbf426923ff3 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -180,7 +180,7 @@ class CTX {
   // fltk font size (and delta for palette windows)
   int fontSize, deltaFontSize;
   // font name, FLTK enum and size for opengl graphics
-  std::string glFont, glFontTitle;
+  std::string glFont, glFontTitle, glFontEngine;
   int glFontEnum, glFontEnumTitle, glFontSize, glFontSizeTitle;
   // point/line widths
   double pointSize, lineWidth;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index e1b15db69d36519b69e0c5ca946c12527c395640..62c6682bb8ec56a1f79d40e785c6c5a29077e06b 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -61,6 +61,8 @@ StringXString GeneralOptions_String[] = {
 
   { F|O, "GraphicsFont" , opt_general_graphics_font , "Helvetica" ,
     "Font used in the graphic window" },
+  { F|O, "GraphicsFontEngine" , opt_general_graphics_font_engine , "Native" ,
+    "Set graphics font engine (Native, Cairo)" },
   { F|O, "GraphicsFontTitle" , opt_general_graphics_font_title , "Helvetica" ,
     "Font used in the graphic window for titles" },
 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 93509fa4bd1e7b18db28fa0d7f73f883837eac62..8a5378e394c1adc606884b1071bd7586fe9ad5de 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -51,6 +51,7 @@
 #include "clippingWindow.h"
 #include "onelabGroup.h"
 #include "viewButton.h"
+#include "drawContextFltkCairo.h"
 #endif
 
 // General routines for string options
@@ -1232,6 +1233,36 @@ std::string opt_general_graphics_font_title(OPT_ARGS_STR)
   return CTX::instance()->glFontTitle;
 }
 
+std::string opt_general_graphics_font_engine(OPT_ARGS_STR)
+{
+  if(action & GMSH_SET)
+    CTX::instance()->glFontEngine = val;
+
+#if defined(HAVE_FLTK)
+  if(action & GMSH_SET){
+    drawContextGlobal *old = drawContext::global();
+    if(!old || old->getName() != CTX::instance()->glFontEngine){
+#if defined(HAVE_CAIRO)
+      if(CTX::instance()->glFontEngine == "Cairo")
+        drawContext::setGlobal(new drawContextFltkCairo);
+      else
+#endif
+        drawContext::setGlobal(new drawContextFltk);
+      if(old) delete old;
+    }
+  }
+  if(FlGui::available() && (action & GMSH_GUI)){
+    int index = 0;
+#if defined(HAVE_CAIRO)
+    if(CTX::instance()->glFontEngine == "Cairo") index = 1;
+#endif
+    FlGui::instance()->options->general.choice[7]->value(index);
+  }
+#endif
+
+  return CTX::instance()->glFontEngine;
+}
+
 std::string opt_solver_socket_name(OPT_ARGS_STR)
 {
   if(action & GMSH_SET)
diff --git a/Common/Options.h b/Common/Options.h
index f4fccb8721c56ab0824c8cc7ee7a63fb6a8a12ab..82d81c9100783607820972106ebc2e11be112d7c 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -51,6 +51,7 @@ std::string opt_general_watch_file_pattern(OPT_ARGS_STR);
 std::string opt_general_gui_theme(OPT_ARGS_STR);
 std::string opt_general_graphics_font(OPT_ARGS_STR);
 std::string opt_general_graphics_font_title(OPT_ARGS_STR);
+std::string opt_general_graphics_font_engine(OPT_ARGS_STR);
 std::string opt_solver_socket_name(OPT_ARGS_STR);
 std::string opt_solver_name(OPT_ARGS_STR);
 std::string opt_solver_name0(OPT_ARGS_STR);
diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp
index 23866fcf653af9e7911fadb6faac0ce6728c5272..fee6ad9a2b1c917260b53d3af4240c9329056385 100644
--- a/Fltk/FlGui.cpp
+++ b/Fltk/FlGui.cpp
@@ -234,17 +234,16 @@ FlGui::FlGui(int argc, char **argv)
   Fl::set_boxtype(GMSH_SIMPLE_RIGHT_BOX, simple_right_box_draw, 0, 0, 1, 0);
   Fl::set_boxtype(GMSH_SIMPLE_TOP_BOX, simple_top_box_draw, 0, 1, 0, 1);
 
-  if(CTX::instance()->gamepad)   Fl::add_timeout(5.,gamepad_handler , (void*)0);
+  // add gamepad handler
+  if(CTX::instance()->gamepad)
+    Fl::add_timeout(5.,gamepad_handler, (void*)0);
 
   // add global shortcuts
   Fl::add_handler(globalShortcut);
 
-  // set global fltk-dependent drawing functions
-#if defined(HAVE_CAIRO)
-  drawContext::setGlobal(new drawContextFltkCairo);
-#else
-  drawContext::setGlobal(new drawContextFltk);
-#endif
+  // make sure a global drawing context is setup
+  if(!drawContext::global())
+    drawContext::setGlobal(new drawContextFltk);
 
   // set default font size
   FL_NORMAL_SIZE = drawContext::global()->getFontSize();
diff --git a/Fltk/drawContextFltk.h b/Fltk/drawContextFltk.h
index 5dcacbfaa164a3896dbd19bbf5e313ac78c47f0e..9715e867d07f7be996ab42b04506c226844001ef 100644
--- a/Fltk/drawContextFltk.h
+++ b/Fltk/drawContextFltk.h
@@ -149,6 +149,7 @@ class drawContextFltk : public drawContextGlobal{
     gl_texture_pile_height(1); // force font texture recomputation
 #endif
   }
+  std::string getName(){ return "Fltk"; }
 };
 
 #endif
diff --git a/Fltk/drawContextFltkCairo.h b/Fltk/drawContextFltkCairo.h
index 28f043cb19a503f405c9b7eb43c08070a4fb7981..ec257f705b6989f93d9fa04fef89f02c1586a07f 100644
--- a/Fltk/drawContextFltkCairo.h
+++ b/Fltk/drawContextFltkCairo.h
@@ -32,6 +32,7 @@ class drawContextFltkCairo : public drawContextFltk {
   //int getStringDescent();
   void drawString(const char *str);
   void setFont(int fontid, int fontsize);
+  std::string getName(){ return "Cairo"; }
 };
 
 #endif
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index ea3700af06d3e2d347529e034e252855b0018691..dbd261eb33a549926f6deca069604cf8f63d1492 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -352,6 +352,7 @@ static void general_options_ok_cb(Fl_Widget *w, void *data)
   opt_general_vector_type(0, GMSH_SET, o->general.choice[0]->value() + 1);
   opt_general_graphics_font(0, GMSH_SET, o->general.choice[1]->text());
   opt_general_graphics_font_title(0, GMSH_SET, o->general.choice[6]->text());
+  opt_general_graphics_font_engine(0, GMSH_SET, o->general.choice[7]->text());
   opt_general_orthographic(0, GMSH_SET, !o->general.choice[2]->value());
   opt_general_axes(0, GMSH_SET, o->general.choice[4]->value());
   opt_general_background_gradient(0, GMSH_SET, o->general.choice[5]->value());
@@ -1674,25 +1675,39 @@ optionWindow::optionWindow(int deltaFontSize)
         (L + 2 * IW - 2 * WB, 2 * WB + 8 * BH, BB, BH, "Edit arrow");
       b->callback(general_arrow_param_cb);
 
+      static Fl_Menu_Item menu_font_engine[] = {
+        {"Native",   0, 0, 0},
+        {"Cairo",    0, 0, 0},
+        {0}
+      };
+      general.choice[7] = new Fl_Choice
+        (L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Font rendering engine");
+      general.choice[7]->menu(menu_font_engine);
+      general.choice[7]->align(FL_ALIGN_RIGHT);
+      general.choice[7]->callback(general_options_ok_cb);
+#if !defined(HAVE_CAIRO)
+      general.choice[7]->deactivate();
+#endif
+
       int w1 = (int)(4. * IW / 5.), w2 = IW - w1;
-      general.choice[1] = new Fl_Choice(L + 2 * WB, 2 * WB + 9 * BH, w1, BH);
+      general.choice[1] = new Fl_Choice(L + 2 * WB, 2 * WB + 10 * BH, w1, BH);
       general.choice[1]->menu(menu_font_names);
       general.choice[1]->align(FL_ALIGN_RIGHT);
       general.choice[1]->callback(general_options_ok_cb);
       general.value[12] = new Fl_Value_Input
-        (L + 2 * WB + w1, 2 * WB + 9 * BH, w2, BH, "Default font");
+        (L + 2 * WB + w1, 2 * WB + 10 * BH, w2, BH, "Default font");
       general.value[12]->minimum(5);
       general.value[12]->maximum(40);
       general.value[12]->step(1);
       general.value[12]->align(FL_ALIGN_RIGHT);
       general.value[12]->callback(general_options_ok_cb);
 
-      general.choice[6] = new Fl_Choice(L + 2 * WB, 2 * WB + 10 * BH, w1, BH);
+      general.choice[6] = new Fl_Choice(L + 2 * WB, 2 * WB + 11 * BH, w1, BH);
       general.choice[6]->menu(menu_font_names);
       general.choice[6]->align(FL_ALIGN_RIGHT);
       general.choice[6]->callback(general_options_ok_cb);
       general.value[28] = new Fl_Value_Input
-        (L + 2 * WB + w1, 2 * WB + 10 * BH, w2, BH, "Title font");
+        (L + 2 * WB + w1, 2 * WB + 11 * BH, w2, BH, "Title font");
       general.value[28]->minimum(5);
       general.value[28]->maximum(40);
       general.value[28]->step(1);
diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h
index ff1c1fd4d5b1335963968c319528d9b7cc0cd89b..8bbaef2f2d87f892924d45176d95d214d9671cb1 100644
--- a/Graphics/drawContext.h
+++ b/Graphics/drawContext.h
@@ -98,6 +98,7 @@ class drawContextGlobal {
   virtual int getStringDescent(){ return 3; }
   virtual void drawString(const char *str){}
   virtual void resetFontTextures(){}
+  virtual std::string getName(){ return "None"; }
 };
 
 class drawContext {