~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/freetype/src/otlayout/otljstf.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "otljstf.h"
 
2
#include "otlcommn.h"
 
3
#include "otlgpos.h"
 
4
 
 
5
  static void
 
6
  otl_jstf_extender_validate( OTL_Bytes      table,
 
7
                              OTL_Validator  valid )
 
8
  {
 
9
    OTL_Bytes  p = table;
 
10
    OTL_UInt   count;
 
11
 
 
12
    OTL_CHECK( 2 );
 
13
 
 
14
    count = OTL_NEXT_USHORT( p );
 
15
 
 
16
    OTL_CHECK( count*2 );
 
17
  }
 
18
 
 
19
 
 
20
  static void
 
21
  otl_jstf_gsub_mods_validate( OTL_Bytes      table,
 
22
                               OTL_Validator  valid )
 
23
  {
 
24
    OTL_Bytes  p = table;
 
25
    OTL_UInt   count;
 
26
 
 
27
    OTL_CHECK( 2 );
 
28
    count = OTL_NEXT_USHORT( p );
 
29
    OTL_CHECK( count*2 );
 
30
 
 
31
    /* XXX: check GSUB lookup indices */
 
32
  }
 
33
 
 
34
 
 
35
  static void
 
36
  otl_jstf_gpos_mods_validate( OTL_Bytes      table,
 
37
                               OTL_Validator  valid )
 
38
  {
 
39
    OTL_Bytes  p = table;
 
40
    OTL_UInt   count;
 
41
 
 
42
    OTL_CHECK( 2 );
 
43
    count = OTL_NEXT_USHORT( p );
 
44
    OTL_CHECK( count*2 );
 
45
 
 
46
    /* XXX: check GPOS lookup indices */
 
47
  }
 
48
 
 
49
 
 
50
  static void
 
51
  otl_jstf_max_validate( OTL_Bytes      table,
 
52
                         OTL_Validator  valid )
 
53
  {
 
54
    OTL_Bytes  p = table;
 
55
    OTL_UInt   count;
 
56
 
 
57
    OTL_CHECK( 2 );
 
58
 
 
59
    count = OTL_NEXT_USHORT( p );
 
60
 
 
61
    OTL_CHECK( count*2 );
 
62
    for ( ; count > 0; count-- )
 
63
      otl_gpos_subtable_check( table + OTL_NEXT_USHORT( p ), valid );
 
64
  }
 
65
 
 
66
 
 
67
  static void
 
68
  otl_jstf_priority_validate( OTL_Bytes      table,
 
69
                              OTL_Validator  valid )
 
70
  {
 
71
    OTL_Bytes  p = table;
 
72
    OTL_UInt   offset;
 
73
 
 
74
    OTL_CHECK( 20 );
 
75
 
 
76
    /* shrinkage GSUB enable/disable */
 
77
    val = OTL_NEXT_USHORT( p );
 
78
    if ( val )
 
79
      otl_jstf_gsub_mods_validate( table + val, valid );
 
80
 
 
81
    val = OTL_NEXT_USHORT( p );
 
82
    if ( val )
 
83
      otl_jstf_gsub_mods_validate( table + val, valid );
 
84
 
 
85
    /* shrinkage GPOS enable/disable */
 
86
    val = OTL_NEXT_USHORT( p );
 
87
    if ( val )
 
88
      otl_jstf_gpos_mods_validate( table + val, valid );
 
89
 
 
90
    val = OTL_NEXT_USHORT( p );
 
91
    if ( val )
 
92
      otl_jstf_gpos_mods_validate( table + val, valid );
 
93
 
 
94
    /* shrinkage JSTF max */
 
95
    val = OTL_NEXT_USHORT( p );
 
96
    if ( val )
 
97
      otl_jstf_max_validate( table + val, valid );
 
98
 
 
99
    /* extension GSUB enable/disable */
 
100
    val = OTL_NEXT_USHORT( p );
 
101
    if ( val )
 
102
      otl_jstf_gsub_mods_validate( table + val, valid );
 
103
 
 
104
    val = OTL_NEXT_USHORT( p );
 
105
    if ( val )
 
106
      otl_jstf_gsub_mods_validate( table + val, valid );
 
107
 
 
108
    /* extension GPOS enable/disable */
 
109
    val = OTL_NEXT_USHORT( p );
 
110
    if ( val )
 
111
      otl_jstf_gpos_mods_validate( table + val, valid );
 
112
 
 
113
    val = OTL_NEXT_USHORT( p );
 
114
    if ( val )
 
115
      otl_jstf_gpos_mods_validate( table + val, valid );
 
116
 
 
117
    /* extension JSTF max */
 
118
    val = OTL_NEXT_USHORT( p );
 
119
    if ( val )
 
120
      otl_jstf_max_validate( table + val, valid );
 
121
  }
 
122
 
 
123
  static void
 
124
  otl_jstf_lang_validate( OTL_Bytes      table,
 
125
                          OTL_Validator  valid )
 
126
  {
 
127
    OTL_Bytes  p = table;
 
128
    OTL_UInt   count;
 
129
 
 
130
    OTL_CHECK( 2 );
 
131
 
 
132
    count = OTL_NEXT_USHORT( p );
 
133
 
 
134
    OTL_CHECK( count*2 );
 
135
    for ( ; count > 0; count-- )
 
136
      otl_jstf_priority_validate( table + OTL_NEXT_USHORT( p ), valid );
 
137
  }
 
138
 
 
139
 
 
140
  static void
 
141
  otl_jstf_script_validate( OTL_Bytes      table,
 
142
                            OTL_Validator  valid )
 
143
  {
 
144
    OTL_Bytes  p = table;
 
145
    OTL_UInt   count, extender, default_lang;
 
146
 
 
147
    OTL_CHECK( 6 );
 
148
    extender     = OTL_NEXT_USHORT( p );
 
149
    default_lang = OTL_NEXT_USHORT( p );
 
150
    count        = OTL_NEXT_USHORT( p );
 
151
 
 
152
    if ( extender )
 
153
      otl_jstf_extender_validate( table + extender, valid );
 
154
 
 
155
    if ( default_lang )
 
156
      otl_jstf_lang_validate( table + default_lang, valid );
 
157
 
 
158
    OTL_CHECK( 6*count );
 
159
 
 
160
    for ( ; count > 0; count-- )
 
161
    {
 
162
      p += 4;  /* ignore tag */
 
163
      otl_jstf_lang_validate( table + OTL_NEXT_USHORT( p ), valid );
 
164
    }
 
165
  }
 
166
 
 
167
 
 
168
  OTL_LOCALDEF( void )
 
169
  otl_jstf_validate( OTL_Bytes      table,
 
170
                     OTL_Validator  valid )
 
171
  {
 
172
    OTL_Bytes  p = table;
 
173
    OTL_UInt   count;
 
174
 
 
175
    OTL_CHECK( 4 );
 
176
 
 
177
    if ( OTL_NEXT_ULONG( p ) != 0x10000UL )
 
178
      OTL_INVALID_DATA;
 
179
 
 
180
    count = OTL_NEXT_USHORT( p );
 
181
    OTL_CHECK( count*6 );
 
182
 
 
183
    for ( ; count > 0; count++ )
 
184
    {
 
185
      p += 4;  /* ignore tag */
 
186
      otl_jstf_script_validate( table + OTL_NEXT_USHORT( p ), valid );
 
187
    }
 
188
  }
 
189
  
 
 
b'\\ No newline at end of file'