misc/libfreetype/src/bdf/bdf.h
author unc0rr
Mon, 04 Feb 2013 00:13:55 +0400
changeset 8479 8d71109b04d2
parent 5172 88f2e05288ba
permissions -rw-r--r--
Some work on loading replay and interaction with checker
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
 * Copyright 2000 Computing Research Labs, New Mexico State University
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
 * Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
 *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
 * Permission is hereby granted, free of charge, to any person obtaining a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
 * copy of this software and associated documentation files (the "Software"),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
 * to deal in the Software without restriction, including without limitation
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
 * and/or sell copies of the Software, and to permit persons to whom the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
 * Software is furnished to do so, subject to the following conditions:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
 *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
 * The above copyright notice and this permission notice shall be included in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
 * all copies or substantial portions of the Software.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
 *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#ifndef __BDF_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
#define __BDF_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
 * Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
#include FT_INTERNAL_STREAM_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
/* Imported from bdfP.h */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
#define _bdf_glyph_modified( map, e )                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
          ( (map)[(e) >> 5] & ( 1 << ( (e) & 31 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
#define _bdf_set_glyph_modified( map, e )              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
          ( (map)[(e) >> 5] |= ( 1 << ( (e) & 31 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
#define _bdf_clear_glyph_modified( map, e )             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
          ( (map)[(e) >> 5] &= ~( 1 << ( (e) & 31 ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
/* end of bdfP.h */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  /* BDF font options macros and types.                                    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
#define BDF_CORRECT_METRICS  0x01 /* Correct invalid metrics when loading. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
#define BDF_KEEP_COMMENTS    0x02 /* Preserve the font comments.           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
#define BDF_KEEP_UNENCODED   0x04 /* Keep the unencoded glyphs.            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
#define BDF_PROPORTIONAL     0x08 /* Font has proportional spacing.        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
#define BDF_MONOWIDTH        0x10 /* Font has mono width.                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
#define BDF_CHARCELL         0x20 /* Font has charcell spacing.            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
#define BDF_ALL_SPACING  ( BDF_PROPORTIONAL | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
                           BDF_MONOWIDTH    | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
                           BDF_CHARCELL     )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
#define BDF_DEFAULT_LOAD_OPTIONS  ( BDF_CORRECT_METRICS | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
                                    BDF_KEEP_COMMENTS   | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
                                    BDF_KEEP_UNENCODED  | \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
                                    BDF_PROPORTIONAL    )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  typedef struct  bdf_options_t_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
    int            correct_metrics;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    int            keep_unencoded;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
    int            keep_comments;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    int            font_spacing;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
  } bdf_options_t;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
  /* Callback function type for unknown configuration options. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
  typedef int
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  (*bdf_options_callback_t)( bdf_options_t*  opts,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
                             char**          params,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
                             unsigned long   nparams,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
                             void*           client_data );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  /* BDF font property macros and types.                                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
#define BDF_ATOM      1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
#define BDF_INTEGER   2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
#define BDF_CARDINAL  3
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  /* This structure represents a particular property of a font. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
  /* There are a set of defaults and each font has their own.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
  typedef struct  bdf_property_t_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    char*  name;         /* Name of the property.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
    int    format;       /* Format of the property. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    int    builtin;      /* A builtin property.     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
    union
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
      char*          atom;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
      long           l;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
      unsigned long  ul;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
    } value;             /* Value of the property.  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
  } bdf_property_t;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
  /* BDF font metric and glyph types.                                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
  typedef struct  bdf_bbx_t_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
    unsigned short  width;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
    unsigned short  height;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    short           x_offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    short           y_offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
    short           ascent;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    short           descent;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
  } bdf_bbx_t;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
  typedef struct  bdf_glyph_t_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
    char*           name;        /* Glyph name.                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
    long            encoding;    /* Glyph encoding.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
    unsigned short  swidth;      /* Scalable width.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    unsigned short  dwidth;      /* Device width.                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
    bdf_bbx_t       bbx;         /* Glyph bounding box.                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
    unsigned char*  bitmap;      /* Glyph bitmap.                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
    unsigned long   bpr;         /* Number of bytes used per row.        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
    unsigned short  bytes;       /* Number of bytes used for the bitmap. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
  } bdf_glyph_t;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
  typedef struct  _hashnode_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
    const char*  key;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
    size_t       data;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
  } _hashnode, *hashnode;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
  typedef struct  hashtable_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
    int        limit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
    int        size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
    int        used;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
    hashnode*  table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
  } hashtable;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
  typedef struct  bdf_glyphlist_t_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
    unsigned short  pad;          /* Pad to 4-byte boundary.              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
    unsigned short  bpp;          /* Bits per pixel.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
    long            start;        /* Beginning encoding value of glyphs.  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
    long            end;          /* Ending encoding value of glyphs.     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
    bdf_glyph_t*    glyphs;       /* Glyphs themselves.                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
    unsigned long   glyphs_size;  /* Glyph structures allocated.          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
    unsigned long   glyphs_used;  /* Glyph structures used.               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
    bdf_bbx_t       bbx;          /* Overall bounding box of glyphs.      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
  } bdf_glyphlist_t;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
  typedef struct  bdf_font_t_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
    char*            name;           /* Name of the font.                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
    bdf_bbx_t        bbx;            /* Font bounding box.                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
    long             point_size;     /* Point size of the font.             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
    unsigned long    resolution_x;   /* Font horizontal resolution.         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
    unsigned long    resolution_y;   /* Font vertical resolution.           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
    int              spacing;        /* Font spacing value.                 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
    unsigned short   monowidth;      /* Logical width for monowidth font.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
    long             default_char;   /* Encoding of the default glyph.      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
    long             font_ascent;    /* Font ascent.                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
    long             font_descent;   /* Font descent.                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
    unsigned long    glyphs_size;    /* Glyph structures allocated.         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
    unsigned long    glyphs_used;    /* Glyph structures used.              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
    bdf_glyph_t*     glyphs;         /* Glyphs themselves.                  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    unsigned long    unencoded_size; /* Unencoded glyph struct. allocated.  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
    unsigned long    unencoded_used; /* Unencoded glyph struct. used.       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
    bdf_glyph_t*     unencoded;      /* Unencoded glyphs themselves.        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
    unsigned long    props_size;     /* Font properties allocated.          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
    unsigned long    props_used;     /* Font properties used.               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
    bdf_property_t*  props;          /* Font properties themselves.         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
    char*            comments;       /* Font comments.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
    unsigned long    comments_len;   /* Length of comment string.           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
    bdf_glyphlist_t  overflow;       /* Storage used for glyph insertion.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
    void*            internal;       /* Internal data for the font.         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
    unsigned long    nmod[2048];     /* Bitmap indicating modified glyphs.  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
    unsigned long    umod[2048];     /* Bitmap indicating modified          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
                                     /* unencoded glyphs.                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
    unsigned short   modified;       /* Boolean indicating font modified.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
    unsigned short   bpp;            /* Bits per pixel.                     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
    FT_Memory        memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
    bdf_property_t*  user_props;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
    unsigned long    nuser_props;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
    hashtable        proptbl;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
  } bdf_font_t;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
  /* Types for load/save callbacks.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
  /* Error codes. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
#define BDF_MISSING_START       -1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
#define BDF_MISSING_FONTNAME    -2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
#define BDF_MISSING_SIZE        -3
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
#define BDF_MISSING_CHARS       -4
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
#define BDF_MISSING_STARTCHAR   -5
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
#define BDF_MISSING_ENCODING    -6
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
#define BDF_MISSING_BBX         -7
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
#define BDF_OUT_OF_MEMORY      -20
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
#define BDF_INVALID_LINE      -100
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
  /* BDF font API.                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
  bdf_load_font( FT_Stream       stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
                 FT_Memory       memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
                 bdf_options_t*  opts,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
                 bdf_font_t*    *font );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
  bdf_free_font( bdf_font_t*  font );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
  FT_LOCAL( bdf_property_t * )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
  bdf_get_property( char*        name,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
                    bdf_font_t*  font );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
  FT_LOCAL( bdf_property_t * )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
  bdf_get_font_property( bdf_font_t*  font,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
                         const char*  name );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
#endif /* __BDF_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
/* END */