FLTK: Fl_Font.H Source File

FLTK

Fl_Font.H
1 //
2 // "$Id$"
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. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18
19 // Two internal fltk data structures:
20 //
21 // Fl_Fontdesc: an entry into the fl_font() table. There is one of these
22 // for each fltk font number.
23 //
24 #ifndef FL_FONT_
25 #define FL_FONT_
26
27 #include <config.h>
28
29 # if USE_XFT
30 typedef struct _XftFont XftFont;
31 # elif !defined(WIN32) && !defined(__APPLE__)
32 # include "Xutf8.h"
33 # endif // USE_XFT
34
41 class Fl_Font_Descriptor {
42 public:
44 Fl_Font_Descriptor *next;
45 Fl_Fontsize size;
46 #ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc.
47 # ifdef WIN32
48 HFONT fid;
49 int *width[64];
50 TEXTMETRIC metr;
51 int angle;
52 FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
53 # elif defined(__APPLE_QUARTZ__)
54 FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
55 ATSUTextLayout layout;
56 # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
57 CTFontRef fontref;
58 // the unicode span is divided in 512 blocks of 128 characters
59 float *width[512]; // array of arrays of character widths
60 # endif
61 ATSUStyle style;
62 short ascent, descent, q_width;
63 # elif USE_XFT
64 XftFont* font;
65 //const char* encoding;
66 int angle;
67 FL_EXPORT Fl_Font_Descriptor(const char* xfontname, Fl_Fontsize size, int angle);
68 # else
69 XUtf8FontStruct* font; // X UTF-8 font information
70 FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
71 # endif
72 # if HAVE_GL
73 unsigned int listbase;// base of display list, 0 = none
74 #ifndef __APPLE_QUARTZ__
75 char glok[64];
76 #endif // __APPLE_QUARTZ__
77 # endif // HAVE_GL
78
79 FL_EXPORT ~Fl_Font_Descriptor();
80
81 #endif // FL_DOXYGEN
82 };
83
84 //extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
85
86 struct Fl_Fontdesc {
87 const char *name;
88 char fontname[128]; // "Pretty" font name
89 Fl_Font_Descriptor *first; // linked list of sizes of this style
90 # ifndef WIN32
91 char **xlist; // matched X font names
92 int n; // size of xlist, negative = don't free xlist!
93 # endif
94 };
95
96 extern FL_EXPORT Fl_Fontdesc *fl_fonts; // the table
97
98 # ifndef WIN32
99 // functions for parsing X font names:
100 FL_EXPORT const char* fl_font_word(const char *p, int n);
101 FL_EXPORT char *fl_find_fontsize(char *name);
102 # endif
103
104 #endif
105
106 //
107 // End of "$Id$".
108 //
Fl_Fontdesc
Definition: Fl_Font.H:86
Fl_Font_Descriptor::next
Fl_Font_Descriptor * next
linked list for this Fl_Fontdesc
Definition: Fl_Font.H:44
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:906
Fl_Font_Descriptor::size
Fl_Fontsize size
font size
Definition: Fl_Font.H:45
Fl_Font_Descriptor
This a structure for an actual system font, with junk to help choose it and info on character sizes.
Definition: Fl_Font.H:41
- © 1998-2016 by Bill Spitzak and others.