fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

fl_font.cxx

Go to the documentation of this file.
00001 //
00002 // "$Id: fl_font.cxx 8126 2010-12-28 12:02:23Z manolo $"
00003 //
00004 // Font selection code for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2010 by Bill Spitzak and others.
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems on the following page:
00024 //
00025 //     http://www.fltk.org/str.php
00026 //
00027 
00028 #ifdef WIN32
00029 #ifndef WIN32_LEAN_AND_MEAN
00030 # define WIN32_LEAN_AND_MEAN
00031 #endif
00032 /* We require Windows 2000 features such as GetGlyphIndices */
00033 # if !defined(WINVER) || (WINVER < 0x0500)
00034 #  define WINVER 0x0500
00035 # endif
00036 # if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
00037 #  define _WIN32_WINNT 0x0500
00038 # endif
00039 #endif
00040 
00041 // Select fonts from the FLTK font table.
00042 #include "flstring.h"
00043 #include <FL/Fl.H>
00044 #include <FL/fl_draw.H>
00045 #include <FL/x.H>
00046 #include "Fl_Font.H"
00047 
00048 #include <stdio.h>
00049 #include <stdlib.h>
00050 
00051 #ifdef WIN32
00052 #  include "fl_font_win32.cxx"
00053 #elif defined(__APPLE__)
00054 #  include "fl_font_mac.cxx"
00055 #elif USE_XFT
00056 #  include "fl_font_xft.cxx"
00057 #else
00058 #  include "fl_font_x.cxx"
00059 #endif // WIN32
00060 
00061 
00062 double fl_width(const char* c) {
00063   if (c) return fl_width(c, strlen(c));
00064   else return 0.0f;
00065 }
00066 
00067 void fl_draw(const char* str, int x, int y) {
00068   fl_draw(str, strlen(str), x, y);
00069 }
00070 
00071 void fl_draw(int angle, const char* str, int x, int y) {
00072   fl_draw(angle, str, strlen(str), x, y);//must be fixed!
00073 }
00074 
00075 void fl_text_extents(const char *c, int &dx, int &dy, int &w, int &h) {
00076   if (c)  fl_text_extents(c, strlen(c), dx, dy, w, h);
00077   else {
00078     w = 0; h = 0;
00079     dx = 0; dy = 0;
00080   }
00081 } // fl_text_extents
00082 
00083 
00084 #ifndef __APPLE__
00085 void fl_draw(const char* str, int l, float x, float y) {
00086   fl_draw(str, l, (int)x, (int)y);
00087 }
00088 #endif
00089 //
00090 // End of "$Id: fl_font.cxx 8126 2010-12-28 12:02:23Z manolo $".
00091 //