diff options
| author | Manolo Gouy <Manolo> | 2016-09-22 07:44:34 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-09-22 07:44:34 +0000 |
| commit | 02535d122296b00a99fa30e0253f83c82f177894 (patch) | |
| tree | fa232bb98a668be9a3b51e4f6c77c230a4ae9cf0 /src/drivers/Xlib | |
| parent | 145cca26bda55a98adc8c85bea5152e9c3834392 (diff) | |
Rewrite Fl::set_fonts(), Fl::get_font_sizes(), Fl::get_font_name() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11965 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Xlib')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx | 7 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx index 766fd0673..d1f28e831 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx @@ -19,6 +19,7 @@ // Select fonts from the FLTK font table. #include "../../flstring.h" #include "Fl_Xlib_Graphics_Driver.H" +#include "../X11/Fl_X11_Screen_Driver.H" #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/x.H> @@ -93,7 +94,7 @@ static int use_registry(const char *p) { #define ENDOFBUFFER 127 // sizeof(Fl_Font.fontname)-1 // turn a stored (with *'s) X font name into a pretty name: -const char* Fl::get_font_name(Fl_Font fnum, int* ap) { +const char* Fl_X11_Screen_Driver::get_font_name(Fl_Font fnum, int* ap) { Fl_Fontdesc *f = fl_fonts + fnum; if (!f->fontname[0]) { int type = 0; @@ -264,7 +265,7 @@ static int to_canonical(char *to, const char *from, size_t tolen) { static unsigned int fl_free_font = FL_FREE_FONT; -Fl_Font Fl::set_fonts(const char* xstarname) { +Fl_Font Fl_X11_Screen_Driver::set_fonts(const char* xstarname) { if (fl_free_font > (unsigned)FL_FREE_FONT) // already been here return (Fl_Font)fl_free_font; fl_open_display(); @@ -317,7 +318,7 @@ Fl_Font Fl::set_fonts(const char* xstarname) { return (Fl_Font)fl_free_font; } -int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) { +int Fl_X11_Screen_Driver::get_font_sizes(Fl_Font fnum, int*& sizep) { Fl_Fontdesc *s = fl_fonts+fnum; if (!s->name) s = fl_fonts; // empty slot in table, use entry 0 if (!s->xlist) { diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx index befb90ea0..0e5f8cb71 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx @@ -19,6 +19,7 @@ // Select fonts from the FLTK font table. #include "../../flstring.h" #include "Fl_Xlib_Graphics_Driver.H" +#include "../X11/Fl_X11_Screen_Driver.H" #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/x.H> @@ -43,7 +44,7 @@ #define USE_OVERLAY 0 // turn a stored font name in "fltk format" into a pretty name: -const char* Fl::get_font_name(Fl_Font fnum, int* ap) { +const char* Fl_X11_Screen_Driver::get_font_name(Fl_Font fnum, int* ap) { Fl_Fontdesc *f = fl_fonts + fnum; if (!f->fontname[0]) { const char* p = f->name; @@ -217,7 +218,7 @@ static int fl_free_font = FL_FREE_FONT; // Also, for now I'm ignoring the "pattern_name" and just getting everything... // AND I don't try and skip the fonts we've already loaded in the defaults. // Blimey! What a hack! -Fl_Font Fl::set_fonts(const char* pattern_name) +Fl_Font Fl_X11_Screen_Driver::set_fonts(const char* pattern_name) { FcFontSet *fnt_set; // Will hold the list of fonts we find FcPattern *fnt_pattern; // Holds the generic "match all names" pattern @@ -363,11 +364,11 @@ static int int_sort(const void *aa, const void *bb) { // Return all the point sizes supported by this font: // Suprisingly enough Xft works exactly like fltk does and returns // the same list. Except there is no way to tell if the font is scalable. -int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) { +int Fl_X11_Screen_Driver::get_font_sizes(Fl_Font fnum, int*& sizep) { Fl_Fontdesc *s = fl_fonts+fnum; if (!s->name) s = fl_fonts; // empty slot in table, use entry 0 - fl_open_display(); + open_display(); XftFontSet* fs = XftListFonts(fl_display, fl_screen, XFT_FAMILY, XftTypeString, s->name+1, (void *)0, |
