Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / pTk / tkFont.h
CommitLineData
86530b38
AT
1/*
2 * tkFont.h --
3 *
4 * Declarations for interfaces between the generic and platform-
5 * specific parts of the font package. This information is not
6 * visible outside of the font package.
7 *
8 * Copyright (c) 1996 Sun Microsystems, Inc.
9 *
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 *
13 * RCS: @(#) $Id: tkFont.h,v 1.4 1998/09/14 18:23:10 stanton Exp $
14 */
15
16#ifndef _TKFONT
17#define _TKFONT
18
19#ifdef BUILD_tk
20# undef TCL_STORAGE_CLASS
21# define TCL_STORAGE_CLASS DLLEXPORT
22#endif
23
24/*
25 * The following structure keeps track of the attributes of a font. It can
26 * be used to keep track of either the desired attributes or the actual
27 * attributes gotten when the font was instantiated.
28 */
29
30typedef struct TkFontAttributes {
31 Tk_Uid family; /* Font family. The most important field. */
32 int pointsize; /* Pointsize of font, 0 for default size, or
33 * negative number meaning pixel size. */
34 int weight; /* Weight flag; see below for def'n. */
35 int slant; /* Slant flag; see below for def'n. */
36 int underline; /* Non-zero for underline font. */
37 int overstrike; /* Non-zero for overstrike font. */
38} TkFontAttributes;
39
40/*
41 * Possible values for the "weight" field in a TkFontAttributes structure.
42 * Weight is a subjective term and depends on what the company that created
43 * the font considers bold.
44 */
45
46#define TK_FW_NORMAL 0
47#define TK_FW_BOLD 1
48
49#define TK_FW_UNKNOWN -1 /* Unknown weight. This value is used for
50 * error checking and is never actually stored
51 * in the weight field. */
52
53/*
54 * Possible values for the "slant" field in a TkFontAttributes structure.
55 */
56
57#define TK_FS_ROMAN 0
58#define TK_FS_ITALIC 1
59#define TK_FS_OBLIQUE 2 /* This value is only used when parsing X
60 * font names to determine the closest
61 * match. It is only stored in the
62 * XLFDAttributes structure, never in the
63 * slant field of the TkFontAttributes. */
64
65#define TK_FS_UNKNOWN -1 /* Unknown slant. This value is used for
66 * error checking and is never actually stored
67 * in the slant field. */
68
69/*
70 * The following structure keeps track of the metrics for an instantiated
71 * font. The metrics are the physical properties of the font itself.
72 */
73
74typedef struct TkFontMetrics {
75 int ascent; /* From baseline to top of font. */
76 int descent; /* From baseline to bottom of font. */
77 int maxWidth; /* Width of widest character in font. */
78 int fixed; /* Non-zero if this is a fixed-width font,
79 * 0 otherwise. */
80} TkFontMetrics;
81
82/*
83 * The following structure is used to keep track of the generic information
84 * about a font. Each platform-specific font is represented by a structure
85 * with the following structure at its beginning, plus any platform-
86 * specific stuff after that.
87 */
88
89typedef struct TkFont {
90 /*
91 * Fields used and maintained exclusively by generic code.
92 */
93
94 int refCount; /* Number of users of the TkFont. */
95 Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
96 * used when deleting it. */
97 Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that
98 * corresponds to the named font that the
99 * tkfont was based on, or NULL if the tkfont
100 * was not based on a named font. */
101 int tabWidth; /* Width of tabs in this font (pixels). */
102 int underlinePos; /* Offset from baseline to origin of
103 * underline bar (used for drawing underlines
104 * on a non-underlined font). */
105 int underlineHeight; /* Height of underline bar (used for drawing
106 * underlines on a non-underlined font). */
107
108 /*
109 * Fields in the generic font structure that are filled in by
110 * platform-specific code.
111 */
112
113 Font fid; /* For backwards compatibility with XGCValues
114 * structures. Remove when TkGCValues is
115 * implemented. */
116 TkFontAttributes fa; /* Actual font attributes obtained when the
117 * the font was created, as opposed to the
118 * desired attributes passed in to
119 * TkpGetFontFromAttributes(). The desired
120 * metrics can be determined from the string
121 * that was used to create this font. */
122 TkFontMetrics fm; /* Font metrics determined when font was
123 * created. */
124} TkFont;
125
126/*
127 * The following structure is used to return attributes when parsing an
128 * XLFD. The extra information is of interest to the Unix-specific code
129 * when attempting to find the closest matching font.
130 */
131
132typedef struct TkXLFDAttributes {
133 TkFontAttributes fa; /* Standard set of font attributes. */
134 Tk_Uid foundry; /* The foundry of the font. */
135 int slant; /* The tristate value for the slant, which
136 * is significant under X. */
137 int setwidth; /* The proportionate width, see below for
138 * definition. */
139 int charset; /* The character set encoding (the glyph
140 * family), see below for definition. */
141 int encoding; /* Variations within a charset for the
142 * glyphs above character 127. */
143} TkXLFDAttributes;
144
145/*
146 * Possible values for the "setwidth" field in a TkXLFDAttributes structure.
147 * The setwidth is whether characters are considered wider or narrower than
148 * normal.
149 */
150
151#define TK_SW_NORMAL 0
152#define TK_SW_CONDENSE 1
153#define TK_SW_EXPAND 2
154#define TK_SW_UNKNOWN 3 /* Unknown setwidth. This value may be
155 * stored in the setwidth field. */
156
157/*
158 * Possible values for the "charset" field in a TkXLFDAttributes structure.
159 * The charset is the set of glyphs that are used in the font.
160 */
161
162#define TK_CS_NORMAL 0
163#define TK_CS_SYMBOL 1
164#define TK_CS_OTHER 2
165
166/*
167 * The following defines specify the meaning of the fields in a fully
168 * qualified XLFD.
169 */
170
171#define XLFD_FOUNDRY 0
172#define XLFD_FAMILY 1
173#define XLFD_WEIGHT 2
174#define XLFD_SLANT 3
175#define XLFD_SETWIDTH 4
176#define XLFD_ADD_STYLE 5
177#define XLFD_PIXEL_SIZE 6
178#define XLFD_POINT_SIZE 7
179#define XLFD_RESOLUTION_X 8
180#define XLFD_RESOLUTION_Y 9
181#define XLFD_SPACING 10
182#define XLFD_AVERAGE_WIDTH 11
183#define XLFD_REGISTRY 12
184#define XLFD_ENCODING 13
185#define XLFD_NUMFIELDS 14 /* Number of fields in XLFD. */
186
187/*
188 * Exported from generic code to platform-specific code.
189 */
190
191EXTERN int TkCreateNamedFont _ANSI_ARGS_((Tcl_Interp *interp,
192 Tk_Window tkwin, CONST char *name,
193 TkFontAttributes *faPtr));
194EXTERN void TkInitFontAttributes _ANSI_ARGS_((
195 TkFontAttributes *faPtr));
196EXTERN int TkParseXLFD _ANSI_ARGS_((CONST char *string,
197 TkXLFDAttributes *xaPtr));
198
199/*
200 * Common APIs exported to tkFont.c from all platform-specific
201 * implementations.
202 */
203
204EXTERN void TkpDeleteFont _ANSI_ARGS_((TkFont *tkFontPtr));
205EXTERN TkFont * TkpGetFontFromAttributes _ANSI_ARGS_((
206 TkFont *tkFontPtr, Tk_Window tkwin,
207 CONST TkFontAttributes *faPtr));
208EXTERN void TkpGetFontFamilies _ANSI_ARGS_((Tcl_Interp *interp,
209 Tk_Window tkwin));
210EXTERN TkFont * TkpGetNativeFont _ANSI_ARGS_((Tk_Window tkwin,
211 CONST char *name));
212
213# undef TCL_STORAGE_CLASS
214# define TCL_STORAGE_CLASS DLLIMPORT
215
216#endif /* _TKFONT */