More font magic from Bill.

git-svn-id: file:///fltk/svn/fltk/trunk@111 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1998-12-02 15:53:22 +00:00
parent 2af9c8eba6
commit 00422021c1
2 changed files with 17 additions and 17 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_font.cxx,v 1.5 1998/12/02 15:51:35 mike Exp $"
// "$Id: fl_font.cxx,v 1.6 1998/12/02 15:53:22 mike Exp $"
//
// Font selection code for the Fast Light Tool Kit (FLTK).
//
@ -50,7 +50,7 @@ Fl_FontSize::Fl_FontSize(const char* name) {
#endif
}
Fl_FontSize* fl_current_xfont;
Fl_FontSize* fl_fontsize;
Fl_FontSize::~Fl_FontSize() {
#if HAVE_GL
@ -64,7 +64,7 @@ Fl_FontSize::~Fl_FontSize() {
// glDeleteLists(listbase+base,size);
// }
#endif
if (this == fl_current_xfont) fl_current_xfont = 0;
if (this == fl_fontsize) fl_fontsize = 0;
XFreeFont(fl_display, font);
}
@ -223,8 +223,8 @@ void fl_font(int fnum, int size) {
if (fnum == fl_font_ && size == fl_size_) return;
fl_font_ = fnum; fl_size_ = size;
Fl_FontSize* f = find(fnum, size);
if (f != fl_current_xfont) {
fl_current_xfont = f;
if (f != fl_fontsize) {
fl_fontsize = f;
fl_xfont = f->font;
font_gc = 0;
}
@ -292,5 +292,5 @@ void fl_draw(const char* str, int x, int y) {
#endif
//
// End of "$Id: fl_font.cxx,v 1.5 1998/12/02 15:51:35 mike Exp $".
// End of "$Id: fl_font.cxx,v 1.6 1998/12/02 15:53:22 mike Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_font_win32.cxx,v 1.7 1998/12/02 15:51:36 mike Exp $"
// "$Id: fl_font_win32.cxx,v 1.8 1998/12/02 15:53:22 mike Exp $"
//
// WIN32 font selection routines for the Fast Light Tool Kit (FLTK).
//
@ -71,7 +71,7 @@ Fl_FontSize::Fl_FontSize(const char* name, int size) {
minsize = maxsize = size;
}
Fl_FontSize* fl_current_xfont;
Fl_FontSize* fl_fontsize;
Fl_FontSize::~Fl_FontSize() {
#if HAVE_GL
@ -85,7 +85,7 @@ Fl_FontSize::~Fl_FontSize() {
// glDeleteLists(listbase+base,size);
// }
#endif
if (this == fl_current_xfont) fl_current_xfont = 0;
if (this == fl_fontsize) fl_fontsize = 0;
DeleteObject(fid);
}
@ -136,36 +136,36 @@ int fl_size_;
void fl_font(int fnum, int size) {
if (fnum == fl_font_ && size == fl_size_) return;
fl_font_ = fnum; fl_size_ = size;
fl_current_xfont = find(fnum, size);
fl_fontsize = find(fnum, size);
}
int fl_height() {
return (fl_current_xfont->metr.tmAscent + fl_current_xfont->metr.tmDescent);
return (fl_fontsize->metr.tmAscent + fl_fontsize->metr.tmDescent);
}
int fl_descent() {
return fl_current_xfont->metr.tmDescent;
return fl_fontsize->metr.tmDescent;
}
double fl_width(const char* c) {
double w = 0.0;
while (*c) w += fl_current_xfont->width[uchar(*c++)];
while (*c) w += fl_fontsize->width[uchar(*c++)];
return w;
}
double fl_width(const char* c, int n) {
double w = 0.0;
while (n--) w += fl_current_xfont->width[uchar(*c++)];
while (n--) w += fl_fontsize->width[uchar(*c++)];
return w;
}
double fl_width(uchar c) {
return fl_current_xfont->width[c];
return fl_fontsize->width[c];
}
void fl_draw(const char* str, int n, int x, int y) {
SetTextColor(fl_gc, fl_RGB());
SelectObject(fl_gc, fl_current_xfont->fid);
SelectObject(fl_gc, fl_fontsize->fid);
TextOut(fl_gc, x, y, str, n);
}
@ -174,5 +174,5 @@ void fl_draw(const char* str, int x, int y) {
}
//
// End of "$Id: fl_font_win32.cxx,v 1.7 1998/12/02 15:51:36 mike Exp $".
// End of "$Id: fl_font_win32.cxx,v 1.8 1998/12/02 15:53:22 mike Exp $".
//