FLTK 1.3.0
Fl_Font.H
00001 //
00002 // "$Id$"
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. Distribution and use rights are outlined in
00009 // the file "COPYING" which should have been included with this file.  If this
00010 // file is missing or damaged, see the license at:
00011 //
00012 //     http://www.fltk.org/COPYING.php
00013 //
00014 // Please report all bugs and problems on the following page:
00015 //
00016 //     http://www.fltk.org/str.php
00017 //
00018 
00019 // Two internal fltk data structures:
00020 //
00021 // Fl_Fontdesc: an entry into the fl_font() table.  There is one of these
00022 // for each fltk font number.
00023 //
00024 #ifndef FL_FONT_
00025 #define FL_FONT_
00026 
00027 #include <config.h>
00028 
00029 #  if USE_XFT
00030 typedef struct _XftFont XftFont;
00031 #  elif !defined(WIN32) && !defined(__APPLE__)
00032 #    include <FL/Xutf8.h>
00033 #  endif // USE_XFT
00034 
00041 class Fl_Font_Descriptor {
00042 public:
00044   Fl_Font_Descriptor *next;     
00045   Fl_Fontsize size; 
00046 #ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc. 
00047 #  ifdef WIN32
00048   HFONT fid;
00049   int *width[64];
00050   TEXTMETRIC metr;
00051   int angle;
00052   FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
00053 #  elif defined(__APPLE_QUARTZ__)
00054   FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
00055   ATSUTextLayout layout;
00056 #     if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
00057   CTFontRef fontref;
00058   // the unicode span is divided in 512 blocks of 128 characters
00059   float *width[512]; // array of arrays of character widths
00060 #     endif
00061   ATSUStyle style;
00062   short ascent, descent, q_width;
00063   char *q_name;
00064 #  elif USE_XFT
00065   XftFont* font;
00066   //const char* encoding;
00067   int angle;
00068   FL_EXPORT Fl_Font_Descriptor(const char* xfontname, Fl_Fontsize size, int angle);
00069 #  else
00070   XUtf8FontStruct* font;        // X UTF-8 font information
00071   FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
00072 #  endif
00073 #  if HAVE_GL
00074   unsigned int listbase;// base of display list, 0 = none
00075 #ifndef __APPLE_QUARTZ__
00076   char glok[64];
00077 #endif // __APPLE_QUARTZ__
00078 #  endif // HAVE_GL
00079 
00080   FL_EXPORT ~Fl_Font_Descriptor();
00081 
00082 #endif // FL_DOXYGEN
00083 };
00084 
00085 //extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
00086 
00087 struct Fl_Fontdesc {
00088   const char *name;
00089   char fontname[128];   // "Pretty" font name
00090   Fl_Font_Descriptor *first;    // linked list of sizes of this style
00091 #  ifndef WIN32
00092   char **xlist;         // matched X font names
00093   int n;                // size of xlist, negative = don't free xlist!
00094 #  endif
00095 };
00096 
00097 extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table
00098 
00099 #  ifndef WIN32
00100 // functions for parsing X font names:
00101 FL_EXPORT const char* fl_font_word(const char *p, int n);
00102 FL_EXPORT char *fl_find_fontsize(char *name);
00103 #  endif
00104 
00105 #endif
00106 
00107 //
00108 // End of "$Id$".
00109 //