diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2016-07-24 08:55:02 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2016-07-24 08:55:02 +0000 |
| commit | a633de6461f5f494d105c957d6efd43dadb193d4 (patch) | |
| tree | 3e20ce6892235d6d9a19708f02408cf712875c91 /src/fl_draw.cxx | |
| parent | 54dcf145feb39f4eb2e9cd78de2ce469acd3e28c (diff) | |
Doc changes: set fl_font before fl_measure() (STR #3243)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11848 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_draw.cxx')
| -rw-r--r-- | src/fl_draw.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index bf02f9d8e..d6e184002 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -3,7 +3,7 @@ // // Label drawing code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2011 by Bill Spitzak and others. +// Copyright 1998-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -118,7 +118,7 @@ static const char* expand_text_(const char* from, char*& buf, int maxbuf, double Also word-wrap if width exceeds maxw. Returns a pointer to the start of the next line of characters. Sets n to the number of characters put into the buffer. - Sets width to the width of the string in the current font. + Sets width to the width of the string in the \ref drawing_fl_font "current font". */ const char* fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n, @@ -343,9 +343,13 @@ void fl_draw( fl_draw() function with \p align parameter. If the incoming \p w is non-zero it will wrap to that width. - The 'current font' is used to do the width/height calculations, - so unless its value is known at the time fl_measure() is called, - it is advised to first set the current font with fl_font(). + The \ref drawing_fl_font "current font" is used to do the width/height + calculations, so unless its value is known at the time fl_measure() is + called, it is advised to first set the current font with fl_font(). + With event-driven GUI programming you can never be sure which + widget was exposed and redrawn last, nor which font it used. + If you have not called fl_font() explicitly in your own code, + the width and height may be set to unexpected values, even zero! \b Note: In the general use case, it's a common error to forget to set \p w to 0 before calling fl_measure() when wrap behavior isn't needed. |
