1998-10-19 20:46:58 +00:00
|
|
|
//
|
2005-02-24 21:55:12 +00:00
|
|
|
// "$Id$"
|
1998-10-19 20:46:58 +00:00
|
|
|
//
|
|
|
|
|
// Font definitions for the Fast Light Tool Kit (FLTK).
|
|
|
|
|
//
|
2005-02-24 21:55:12 +00:00
|
|
|
// Copyright 1998-2005 by Bill Spitzak and others.
|
1998-10-19 20:46:58 +00:00
|
|
|
//
|
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
// Library General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
// USA.
|
|
|
|
|
//
|
2005-04-16 00:13:17 +00:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
|
//
|
|
|
|
|
// http://www.fltk.org/str.php
|
1998-10-19 20:46:58 +00:00
|
|
|
//
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
// Two internal fltk data structures:
|
1998-10-19 20:46:58 +00:00
|
|
|
//
|
1998-12-02 15:51:38 +00:00
|
|
|
// Fl_Fontdesc: an entry into the fl_font() table. There is one of these
|
|
|
|
|
// for each fltk font number.
|
1998-10-19 20:46:58 +00:00
|
|
|
//
|
2008-08-15 21:18:27 +00:00
|
|
|
// Fl_Font_Descriptor: a structure for an actual system font, with junk to
|
1998-12-02 15:51:38 +00:00
|
|
|
// help choose it and info on character sizes. Each Fl_Fontdesc has a
|
|
|
|
|
// linked list of these. These are created the first time each system
|
|
|
|
|
// font/size combination is used.
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
#ifndef FL_FONT_
|
|
|
|
|
#define FL_FONT_
|
|
|
|
|
|
2004-08-25 00:20:27 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
2002-03-06 18:11:01 +00:00
|
|
|
# if USE_XFT
|
|
|
|
|
typedef struct _XftFont XftFont;
|
|
|
|
|
# endif // USE_XFT
|
|
|
|
|
|
2008-08-15 21:18:27 +00:00
|
|
|
class Fl_Font_Descriptor {
|
1998-10-06 18:21:25 +00:00
|
|
|
public:
|
2008-08-15 21:18:27 +00:00
|
|
|
Fl_Font_Descriptor *next; // linked list for this Fl_Fontdesc
|
2002-03-06 18:11:01 +00:00
|
|
|
# ifdef WIN32
|
1998-10-06 18:21:25 +00:00
|
|
|
HFONT fid;
|
|
|
|
|
int width[256];
|
|
|
|
|
TEXTMETRIC metr;
|
2008-08-15 21:18:27 +00:00
|
|
|
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
2004-08-25 00:20:27 +00:00
|
|
|
# elif defined(__APPLE_QD__)
|
2008-08-15 21:18:27 +00:00
|
|
|
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
2004-08-25 00:20:27 +00:00
|
|
|
short font, face, size;
|
|
|
|
|
short ascent, descent;
|
|
|
|
|
short width[256];
|
|
|
|
|
bool knowMetrics;
|
|
|
|
|
# elif defined(__APPLE_QUARTZ__)
|
2008-08-15 21:18:27 +00:00
|
|
|
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
2006-06-02 14:17:41 +00:00
|
|
|
ATSUTextLayout layout;
|
|
|
|
|
ATSUStyle style;
|
|
|
|
|
short ascent, descent, q_width;
|
2006-08-19 15:24:55 +00:00
|
|
|
short width[256];
|
|
|
|
|
bool knowWidths;
|
2004-08-26 00:18:43 +00:00
|
|
|
char *q_name;
|
|
|
|
|
int size;
|
2002-03-06 18:11:01 +00:00
|
|
|
# elif USE_XFT
|
|
|
|
|
XftFont* font;
|
|
|
|
|
const char* encoding;
|
2008-08-15 21:11:21 +00:00
|
|
|
Fl_Fontsize size;
|
2008-08-15 21:18:27 +00:00
|
|
|
FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
|
2002-03-06 18:11:01 +00:00
|
|
|
# else
|
2001-11-27 17:44:08 +00:00
|
|
|
XFontStruct* font; // X font information
|
2008-08-15 21:18:27 +00:00
|
|
|
FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
|
2002-03-06 18:11:01 +00:00
|
|
|
# endif
|
2008-08-15 21:11:21 +00:00
|
|
|
Fl_Fontsize minsize; // smallest point size that should use this
|
|
|
|
|
Fl_Fontsize maxsize; // largest point size that should use this
|
2002-03-06 18:11:01 +00:00
|
|
|
# if HAVE_GL
|
1998-10-06 18:21:25 +00:00
|
|
|
unsigned int listbase;// base of display list, 0 = none
|
2002-03-06 18:11:01 +00:00
|
|
|
# endif
|
2008-08-15 21:18:27 +00:00
|
|
|
FL_EXPORT ~Fl_Font_Descriptor();
|
1998-10-06 18:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2008-08-15 21:18:27 +00:00
|
|
|
extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
struct Fl_Fontdesc {
|
|
|
|
|
const char *name;
|
2002-08-09 01:09:49 +00:00
|
|
|
char fontname[128]; // "Pretty" font name
|
2008-08-15 21:18:27 +00:00
|
|
|
Fl_Font_Descriptor *first; // linked list of sizes of this style
|
2002-03-06 18:11:01 +00:00
|
|
|
# ifndef WIN32
|
1998-10-06 18:21:25 +00:00
|
|
|
char **xlist; // matched X font names
|
|
|
|
|
int n; // size of xlist, negative = don't free xlist!
|
2002-03-06 18:11:01 +00:00
|
|
|
# endif
|
1998-10-06 18:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
1999-02-16 22:00:04 +00:00
|
|
|
extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table
|
1998-10-06 18:21:25 +00:00
|
|
|
|
2002-03-06 18:11:01 +00:00
|
|
|
# ifndef WIN32
|
1998-10-06 18:21:25 +00:00
|
|
|
// functions for parsing X font names:
|
1999-02-16 22:00:04 +00:00
|
|
|
FL_EXPORT const char* fl_font_word(const char *p, int n);
|
|
|
|
|
FL_EXPORT char *fl_find_fontsize(char *name);
|
2002-03-06 18:11:01 +00:00
|
|
|
# endif
|
1998-10-06 18:21:25 +00:00
|
|
|
|
|
|
|
|
#endif
|
1998-10-19 20:46:58 +00:00
|
|
|
|
|
|
|
|
//
|
2005-02-24 21:55:12 +00:00
|
|
|
// End of "$Id$".
|
1998-10-19 20:46:58 +00:00
|
|
|
//
|