gl_font() didn't work properly for X11 when Xft was used (STR #12)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2976 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2003-05-04 21:58:59 +00:00
parent 13005b2a3f
commit e2baef33cd
3 changed files with 27 additions and 4 deletions
+2
View File
@@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.4 CHANGES IN FLTK 1.1.4
- gl_font() didn't work properly for X11 when Xft was
used (STR #12)
- Fl_File_Browser incorrectly included "." on WIN32 (STR - Fl_File_Browser incorrectly included "." on WIN32 (STR
#9) #9)
- Include shellapi.h instead of ShellAPI.h in the WIN32 - Include shellapi.h instead of ShellAPI.h in the WIN32
+16 -2
View File
@@ -1,5 +1,5 @@
// //
// "$Id: fl_font_xft.cxx,v 1.4.2.10 2003/01/30 21:43:54 easysw Exp $" // "$Id: fl_font_xft.cxx,v 1.4.2.11 2003/05/04 21:58:59 easysw Exp $"
// //
// Xft font code for the Fast Light Tool Kit (FLTK). // Xft font code for the Fast Light Tool Kit (FLTK).
// //
@@ -142,6 +142,9 @@ static XftFont* fontopen(const char* name, bool core) {
Fl_FontSize::Fl_FontSize(const char* name) { Fl_FontSize::Fl_FontSize(const char* name) {
encoding = fl_encoding_; encoding = fl_encoding_;
size = fl_size_; size = fl_size_;
#if HAVE_GL
listbase = 0;
#endif // HAVE_GL
font = fontopen(name, false); font = fontopen(name, false);
} }
@@ -163,6 +166,17 @@ double fl_width(uchar c) {
return fl_width((const char *)(&c), 1); return fl_width((const char *)(&c), 1);
} }
#if HAVE_GL
// This call is used by opengl to get a bitmapped font.
XFontStruct* fl_xxfont() {
if (current_font->core) return current_font->u.core.font;
static XftFont* xftfont;
if (xftfont) XftFontClose (fl_display, xftfont);
xftfont = fontopen(fl_fonts[fl_font_].name, true);
return xftfont->u.core.font;
}
#endif // HAVE_GL
#if USE_OVERLAY #if USE_OVERLAY
// Currently Xft does not work with colormapped visuals, so this probably // Currently Xft does not work with colormapped visuals, so this probably
// does not work unless you have a true-color overlay. // does not work unless you have a true-color overlay.
@@ -226,5 +240,5 @@ void fl_draw(const char *str, int n, int x, int y) {
} }
// //
// End of "$Id: fl_font_xft.cxx,v 1.4.2.10 2003/01/30 21:43:54 easysw Exp $" // End of "$Id: fl_font_xft.cxx,v 1.4.2.11 2003/05/04 21:58:59 easysw Exp $"
// //
+9 -2
View File
@@ -1,5 +1,5 @@
// //
// "$Id: gl_draw.cxx,v 1.7.2.5.2.10 2003/01/30 21:44:33 easysw Exp $" // "$Id: gl_draw.cxx,v 1.7.2.5.2.11 2003/05/04 21:58:59 easysw Exp $"
// //
// OpenGL drawing support routines for the Fast Light Tool Kit (FLTK). // OpenGL drawing support routines for the Fast Light Tool Kit (FLTK).
// //
@@ -36,6 +36,10 @@
#include "Fl_Gl_Choice.H" #include "Fl_Gl_Choice.H"
#include "Fl_Font.H" #include "Fl_Font.H"
#if USE_XFT
extern XFontStruct* fl_xxfont();
#endif // USE_XFT
int gl_height() {return fl_height();} int gl_height() {return fl_height();}
int gl_descent() {return fl_descent();} int gl_descent() {return fl_descent();}
double gl_width(const char* s) {return fl_width(s);} double gl_width(const char* s) {return fl_width(s);}
@@ -58,6 +62,9 @@ void gl_font(int fontid, int size) {
aglUseFont(aglGetCurrentContext(), fl_fontsize->font, fl_fontsize->face, aglUseFont(aglGetCurrentContext(), fl_fontsize->font, fl_fontsize->face,
fl_fontsize->size, 0, 256, fl_fontsize->listbase); fl_fontsize->size, 0, 256, fl_fontsize->listbase);
#else #else
# if USE_XFT
fl_xfont = fl_xxfont();
# endif // USE_XFT
int base = fl_xfont->min_char_or_byte2; int base = fl_xfont->min_char_or_byte2;
int count = fl_xfont->max_char_or_byte2-base+1; int count = fl_xfont->max_char_or_byte2-base+1;
fl_fontsize->listbase = glGenLists(256); fl_fontsize->listbase = glGenLists(256);
@@ -159,5 +166,5 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) {
#endif #endif
// //
// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.10 2003/01/30 21:44:33 easysw Exp $". // End of "$Id: gl_draw.cxx,v 1.7.2.5.2.11 2003/05/04 21:58:59 easysw Exp $".
// //