diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-02-03 17:30:54 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-02-03 17:30:54 +0100 |
| commit | 97554a88ccaa622b98b7968da79a56b4b008e097 (patch) | |
| tree | 8a458ac481b12041652fa1f8d334311761303707 | |
| parent | dd3485c57a0ef7ffa5e00edc9fb9937004f3ca54 (diff) | |
Move fl_font(face, size) to fl_draw.cxx
I believe this is a better place.
Also: add FL_EXPORT since it's no longer inline.
| -rw-r--r-- | FL/fl_draw.H | 4 | ||||
| -rw-r--r-- | src/Fl_Graphics_Driver.cxx | 16 | ||||
| -rw-r--r-- | src/fl_draw.cxx | 23 |
3 files changed, 22 insertions, 21 deletions
diff --git a/FL/fl_draw.H b/FL/fl_draw.H index 04d3b14d6..9ae32f3c4 100644 --- a/FL/fl_draw.H +++ b/FL/fl_draw.H @@ -576,9 +576,9 @@ FL_EXPORT void fl_rescale_offscreen(Fl_Offscreen &ctx); // Fonts: /* Sets the current font, which is then used in various drawing routines. - Implemented and documented in src/Fl_Graphics_Driver.cxx + Implemented and documented in src/fl_draw.cxx */ -void fl_font(Fl_Font face, Fl_Fontsize fsize); +FL_EXPORT void fl_font(Fl_Font face, Fl_Fontsize fsize); /** Returns the \p face set by the most recent call to fl_font(). diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index 3d1b720cd..0fbe80106 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -557,22 +557,6 @@ void Fl_Graphics_Driver::rtl_draw(const char *str, int nChars, int x, int y) { /** Returns non-zero if the graphics driver possesses the \p feature */ int Fl_Graphics_Driver::has_feature(driver_feature feature) { return 0; } -/** - Sets the current font, which is then used in various drawing routines. - You may call this outside a draw context if necessary to measure text, - for instance by calling fl_width(), fl_measure(), or fl_text_extents(), - but on X this will open the display. - - The font is identified by a \p face and a \p size. - The size of the font is measured in pixels and not "points". - Lines should be spaced \p size pixels apart or more. -*/ -void fl_font(Fl_Font face, Fl_Fontsize fsize) { - if (!fl_graphics_driver) - fl_open_display(); - fl_graphics_driver->font(face, fsize); -} - /** see fl_font(Fl_Font, Fl_Fontsize) */ void Fl_Graphics_Driver::font(Fl_Font face, Fl_Fontsize fsize) {font_ = face; size_ = fsize;} diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index 137dfaf8d..79a1f990a 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -3,17 +3,17 @@ // // Label drawing code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2016 by Bill Spitzak and others. +// Copyright 1998-2020 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 // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // // Please report all bugs and problems on the following page: // -// http://www.fltk.org/str.php +// https://www.fltk.org/str.php // // Implementation of fl_draw(const char*,int,int,int,int,Fl_Align) @@ -27,6 +27,7 @@ #include <FL/Fl.H> #include <FL/fl_draw.H> #include <FL/Fl_Image.H> +#include <FL/platform.H> // fl_open_display() #include "flstring.h" #include <ctype.h> @@ -420,6 +421,22 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) { } /** + Sets the current font, which is then used in various drawing routines. + You may call this outside a draw context if necessary to measure text, + for instance by calling fl_width(), fl_measure(), or fl_text_extents(), + but on X this will open the display. + + The font is identified by a \p face and a \p size. + The size of the font is measured in pixels and not "points". + Lines should be spaced \p size pixels apart or more. +*/ +void fl_font(Fl_Font face, Fl_Fontsize fsize) { + if (!fl_graphics_driver) + fl_open_display(); + fl_graphics_driver->font(face, fsize); +} + +/** This function returns the actual height of the specified \p font and \p size. Normally the font height should always be 'size', but with the advent of XFT, there are (currently) complexities |
