Skip to content

Commit

Permalink
Documentation improvements:
Browse files Browse the repository at this point in the history
	o Added fl_text_extents() to the 'Drawing things in FLTK' section
	o Added 'see also' sections to all the text measuring functions in that section
	o Added detail to fl_text_extents() docs regarding it not handling FLTK symbols,
	  as non-public comment for that method indicates.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9463 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
erco77 committed May 8, 2012
1 parent 21520a3 commit ebf71d6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions FL/fl_draw.H
Expand Up @@ -528,6 +528,8 @@ inline double fl_width(unsigned int c) {return fl_graphics_driver->width(c);}
such that a bounding box that exactly fits around the text could be drawn with
fl_rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the first
"colored in" pixel of the string, from the draw origin.
No FLTK symbol expansion will be performed.
*/
FL_EXPORT void fl_text_extents(const char*, int& dx, int& dy, int& w, int& h); // NO fltk symbol expansion will be performed
/** Determines the minimum pixel dimensions of a sequence of \p n characters.
Expand Down
32 changes: 31 additions & 1 deletion documentation/src/drawing.dox
Expand Up @@ -627,8 +627,18 @@ void fl_measure(const char *str, int& w, int& h, int draw_symbols)

\par
Measure how wide and tall the string will be when printed by
the \p fl_draw(...align) function.
the \p fl_draw(...align) function. This includes leading/trailing
white space in the string, kerning, etc.
\par
If the incoming \p w is non-zero it will wrap to that width.
\par
Refer to the full documentation for fl_measure() for details
on usage and how to avoide common pitfalls.

\see fl_text_extents() -- measure the 'inked' area of a string
\see fl_width() -- measure the pixel width of a string or single character
\see fl_height() -- measure the pixel height of the current font
\see fl_descent() -- the height of the descender for the current font

int fl_height()

Expand All @@ -637,6 +647,8 @@ Recommended minimum line spacing for the current font. You
can also just use the value of \p size passed to
\ref drawing_fl_font "fl_font()".

\see fl_text_extents(), fl_measure(), fl_width(), fl_descent()

int fl_descent()

\par
Expand All @@ -651,6 +663,24 @@ double fl_width(unsigned int unicode_char)
Return the pixel width of a nul-terminated string, a sequence of \p n
characters, or a single character in the current font.

\see fl_measure(), fl_text_extents(), fl_height(), fl_descent()

void fl_text_extents(const char* txt, int& dx, int& dy, int& w, int& h)

\par
Determines the minimum pixel dimensions of a nul-terminated string,
ie. the 'inked area'.
\par
Given a string "txt" drawn using fl_draw(txt, x, y) you would determine
its pixel extents on the display using fl_text_extents(txt, dx, dy, wo, ho)
such that a bounding box that exactly fits around the inked area of the text
could be drawn with fl_rect(x+dx, y+dy, wo, ho).
\par
Refer to the full documentation for fl_text_extents() for details
on usage.

\see fl_measure(), fl_width(), fl_height(), fl_descent()

const char* fl_shortcut_label(int shortcut)

\par
Expand Down

0 comments on commit ebf71d6

Please sign in to comment.