themes: Workaround for bug where a background color of RGB 0,0,0 in Black color schem...
[ntk.git] / src / fl_font.cxx
blobe208ed7923d477b33fc45419c77e4ebf2dcccfed
1 //
2 // "$Id: fl_font.cxx 8722 2011-05-23 16:06:13Z ianmacarthur $"
3 //
4 // Font selection code for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 #ifdef WIN32
29 # ifndef WIN32_LEAN_AND_MEAN
30 # define WIN32_LEAN_AND_MEAN
31 # endif
32 /* We require Windows 2000 features such as GetGlyphIndices */
33 # if !defined(WINVER) || (WINVER < 0x0500)
34 # ifdef WINVER
35 # undef WINVER
36 # endif
37 # define WINVER 0x0500
38 # endif
39 # if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
40 # ifdef _WIN32_WINNT
41 # undef _WIN32_WINNT
42 # endif
43 # define _WIN32_WINNT 0x0500
44 # endif
45 #endif
47 // Select fonts from the FLTK font table.
48 #include "flstring.h"
49 #include <FL/Fl.H>
50 #include <FL/fl_draw.H>
51 #include <FL/x.H>
52 #include "Fl_Font.H"
54 #include <stdio.h>
55 #include <stdlib.h>
57 #ifdef WIN32
58 # include "fl_font_win32.cxx"
59 #elif defined(__APPLE__)
60 # include "fl_font_mac.cxx"
61 #elif USE_XFT
62 # include "fl_font_xft.cxx"
63 #else
64 # include "fl_font_x.cxx"
65 #endif // WIN32
68 double fl_width(const char* c) {
69 if (c) return fl_width(c, strlen(c));
70 else return 0.0f;
73 void fl_draw(const char* str, int x, int y) {
74 fl_draw(str, strlen(str), x, y);
77 void fl_draw(int angle, const char* str, int x, int y) {
78 fl_draw(angle, str, strlen(str), x, y);//must be fixed!
81 void fl_text_extents(const char *c, int &dx, int &dy, int &w, int &h) {
82 if (c) fl_text_extents(c, strlen(c), dx, dy, w, h);
83 else {
84 w = 0; h = 0;
85 dx = 0; dy = 0;
87 } // fl_text_extents
90 void fl_draw(const char* str, int l, float x, float y) {
91 #ifdef __APPLE__
92 fl_graphics_driver->draw(str, l, x, y);
93 #else
94 fl_draw(str, l, (int)x, (int)y);
95 #endif
98 // End of "$Id: fl_font.cxx 8722 2011-05-23 16:06:13Z ianmacarthur $".