summaryrefslogtreecommitdiff
path: root/src/fl_font_x.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2004-09-07 20:59:18 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2004-09-07 20:59:18 +0000
commita8b58dc223afc42c36a551ae6d6992e6bb02b2c7 (patch)
tree020372d5a0e154851dec8a51618de232b81b228f /src/fl_font_x.cxx
parentd7fe9245b4f976d220469f321b100ffc217ccc59 (diff)
Documentation updates (STR #505, STR #513)
The old source file "fl_set_gray.cxx" is not needed (STR #516) Fl_Text_Display still called delete[] instead of free() in one place (STR #503) Fl_File_Chooser didn't correctly call isprint() and isspace() when checking to see if the current file was text that can be previewed (STR #517) FLUID didn't compile with Borland C++ due to a compiler bug (STR #496) Fl_Positioner did not handle reversed min and max values (STR #510) fl_descent(), fl_height(), and fl_width() would crash a program if you didn't call fl_font() first; they now return -1 if no font is set (STR #500) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3805 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_font_x.cxx')
-rw-r--r--src/fl_font_x.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/fl_font_x.cxx b/src/fl_font_x.cxx
index ce572d2bf..0c87ba536 100644
--- a/src/fl_font_x.cxx
+++ b/src/fl_font_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_font_x.cxx,v 1.10.2.5 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_font_x.cxx,v 1.10.2.6 2004/09/07 20:59:17 easysw Exp $"
//
// Standard X11 font selection code for the Fast Light Tool Kit (FLTK).
//
@@ -208,14 +208,17 @@ void fl_font(int fnum, int size) {
}
int fl_height() {
- return (fl_xfont->ascent + fl_xfont->descent);
+ if (fl_xfont) return (fl_xfont->ascent + fl_xfont->descent);
+ else return -1;
}
int fl_descent() {
- return fl_xfont->descent;
+ if (fl_xfont) return fl_xfont->descent;
+ else return -1;
}
double fl_width(const char* c, int n) {
+ if (!fl_xfont) return -1.0;
XCharStruct* p = fl_xfont->per_char;
if (!p) return n*fl_xfont->min_bounds.width;
int a = fl_xfont->min_char_or_byte2;
@@ -230,6 +233,7 @@ double fl_width(const char* c, int n) {
}
double fl_width(uchar c) {
+ if (!fl_xfont) return -1;
XCharStruct* p = fl_xfont->per_char;
if (p) {
int a = fl_xfont->min_char_or_byte2;
@@ -250,5 +254,5 @@ void fl_draw(const char* str, int n, int x, int y) {
}
//
-// End of "$Id: fl_font_x.cxx,v 1.10.2.5 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_font_x.cxx,v 1.10.2.6 2004/09/07 20:59:17 easysw Exp $".
//