/[dtapublic]/projs/dtats/trunk/shared_source/c_tk_base_7_5_w_mods/tkfont.h
ViewVC logotype

Diff of /projs/dtats/trunk/shared_source/c_tk_base_7_5_w_mods/tkfont.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 69 by dashley, Sat Nov 5 10:54:17 2016 UTC revision 71 by dashley, Sat Nov 5 11:07:06 2016 UTC
# Line 1  Line 1 
1  /* $Header$ */  /* $Header$ */
2    
3  /*  /*
4   * tkFont.h --   * tkFont.h --
5   *   *
6   *      Declarations for interfaces between the generic and platform-   *      Declarations for interfaces between the generic and platform-
7   *      specific parts of the font package.  This information is not   *      specific parts of the font package.  This information is not
8   *      visible outside of the font package.   *      visible outside of the font package.
9   *   *
10   * Copyright (c) 1996-1997 Sun Microsystems, Inc.   * Copyright (c) 1996-1997 Sun Microsystems, Inc.
11   *   *
12   * See the file "license.terms" for information on usage and redistribution   * See the file "license.terms" for information on usage and redistribution
13   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14   *   *
15   * RCS: @(#) $Id: tkfont.h,v 1.1.1.1 2001/06/13 05:01:01 dtashley Exp $   * RCS: @(#) $Id: tkfont.h,v 1.1.1.1 2001/06/13 05:01:01 dtashley Exp $
16   */   */
17    
18  #ifndef _TKFONT  #ifndef _TKFONT
19  #define _TKFONT  #define _TKFONT
20    
21  #ifdef BUILD_tk  #ifdef BUILD_tk
22  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
23  # define TCL_STORAGE_CLASS DLLEXPORT  # define TCL_STORAGE_CLASS DLLEXPORT
24  #endif  #endif
25    
26  /*  /*
27   * The following structure keeps track of the attributes of a font.  It can   * The following structure keeps track of the attributes of a font.  It can
28   * be used to keep track of either the desired attributes or the actual   * be used to keep track of either the desired attributes or the actual
29   * attributes gotten when the font was instantiated.   * attributes gotten when the font was instantiated.
30   */   */
31    
32  typedef struct TkFontAttributes {  typedef struct TkFontAttributes {
33      Tk_Uid family;              /* Font family, or NULL to represent      Tk_Uid family;              /* Font family, or NULL to represent
34                                   * plaform-specific default system font. */                                   * plaform-specific default system font. */
35      int size;                   /* Pointsize of font, 0 for default size, or      int size;                   /* Pointsize of font, 0 for default size, or
36                                   * negative number meaning pixel size. */                                   * negative number meaning pixel size. */
37      int weight;                 /* Weight flag; see below for def'n. */      int weight;                 /* Weight flag; see below for def'n. */
38      int slant;                  /* Slant flag; see below for def'n. */      int slant;                  /* Slant flag; see below for def'n. */
39      int underline;              /* Non-zero for underline font. */      int underline;              /* Non-zero for underline font. */
40      int overstrike;             /* Non-zero for overstrike font. */      int overstrike;             /* Non-zero for overstrike font. */
41  } TkFontAttributes;  } TkFontAttributes;
42    
43  /*  /*
44   * Possible values for the "weight" field in a TkFontAttributes structure.   * Possible values for the "weight" field in a TkFontAttributes structure.
45   * Weight is a subjective term and depends on what the company that created   * Weight is a subjective term and depends on what the company that created
46   * the font considers bold.   * the font considers bold.
47   */   */
48    
49  #define TK_FW_NORMAL    0  #define TK_FW_NORMAL    0
50  #define TK_FW_BOLD      1  #define TK_FW_BOLD      1
51    
52  #define TK_FW_UNKNOWN   -1      /* Unknown weight.  This value is used for  #define TK_FW_UNKNOWN   -1      /* Unknown weight.  This value is used for
53                                   * error checking and is never actually stored                                   * error checking and is never actually stored
54                                   * in the weight field. */                                   * in the weight field. */
55    
56  /*  /*
57   * Possible values for the "slant" field in a TkFontAttributes structure.   * Possible values for the "slant" field in a TkFontAttributes structure.
58   */   */
59    
60  #define TK_FS_ROMAN     0        #define TK_FS_ROMAN     0      
61  #define TK_FS_ITALIC    1  #define TK_FS_ITALIC    1
62  #define TK_FS_OBLIQUE   2       /* This value is only used when parsing X  #define TK_FS_OBLIQUE   2       /* This value is only used when parsing X
63                                   * font names to determine the closest                                   * font names to determine the closest
64                                   * match.  It is only stored in the                                   * match.  It is only stored in the
65                                   * XLFDAttributes structure, never in the                                   * XLFDAttributes structure, never in the
66                                   * slant field of the TkFontAttributes. */                                   * slant field of the TkFontAttributes. */
67    
68  #define TK_FS_UNKNOWN   -1      /* Unknown slant.  This value is used for  #define TK_FS_UNKNOWN   -1      /* Unknown slant.  This value is used for
69                                   * error checking and is never actually stored                                   * error checking and is never actually stored
70                                   * in the slant field. */                                   * in the slant field. */
71    
72  /*  /*
73   * The following structure keeps track of the metrics for an instantiated   * The following structure keeps track of the metrics for an instantiated
74   * font.  The metrics are the physical properties of the font itself.   * font.  The metrics are the physical properties of the font itself.
75   */   */
76    
77  typedef struct TkFontMetrics {  typedef struct TkFontMetrics {
78      int ascent;                 /* From baseline to top of font. */      int ascent;                 /* From baseline to top of font. */
79      int descent;                /* From baseline to bottom of font. */      int descent;                /* From baseline to bottom of font. */
80      int maxWidth;               /* Width of widest character in font. */      int maxWidth;               /* Width of widest character in font. */
81      int fixed;                  /* Non-zero if this is a fixed-width font,      int fixed;                  /* Non-zero if this is a fixed-width font,
82                                   * 0 otherwise. */                                   * 0 otherwise. */
83  } TkFontMetrics;  } TkFontMetrics;
84    
85  /*  /*
86   * The following structure is used to keep track of the generic information   * The following structure is used to keep track of the generic information
87   * about a font.  Each platform-specific font is represented by a structure   * about a font.  Each platform-specific font is represented by a structure
88   * with the following structure at its beginning, plus any platform-   * with the following structure at its beginning, plus any platform-
89   * specific stuff after that.   * specific stuff after that.
90   */   */
91    
92  typedef struct TkFont {  typedef struct TkFont {
93      /*      /*
94       * Fields used and maintained exclusively by generic code.       * Fields used and maintained exclusively by generic code.
95       */       */
96    
97      int resourceRefCount;       /* Number of active uses of this font (each      int resourceRefCount;       /* Number of active uses of this font (each
98                                   * active use corresponds to a call to                                   * active use corresponds to a call to
99                                   * Tk_AllocFontFromTable or Tk_GetFont).                                   * Tk_AllocFontFromTable or Tk_GetFont).
100                                   * If this count is 0, then this TkFont                                   * If this count is 0, then this TkFont
101                                   * structure is no longer valid and it isn't                                   * structure is no longer valid and it isn't
102                                   * present in a hash table: it is being                                   * present in a hash table: it is being
103                                   * kept around only because there are objects                                   * kept around only because there are objects
104                                   * referring to it.  The structure is freed                                   * referring to it.  The structure is freed
105                                   * when resourceRefCount and objRefCount                                   * when resourceRefCount and objRefCount
106                                   * are both 0. */                                   * are both 0. */
107      int objRefCount;            /* The number of Tcl objects that reference      int objRefCount;            /* The number of Tcl objects that reference
108                                   * this structure. */                                   * this structure. */
109      Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,      Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure,
110                                   * used when deleting it. */                                   * used when deleting it. */
111      Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that      Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that
112                                   * corresponds to the named font that the                                   * corresponds to the named font that the
113                                   * tkfont was based on, or NULL if the tkfont                                   * tkfont was based on, or NULL if the tkfont
114                                   * was not based on a named font. */                                   * was not based on a named font. */
115      Screen *screen;             /* The screen where this font is valid. */      Screen *screen;             /* The screen where this font is valid. */
116      int tabWidth;               /* Width of tabs in this font (pixels). */      int tabWidth;               /* Width of tabs in this font (pixels). */
117      int underlinePos;           /* Offset from baseline to origin of      int underlinePos;           /* Offset from baseline to origin of
118                                   * underline bar (used for drawing underlines                                   * underline bar (used for drawing underlines
119                                   * on a non-underlined font). */                                   * on a non-underlined font). */
120      int underlineHeight;        /* Height of underline bar (used for drawing      int underlineHeight;        /* Height of underline bar (used for drawing
121                                   * underlines on a non-underlined font). */                                   * underlines on a non-underlined font). */
122    
123      /*      /*
124       * Fields used in the generic code that are filled in by       * Fields used in the generic code that are filled in by
125       * platform-specific code.       * platform-specific code.
126       */       */
127    
128      Font fid;                   /* For backwards compatibility with XGCValues      Font fid;                   /* For backwards compatibility with XGCValues
129                                   * structures.  Remove when TkGCValues is                                   * structures.  Remove when TkGCValues is
130                                   * implemented.  */                                   * implemented.  */
131      TkFontAttributes fa;        /* Actual font attributes obtained when the      TkFontAttributes fa;        /* Actual font attributes obtained when the
132                                   * the font was created, as opposed to the                                   * the font was created, as opposed to the
133                                   * desired attributes passed in to                                   * desired attributes passed in to
134                                   * TkpGetFontFromAttributes().  The desired                                   * TkpGetFontFromAttributes().  The desired
135                                   * metrics can be determined from the string                                   * metrics can be determined from the string
136                                   * that was used to create this font. */                                   * that was used to create this font. */
137      TkFontMetrics fm;           /* Font metrics determined when font was      TkFontMetrics fm;           /* Font metrics determined when font was
138                                   * created. */                                   * created. */
139      struct TkFont *nextPtr;     /* Points to the next TkFont structure with      struct TkFont *nextPtr;     /* Points to the next TkFont structure with
140                                   * the same name.  All fonts with the                                   * the same name.  All fonts with the
141                                   * same name (but different displays) are                                   * same name (but different displays) are
142                                   * chained together off a single entry in                                   * chained together off a single entry in
143                                   * a hash table. */                                   * a hash table. */
144  } TkFont;  } TkFont;
145    
146  /*  /*
147   * The following structure is used to return attributes when parsing an   * The following structure is used to return attributes when parsing an
148   * XLFD.  The extra information is of interest to the Unix-specific code   * XLFD.  The extra information is of interest to the Unix-specific code
149   * when attempting to find the closest matching font.   * when attempting to find the closest matching font.
150   */   */
151    
152  typedef struct TkXLFDAttributes {  typedef struct TkXLFDAttributes {
153      Tk_Uid foundry;             /* The foundry of the font. */      Tk_Uid foundry;             /* The foundry of the font. */
154      int slant;                  /* The tristate value for the slant, which      int slant;                  /* The tristate value for the slant, which
155                                   * is significant under X. */                                   * is significant under X. */
156      int setwidth;               /* The proportionate width, see below for      int setwidth;               /* The proportionate width, see below for
157                                   * definition. */                                   * definition. */
158      Tk_Uid charset;             /* The actual charset string. */      Tk_Uid charset;             /* The actual charset string. */
159  } TkXLFDAttributes;  } TkXLFDAttributes;
160    
161  /*  /*
162   * Possible values for the "setwidth" field in a TkXLFDAttributes structure.   * Possible values for the "setwidth" field in a TkXLFDAttributes structure.
163   * The setwidth is whether characters are considered wider or narrower than   * The setwidth is whether characters are considered wider or narrower than
164   * normal.   * normal.
165   */   */
166    
167  #define TK_SW_NORMAL    0  #define TK_SW_NORMAL    0
168  #define TK_SW_CONDENSE  1  #define TK_SW_CONDENSE  1
169  #define TK_SW_EXPAND    2  #define TK_SW_EXPAND    2
170  #define TK_SW_UNKNOWN   3       /* Unknown setwidth.  This value may be  #define TK_SW_UNKNOWN   3       /* Unknown setwidth.  This value may be
171                                   * stored in the setwidth field. */                                   * stored in the setwidth field. */
172    
173  /*  /*
174   * The following defines specify the meaning of the fields in a fully   * The following defines specify the meaning of the fields in a fully
175   * qualified XLFD.   * qualified XLFD.
176   */   */
177    
178  #define XLFD_FOUNDRY        0  #define XLFD_FOUNDRY        0
179  #define XLFD_FAMILY         1  #define XLFD_FAMILY         1
180  #define XLFD_WEIGHT         2  #define XLFD_WEIGHT         2
181  #define XLFD_SLANT          3  #define XLFD_SLANT          3
182  #define XLFD_SETWIDTH       4  #define XLFD_SETWIDTH       4
183  #define XLFD_ADD_STYLE      5  #define XLFD_ADD_STYLE      5
184  #define XLFD_PIXEL_SIZE     6  #define XLFD_PIXEL_SIZE     6
185  #define XLFD_POINT_SIZE     7  #define XLFD_POINT_SIZE     7
186  #define XLFD_RESOLUTION_X   8  #define XLFD_RESOLUTION_X   8
187  #define XLFD_RESOLUTION_Y   9  #define XLFD_RESOLUTION_Y   9
188  #define XLFD_SPACING        10  #define XLFD_SPACING        10
189  #define XLFD_AVERAGE_WIDTH  11  #define XLFD_AVERAGE_WIDTH  11
190  #define XLFD_CHARSET        12  #define XLFD_CHARSET        12
191  #define XLFD_NUMFIELDS      13  /* Number of fields in XLFD. */  #define XLFD_NUMFIELDS      13  /* Number of fields in XLFD. */
192    
193  /*  /*
194   * Low-level API exported by generic code to platform-specific code.   * Low-level API exported by generic code to platform-specific code.
195   */   */
196    
197  #define TkInitFontAttributes(fa)   memset((fa), 0, sizeof(TkFontAttributes));  #define TkInitFontAttributes(fa)   memset((fa), 0, sizeof(TkFontAttributes));
198  #define TkInitXLFDAttributes(xa)   memset((xa), 0, sizeof(TkXLFDAttributes));  #define TkInitXLFDAttributes(xa)   memset((xa), 0, sizeof(TkXLFDAttributes));
199    
200  extern int              TkFontParseXLFD _ANSI_ARGS_((CONST char *string,  extern int              TkFontParseXLFD _ANSI_ARGS_((CONST char *string,
201                              TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr));                              TkFontAttributes *faPtr, TkXLFDAttributes *xaPtr));
202  extern char **          TkFontGetAliasList _ANSI_ARGS_((CONST char *faceName));  extern char **          TkFontGetAliasList _ANSI_ARGS_((CONST char *faceName));
203  extern char ***         TkFontGetFallbacks _ANSI_ARGS_((void));  extern char ***         TkFontGetFallbacks _ANSI_ARGS_((void));
204  extern int              TkFontGetPixels _ANSI_ARGS_((Tk_Window tkwin,  extern int              TkFontGetPixels _ANSI_ARGS_((Tk_Window tkwin,
205                              int size));                              int size));
206  extern int              TkFontGetPoints _ANSI_ARGS_((Tk_Window tkwin,  extern int              TkFontGetPoints _ANSI_ARGS_((Tk_Window tkwin,
207                              int size));                              int size));
208  extern char **          TkFontGetGlobalClass _ANSI_ARGS_((void));  extern char **          TkFontGetGlobalClass _ANSI_ARGS_((void));
209  extern char **          TkFontGetSymbolClass _ANSI_ARGS_((void));  extern char **          TkFontGetSymbolClass _ANSI_ARGS_((void));
210    
211  /*  /*
212   * Low-level API exported by platform-specific code to generic code.   * Low-level API exported by platform-specific code to generic code.
213   */   */
214    
215  extern void             TkpDeleteFont _ANSI_ARGS_((TkFont *tkFontPtr));  extern void             TkpDeleteFont _ANSI_ARGS_((TkFont *tkFontPtr));
216  extern void             TkpFontPkgInit _ANSI_ARGS_((TkMainInfo *mainPtr));  extern void             TkpFontPkgInit _ANSI_ARGS_((TkMainInfo *mainPtr));
217  extern TkFont *         TkpGetFontFromAttributes _ANSI_ARGS_((  extern TkFont *         TkpGetFontFromAttributes _ANSI_ARGS_((
218                              TkFont *tkFontPtr, Tk_Window tkwin,                              TkFont *tkFontPtr, Tk_Window tkwin,
219                              CONST TkFontAttributes *faPtr));                              CONST TkFontAttributes *faPtr));
220  extern void             TkpGetFontFamilies _ANSI_ARGS_((Tcl_Interp *interp,  extern void             TkpGetFontFamilies _ANSI_ARGS_((Tcl_Interp *interp,
221                              Tk_Window tkwin));                              Tk_Window tkwin));
222  extern TkFont *         TkpGetNativeFont _ANSI_ARGS_((Tk_Window tkwin,  extern TkFont *         TkpGetNativeFont _ANSI_ARGS_((Tk_Window tkwin,
223                              CONST char *name));                              CONST char *name));
224    
225  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
226  # define TCL_STORAGE_CLASS DLLIMPORT  # define TCL_STORAGE_CLASS DLLIMPORT
227    
228  #endif  /* _TKFONT */  #endif  /* _TKFONT */
229    
230  /* End of tkfont.h */  /* End of tkfont.h */

Legend:
Removed from v.69  
changed lines
  Added in v.71

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25