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

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

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

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

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

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25