blob: f534e6f8339f547d6a56c85d18ac2fa58db043c5 [file] [log] [blame]
DRC2ff39b82011-07-28 08:38:59 +00001//
2// "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $"
3//
4// Font definitions for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2011 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.
12//
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.
17//
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.
22//
23// Please report all bugs and problems on the following page:
24//
25// http://www.fltk.org/str.php
26//
27
28// Two internal fltk data structures:
29//
30// Fl_Fontdesc: an entry into the fl_font() table. There is one of these
31// for each fltk font number.
32//
33#ifndef FL_FONT_
34#define FL_FONT_
35
36#include <config.h>
37
38# if USE_XFT
39typedef struct _XftFont XftFont;
40# elif !defined(WIN32) && !defined(__APPLE__)
41# include <FL/Xutf8.h>
42# endif // USE_XFT
43
44/**
45 This a structure for an actual system font, with junk to
46 help choose it and info on character sizes. Each Fl_Fontdesc has a
47 linked list of these. These are created the first time each system
48 font/size combination is used.
49*/
50class Fl_Font_Descriptor {
51public:
52 /** linked list for this Fl_Fontdesc */
53 Fl_Font_Descriptor *next;
54 Fl_Fontsize size; /**< font size */
55#ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc.
56# ifdef WIN32
57 HFONT fid;
58 int *width[64];
59 TEXTMETRIC metr;
60 int angle;
61 FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
62# elif defined(__APPLE_QUARTZ__)
63 FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
64 ATSUTextLayout layout;
65# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
66 CTFontRef fontref;
67 // the unicode span is divided in 512 blocks of 128 characters
68 float *width[512]; // array of arrays of character widths
69# endif
70 ATSUStyle style;
71 short ascent, descent, q_width;
72 char *q_name;
73# elif USE_XFT
74 XftFont* font;
75 //const char* encoding;
76 int angle;
77 FL_EXPORT Fl_Font_Descriptor(const char* xfontname, Fl_Fontsize size, int angle);
78# else
79 XUtf8FontStruct* font; // X UTF-8 font information
80 FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
81# endif
82# if HAVE_GL
83 unsigned int listbase;// base of display list, 0 = none
84#ifndef __APPLE_QUARTZ__
85 char glok[64];
86#endif // __APPLE_QUARTZ__
87# endif // HAVE_GL
88
89 FL_EXPORT ~Fl_Font_Descriptor();
90
91#endif // FL_DOXYGEN
92};
93
94//extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
95
96struct Fl_Fontdesc {
97 const char *name;
98 char fontname[128]; // "Pretty" font name
99 Fl_Font_Descriptor *first; // linked list of sizes of this style
100# ifndef WIN32
101 char **xlist; // matched X font names
102 int n; // size of xlist, negative = don't free xlist!
103# endif
104};
105
106extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table
107
108# ifndef WIN32
109// functions for parsing X font names:
110FL_EXPORT const char* fl_font_word(const char *p, int n);
111FL_EXPORT char *fl_find_fontsize(char *name);
112# endif
113
114#endif
115
116//
117// End of "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $".
118//