ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

bdf.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2000 Computing Research Labs, New Mexico State University
00003  * Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a
00006  * copy of this software and associated documentation files (the "Software"),
00007  * to deal in the Software without restriction, including without limitation
00008  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00009  * and/or sell copies of the Software, and to permit persons to whom the
00010  * Software is furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice shall be included in
00013  * all copies or substantial portions of the Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00018  * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
00019  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
00020  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
00021  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022  */
00023 
00024 
00025 #ifndef __BDF_H__
00026 #define __BDF_H__
00027 
00028 
00029 /*
00030  * Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
00031  */
00032 
00033 #include <ft2build.h>
00034 #include FT_INTERNAL_OBJECTS_H
00035 #include FT_INTERNAL_STREAM_H
00036 
00037 
00038 FT_BEGIN_HEADER
00039 
00040 
00041 /* Imported from bdfP.h */
00042 
00043 #define _bdf_glyph_modified( map, e )                 \
00044           ( (map)[(e) >> 5] & ( 1 << ( (e) & 31 ) ) )
00045 #define _bdf_set_glyph_modified( map, e )              \
00046           ( (map)[(e) >> 5] |= ( 1 << ( (e) & 31 ) ) )
00047 #define _bdf_clear_glyph_modified( map, e )             \
00048           ( (map)[(e) >> 5] &= ~( 1 << ( (e) & 31 ) ) )
00049 
00050 /* end of bdfP.h */
00051 
00052 
00053   /*************************************************************************/
00054   /*                                                                       */
00055   /* BDF font options macros and types.                                    */
00056   /*                                                                       */
00057   /*************************************************************************/
00058 
00059 
00060 #define BDF_CORRECT_METRICS  0x01 /* Correct invalid metrics when loading. */
00061 #define BDF_KEEP_COMMENTS    0x02 /* Preserve the font comments.           */
00062 #define BDF_KEEP_UNENCODED   0x04 /* Keep the unencoded glyphs.            */
00063 #define BDF_PROPORTIONAL     0x08 /* Font has proportional spacing.        */
00064 #define BDF_MONOWIDTH        0x10 /* Font has mono width.                  */
00065 #define BDF_CHARCELL         0x20 /* Font has charcell spacing.            */
00066 
00067 #define BDF_ALL_SPACING  ( BDF_PROPORTIONAL | \
00068                            BDF_MONOWIDTH    | \
00069                            BDF_CHARCELL     )
00070 
00071 #define BDF_DEFAULT_LOAD_OPTIONS  ( BDF_CORRECT_METRICS | \
00072                                     BDF_KEEP_COMMENTS   | \
00073                                     BDF_KEEP_UNENCODED  | \
00074                                     BDF_PROPORTIONAL    )
00075 
00076 
00077   typedef struct  bdf_options_t_
00078   {
00079     int            correct_metrics;
00080     int            keep_unencoded;
00081     int            keep_comments;
00082     int            font_spacing;
00083 
00084   } bdf_options_t;
00085 
00086 
00087   /* Callback function type for unknown configuration options. */
00088   typedef int
00089   (*bdf_options_callback_t)( bdf_options_t*  opts,
00090                              char**          params,
00091                              unsigned long   nparams,
00092                              void*           client_data );
00093 
00094 
00095   /*************************************************************************/
00096   /*                                                                       */
00097   /* BDF font property macros and types.                                   */
00098   /*                                                                       */
00099   /*************************************************************************/
00100 
00101 
00102 #define BDF_ATOM      1
00103 #define BDF_INTEGER   2
00104 #define BDF_CARDINAL  3
00105 
00106 
00107   /* This structure represents a particular property of a font. */
00108   /* There are a set of defaults and each font has their own.   */
00109   typedef struct  bdf_property_t_
00110   {
00111     char*  name;         /* Name of the property.   */
00112     int    format;       /* Format of the property. */
00113     int    builtin;      /* A builtin property.     */
00114     union
00115     {
00116       char*          atom;
00117       long           l;
00118       unsigned long  ul;
00119 
00120     } value;             /* Value of the property.  */
00121 
00122   } bdf_property_t;
00123 
00124 
00125   /*************************************************************************/
00126   /*                                                                       */
00127   /* BDF font metric and glyph types.                                      */
00128   /*                                                                       */
00129   /*************************************************************************/
00130 
00131 
00132   typedef struct  bdf_bbx_t_
00133   {
00134     unsigned short  width;
00135     unsigned short  height;
00136 
00137     short           x_offset;
00138     short           y_offset;
00139 
00140     short           ascent;
00141     short           descent;
00142 
00143   } bdf_bbx_t;
00144 
00145 
00146   typedef struct  bdf_glyph_t_
00147   {
00148     char*           name;        /* Glyph name.                          */
00149     long            encoding;    /* Glyph encoding.                      */
00150     unsigned short  swidth;      /* Scalable width.                      */
00151     unsigned short  dwidth;      /* Device width.                        */
00152     bdf_bbx_t       bbx;         /* Glyph bounding box.                  */
00153     unsigned char*  bitmap;      /* Glyph bitmap.                        */
00154     unsigned long   bpr;         /* Number of bytes used per row.        */
00155     unsigned short  bytes;       /* Number of bytes used for the bitmap. */
00156 
00157   } bdf_glyph_t;
00158 
00159 
00160   typedef struct  _hashnode_
00161   {
00162     const char*  key;
00163     size_t       data;
00164 
00165   } _hashnode, *hashnode;
00166 
00167 
00168   typedef struct  hashtable_
00169   {
00170     int        limit;
00171     int        size;
00172     int        used;
00173     hashnode*  table;
00174 
00175   } hashtable;
00176 
00177 
00178   typedef struct  bdf_glyphlist_t_
00179   {
00180     unsigned short  pad;          /* Pad to 4-byte boundary.              */
00181     unsigned short  bpp;          /* Bits per pixel.                      */
00182     long            start;        /* Beginning encoding value of glyphs.  */
00183     long            end;          /* Ending encoding value of glyphs.     */
00184     bdf_glyph_t*    glyphs;       /* Glyphs themselves.                   */
00185     unsigned long   glyphs_size;  /* Glyph structures allocated.          */
00186     unsigned long   glyphs_used;  /* Glyph structures used.               */
00187     bdf_bbx_t       bbx;          /* Overall bounding box of glyphs.      */
00188 
00189   } bdf_glyphlist_t;
00190 
00191 
00192   typedef struct  bdf_font_t_
00193   {
00194     char*            name;           /* Name of the font.                   */
00195     bdf_bbx_t        bbx;            /* Font bounding box.                  */
00196 
00197     long             point_size;     /* Point size of the font.             */
00198     unsigned long    resolution_x;   /* Font horizontal resolution.         */
00199     unsigned long    resolution_y;   /* Font vertical resolution.           */
00200 
00201     int              spacing;        /* Font spacing value.                 */
00202 
00203     unsigned short   monowidth;      /* Logical width for monowidth font.   */
00204 
00205     long             default_char;   /* Encoding of the default glyph.      */
00206 
00207     long             font_ascent;    /* Font ascent.                        */
00208     long             font_descent;   /* Font descent.                       */
00209 
00210     unsigned long    glyphs_size;    /* Glyph structures allocated.         */
00211     unsigned long    glyphs_used;    /* Glyph structures used.              */
00212     bdf_glyph_t*     glyphs;         /* Glyphs themselves.                  */
00213 
00214     unsigned long    unencoded_size; /* Unencoded glyph struct. allocated.  */
00215     unsigned long    unencoded_used; /* Unencoded glyph struct. used.       */
00216     bdf_glyph_t*     unencoded;      /* Unencoded glyphs themselves.        */
00217 
00218     unsigned long    props_size;     /* Font properties allocated.          */
00219     unsigned long    props_used;     /* Font properties used.               */
00220     bdf_property_t*  props;          /* Font properties themselves.         */
00221 
00222     char*            comments;       /* Font comments.                      */
00223     unsigned long    comments_len;   /* Length of comment string.           */
00224 
00225     bdf_glyphlist_t  overflow;       /* Storage used for glyph insertion.   */
00226 
00227     void*            internal;       /* Internal data for the font.         */
00228 
00229     unsigned long    nmod[2048];     /* Bitmap indicating modified glyphs.  */
00230     unsigned long    umod[2048];     /* Bitmap indicating modified          */
00231                                      /* unencoded glyphs.                   */
00232     unsigned short   modified;       /* Boolean indicating font modified.   */
00233     unsigned short   bpp;            /* Bits per pixel.                     */
00234 
00235     FT_Memory        memory;
00236 
00237     bdf_property_t*  user_props;
00238     unsigned long    nuser_props;
00239     hashtable        proptbl;
00240 
00241   } bdf_font_t;
00242 
00243 
00244   /*************************************************************************/
00245   /*                                                                       */
00246   /* Types for load/save callbacks.                                        */
00247   /*                                                                       */
00248   /*************************************************************************/
00249 
00250 
00251   /* Error codes. */
00252 #define BDF_MISSING_START       -1
00253 #define BDF_MISSING_FONTNAME    -2
00254 #define BDF_MISSING_SIZE        -3
00255 #define BDF_MISSING_CHARS       -4
00256 #define BDF_MISSING_STARTCHAR   -5
00257 #define BDF_MISSING_ENCODING    -6
00258 #define BDF_MISSING_BBX         -7
00259 
00260 #define BDF_OUT_OF_MEMORY      -20
00261 
00262 #define BDF_INVALID_LINE      -100
00263 
00264 
00265   /*************************************************************************/
00266   /*                                                                       */
00267   /* BDF font API.                                                         */
00268   /*                                                                       */
00269   /*************************************************************************/
00270 
00271   FT_LOCAL( FT_Error )
00272   bdf_load_font( FT_Stream       stream,
00273                  FT_Memory       memory,
00274                  bdf_options_t*  opts,
00275                  bdf_font_t*    *font );
00276 
00277   FT_LOCAL( void )
00278   bdf_free_font( bdf_font_t*  font );
00279 
00280   FT_LOCAL( bdf_property_t * )
00281   bdf_get_property( char*        name,
00282                     bdf_font_t*  font );
00283 
00284   FT_LOCAL( bdf_property_t * )
00285   bdf_get_font_property( bdf_font_t*  font,
00286                          const char*  name );
00287 
00288 
00289 FT_END_HEADER
00290 
00291 
00292 #endif /* __BDF_H__ */
00293 
00294 
00295 /* END */

Generated on Fri May 25 2012 04:32:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.