diff --git a/CHANGES b/CHANGES index 5b2b1a09e..d65553c05 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.1.8 + - Added access to Xft font pointer (STR #1328) - Fixed endianness in OS X mouse cursor graphics (STR #1348) - Fixed crash on mixed use of keyboard and mouse for diff --git a/FL/x.H b/FL/x.H index 91cbb9487..37194bc2b 100644 --- a/FL/x.H +++ b/FL/x.H @@ -69,6 +69,7 @@ extern FL_EXPORT Colormap fl_colormap; extern FL_EXPORT GC fl_gc; extern FL_EXPORT Window fl_window; extern FL_EXPORT XFontStruct* fl_xfont; +extern FL_EXPORT void *fl_xftfont; FL_EXPORT ulong fl_xpixel(Fl_Color i); FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b); FL_EXPORT void fl_clip_region(Fl_Region); diff --git a/documentation/osissues.html b/documentation/osissues.html index 3d5b9d767..95050cf0b 100644 --- a/documentation/osissues.html +++ b/documentation/osissues.html @@ -139,7 +139,17 @@ href="drawing.html#fl_color">fl_color() would use. href="drawing.html#fl_font">fl_font(). This is not necessarily the current font of fl_gc, which is not set until fl_draw() is -called. +called. If FLTK was compiled with Xft support, fl_xfont +will usually be 0 and fl_xftfont will contain a pointer +to the XftFont structure instead. + +

extern void *fl_xftfont

+ +

If FLTK was compiled with Xft support enabled, fl_xftfont +Points to the xft font selected by the most recent fl_font(). Otherwise +it will be 0. fl_xftfont should be casted to +XftFont*.

Changing the Display, Screen, or X Visual

diff --git a/src/fl_font_x.cxx b/src/fl_font_x.cxx index 6540cc275..2723a2197 100644 --- a/src/fl_font_x.cxx +++ b/src/fl_font_x.cxx @@ -196,6 +196,7 @@ static Fl_FontSize* find(int fnum, int size) { int fl_font_ = 0; int fl_size_ = 0; XFontStruct* fl_xfont = 0; +void *fl_xftfont = 0; static GC font_gc; void fl_font(int fnum, int size) { diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx index 1c6a451da..71fb3736d 100644 --- a/src/fl_font_xft.cxx +++ b/src/fl_font_xft.cxx @@ -91,6 +91,7 @@ Fl_Fontdesc* fl_fonts = built_in_table; int fl_font_ = 0; int fl_size_ = 0; XFontStruct* fl_xfont = 0; +void *fl_xftfont = 0; const char* fl_encoding_ = "iso8859-1"; Fl_FontSize* fl_fontsize = 0; @@ -116,6 +117,7 @@ void fl_font(int fnum, int size) { #if XFT_MAJOR < 2 fl_xfont = f->font->u.core.font; #endif // XFT_MAJOR < 2 + fl_xftfont = (void*)f->font; } static XftFont* fontopen(const char* name, bool core) {