~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/extras/FreeType/lib/extend/ftxkern.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************
 
2
 *
 
3
 *  ftxkern.h                                                   1.0
 
4
 *
 
5
 *    High-Level API Kerning extension
 
6
 *
 
7
 *  Copyright 1996-1999 by
 
8
 *  David Turner, Robert Wilhelm, and Werner Lemberg.
 
9
 *
 
10
 *  This file is part of the FreeType project, and may only be used
 
11
 *  modified and distributed under the terms of the FreeType project
 
12
 *  license, LICENSE.TXT.  By continuing to use, modify, or distribute
 
13
 *  this file you indicate that you have read the license and
 
14
 *  understand and accept it fully.
 
15
 *
 
16
 *
 
17
 *  The kerning support is currently part of the engine extensions.
 
18
 *
 
19
 *  This file should _not_ depend on engine internal types.
 
20
 *
 
21
 ******************************************************************/
 
22
 
 
23
#ifndef FTXKERN_H
 
24
#define FTXKERN_H
 
25
 
 
26
#include "freetype.h"
 
27
 
 
28
#ifdef __cplusplus
 
29
extern "C" {
 
30
#endif
 
31
 
 
32
  /* The kerning support in FreeType is minimal.  This means that  */
 
33
  /* we do not try to interpret the kerning data in any way to     */
 
34
  /* `cook' it for a user application.  This API lets you access   */
 
35
  /* directly the kerning tables found in the TrueType file; it's  */
 
36
  /* up to the client application to apply its own processing on   */
 
37
  /* these.                                                        */
 
38
 
 
39
  /* The reason for this is that we generally do not encourage     */
 
40
  /* feature-bloat of the core engine.  Moreover, not all          */
 
41
  /* libraries or font servers really need kerning data, or all    */
 
42
  /* formats of this data.                                         */
 
43
 
 
44
  /************** kerning error codes *****************************/
 
45
 
 
46
  /* we choose the class 0x0A for our errors, this should not      */
 
47
  /* match with any error code class used in any other extension   */
 
48
 
 
49
#define TT_Err_Invalid_Kerning_Table_Format  0x0A00
 
50
#define TT_Err_Invalid_Kerning_Table         0x0A01
 
51
 
 
52
 
 
53
  /********** structures definitions ******************************/
 
54
 
 
55
  /* Remember that all types and function are accessible by client */
 
56
  /* applications in this section, and thus should have the `TT_'  */
 
57
  /* prefix.                                                       */
 
58
 
 
59
  /* format 0 kerning pair */
 
60
 
 
61
  struct  TT_Kern_0_Pair_
 
62
  {
 
63
    TT_UShort  left;   /* index of left  glyph in pair */
 
64
    TT_UShort  right;  /* index of right glyph in pair */
 
65
    TT_FWord   value;  /* kerning value                */
 
66
  };
 
67
 
 
68
  typedef struct TT_Kern_0_Pair_  TT_Kern_0_Pair;
 
69
 
 
70
 
 
71
  /* format 0 kerning subtable */
 
72
 
 
73
  struct  TT_Kern_0_
 
74
  {
 
75
    TT_UShort  nPairs;          /* number of kerning pairs */
 
76
 
 
77
    TT_UShort  searchRange;     /* these values are defined by the TT spec */
 
78
    TT_UShort  entrySelector;   /* for table searchs.                      */
 
79
    TT_UShort  rangeShift;
 
80
 
 
81
    TT_Kern_0_Pair*  pairs;     /* a table of nPairs `pairs' */
 
82
  };
 
83
 
 
84
  typedef struct TT_Kern_0_  TT_Kern_0;
 
85
 
 
86
 
 
87
  /* format 2 kerning glyph class */
 
88
 
 
89
  struct  TT_Kern_2_Class_
 
90
  {
 
91
    TT_UShort   firstGlyph;   /* first glyph in range                    */
 
92
    TT_UShort   nGlyphs;      /* number of glyphs in range               */
 
93
    TT_UShort*  classes;      /* a table giving for each ranged glyph    */
 
94
                              /* its class offset in the subtable pairs  */
 
95
                              /* two-dimensional array                   */
 
96
  };
 
97
 
 
98
  typedef struct TT_Kern_2_Class_  TT_Kern_2_Class;
 
99
 
 
100
 
 
101
  /* format 2 kerning subtable */
 
102
 
 
103
  struct TT_Kern_2_
 
104
  {
 
105
    TT_UShort        rowWidth;   /* length of one row in bytes         */
 
106
    TT_Kern_2_Class  leftClass;  /* left class table                   */
 
107
    TT_Kern_2_Class  rightClass; /* right class table                  */
 
108
    TT_FWord*        array;      /* 2-dimensional kerning values array */
 
109
  };
 
110
 
 
111
  typedef struct TT_Kern_2_  TT_Kern_2;
 
112
 
 
113
 
 
114
  /* kerning subtable */
 
115
 
 
116
  struct  TT_Kern_Subtable_
 
117
  {
 
118
    TT_Bool    loaded;   /* boolean; indicates whether the table is   */
 
119
                         /* loaded                                    */
 
120
    TT_UShort  version;  /* table version number                      */
 
121
    TT_Long    offset;   /* file offset of table                      */
 
122
    TT_UShort  length;   /* length of table, _excluding_ header       */
 
123
    TT_Byte    coverage; /* lower 8 bit of the coverage table entry   */
 
124
    TT_Byte    format;   /* the subtable format, as found in the      */
 
125
                         /* higher 8 bits of the coverage table entry */
 
126
    union
 
127
    {
 
128
      TT_Kern_0  kern0;
 
129
      TT_Kern_2  kern2;
 
130
    } t;
 
131
  };
 
132
 
 
133
  typedef struct TT_Kern_Subtable_  TT_Kern_Subtable;
 
134
 
 
135
 
 
136
  struct  TT_Kerning_
 
137
  {
 
138
    TT_UShort          version;  /* kern table version number. starts at 0 */
 
139
    TT_UShort          nTables;  /* number of tables                       */
 
140
 
 
141
    TT_Kern_Subtable*  tables;   /* the kerning sub-tables                 */
 
142
  };
 
143
 
 
144
  typedef struct TT_Kerning_  TT_Kerning;
 
145
 
 
146
 
 
147
 
 
148
  /***************** high-level API extension **************************/
 
149
 
 
150
  /* Initialize Kerning extension, must be called after                 */
 
151
  /* TT_Init_FreeType(). There is no need for a finalizer               */
 
152
  EXPORT_DEF
 
153
  TT_Error  TT_Init_Kerning_Extension( TT_Engine  engine );
 
154
 
 
155
  /* Note on the implemented mechanism:                                 */
 
156
 
 
157
  /* The kerning table directory is loaded with the face through the    */
 
158
  /* extension constructor.  However, the tables will only be loaded    */
 
159
  /* on demand, as they may represent a lot of data, unnecessary to     */
 
160
  /* most applications.                                                 */
 
161
 
 
162
  /* Queries a pointer to the kerning directory for the face object     */
 
163
  EXPORT_DEF
 
164
  TT_Error  TT_Get_Kerning_Directory( TT_Face      face,
 
165
                                      TT_Kerning*  directory );
 
166
 
 
167
  /* Load the kerning table number `kern_index' in the kerning          */
 
168
  /* directory.  The table will stay in memory until the `face'         */
 
169
  /* face is destroyed.                                                 */
 
170
  EXPORT_DEF
 
171
  TT_Error  TT_Load_Kerning_Table( TT_Face    face,
 
172
                                   TT_UShort  kern_index );
 
173
 
 
174
#ifdef __cplusplus
 
175
}
 
176
#endif
 
177
 
 
178
#endif /* FTXKERN_H */
 
179
 
 
180
 
 
181
/* END */