FLTK 1.3.0
Fl_Font.H
00001 //
00002 // "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $"
00003 //
00004 // Font definitions for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2011 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 // Two internal fltk data structures:
00029 //
00030 // Fl_Fontdesc: an entry into the fl_font() table.  There is one of these
00031 // for each fltk font number.
00032 //
00033 #ifndef FL_FONT_
00034 #define FL_FONT_
00035 
00036 #include <config.h>
00037 
00038 #  if USE_XFT
00039 typedef struct _XftFont XftFont;
00040 #  elif !defined(WIN32) && !defined(__APPLE__)
00041 #    include <FL/Xutf8.h>
00042 #  endif // USE_XFT
00043 
00050 class Fl_Font_Descriptor {
00051 public:
00053   Fl_Font_Descriptor *next;     
00054   Fl_Fontsize size; 
00055 #ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc. 
00056 #  ifdef WIN32
00057   HFONT fid;
00058   int *width[64];
00059   TEXTMETRIC metr;
00060   int angle;
00061   FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
00062 #  elif defined(__APPLE_QUARTZ__)
00063   FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
00064   ATSUTextLayout layout;
00065 #     if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
00066   CTFontRef fontref;
00067   // the unicode span is divided in 512 blocks of 128 characters
00068   float *width[512]; // array of arrays of character widths
00069 #     endif
00070   ATSUStyle style;
00071   short ascent, descent, q_width;
00072   char *q_name;
00073 #  elif USE_XFT
00074   XftFont* font;
00075   //const char* encoding;
00076   int angle;
00077   FL_EXPORT Fl_Font_Descriptor(const char* xfontname, Fl_Fontsize size, int angle);
00078 #  else
00079   XUtf8FontStruct* font;        // X UTF-8 font information
00080   FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
00081 #  endif
00082 #  if HAVE_GL
00083   unsigned int listbase;// base of display list, 0 = none
00084 #ifndef __APPLE_QUARTZ__
00085   char glok[64];
00086 #endif // __APPLE_QUARTZ__
00087 #  endif // HAVE_GL
00088 
00089   FL_EXPORT ~Fl_Font_Descriptor();
00090 
00091 #endif // FL_DOXYGEN
00092 };
00093 
00094 //extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
00095 
00096 struct Fl_Fontdesc {
00097   const char *name;
00098   char fontname[128];   // "Pretty" font name
00099   Fl_Font_Descriptor *first;    // linked list of sizes of this style
00100 #  ifndef WIN32
00101   char **xlist;         // matched X font names
00102   int n;                // size of xlist, negative = don't free xlist!
00103 #  endif
00104 };
00105 
00106 extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table
00107 
00108 #  ifndef WIN32
00109 // functions for parsing X font names:
00110 FL_EXPORT const char* fl_font_word(const char *p, int n);
00111 FL_EXPORT char *fl_find_fontsize(char *name);
00112 #  endif
00113 
00114 #endif
00115 
00116 //
00117 // End of "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $".
00118 //