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

« back to all changes in this revision

Viewing changes to src/3rdparty/freetype/src/psnames/psmodule.c

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
 
175
175
    /* sort base glyphs before glyph variants */
176
176
    if ( unicode1 == unicode2 )
177
 
      return map1->unicode - map2->unicode;
 
177
    {
 
178
      if ( map1->unicode > map2->unicode )
 
179
        return 1;
 
180
      else if ( map1->unicode < map2->unicode )
 
181
        return -1;
 
182
      else
 
183
        return 0;
 
184
    }
178
185
    else
179
 
      return unicode1 - unicode2;
 
186
    {
 
187
      if ( unicode1 > unicode2 )
 
188
        return 1;
 
189
      else if ( unicode1 < unicode2 )
 
190
        return -1;
 
191
      else
 
192
        return 0;
 
193
    }
180
194
  }
181
195
 
182
196
 
183
 
  /* support for old WGL4 fonts */
184
 
 
185
 
#define WGL_EXTRA_LIST_SIZE  8
186
 
 
187
 
  static const FT_UInt32  ft_wgl_extra_unicodes[WGL_EXTRA_LIST_SIZE] =
 
197
  /* support for extra glyphs not handled (well) in AGL; */
 
198
  /* we add extra mappings for them if necessary         */
 
199
 
 
200
#define EXTRA_GLYPH_LIST_SIZE  10
 
201
 
 
202
  static const FT_UInt32  ft_extra_glyph_unicodes[EXTRA_GLYPH_LIST_SIZE] =
188
203
  {
 
204
    /* WGL 4 */
189
205
    0x0394,
190
206
    0x03A9,
191
207
    0x2215,
193
209
    0x02C9,
194
210
    0x03BC,
195
211
    0x2219,
196
 
    0x00A0
 
212
    0x00A0,
 
213
    /* Romanian */
 
214
    0x021A,
 
215
    0x021B
197
216
  };
198
217
 
199
 
  static const char  ft_wgl_extra_glyph_names[] =
 
218
  static const char  ft_extra_glyph_names[] =
200
219
  {
201
220
    'D','e','l','t','a',0,
202
221
    'O','m','e','g','a',0,
205
224
    'm','a','c','r','o','n',0,
206
225
    'm','u',0,
207
226
    'p','e','r','i','o','d','c','e','n','t','e','r','e','d',0,
208
 
    's','p','a','c','e',0
 
227
    's','p','a','c','e',0,
 
228
    'T','c','o','m','m','a','a','c','c','e','n','t',0,
 
229
    't','c','o','m','m','a','a','c','c','e','n','t',0
209
230
  };
210
231
 
211
232
  static const FT_Int
212
 
  ft_wgl_extra_glyph_name_offsets[WGL_EXTRA_LIST_SIZE] =
 
233
  ft_extra_glyph_name_offsets[EXTRA_GLYPH_LIST_SIZE] =
213
234
  {
214
235
     0,
215
236
     6,
218
239
    28,
219
240
    35,
220
241
    38,
221
 
    53
 
242
    53,
 
243
    59,
 
244
    72
222
245
  };
223
246
 
224
247
 
225
248
  static void
226
 
  ps_check_wgl_name( const char*  gname,
227
 
                     FT_UInt      glyph,
228
 
                     FT_UInt*     wgl_glyphs,
229
 
                     FT_UInt     *states )
 
249
  ps_check_extra_glyph_name( const char*  gname,
 
250
                             FT_UInt      glyph,
 
251
                             FT_UInt*     extra_glyphs,
 
252
                             FT_UInt     *states )
230
253
  {
231
254
    FT_UInt  n;
232
255
 
233
256
 
234
 
    for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
 
257
    for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
235
258
    {
236
 
      if ( ft_strcmp( ft_wgl_extra_glyph_names +
237
 
                        ft_wgl_extra_glyph_name_offsets[n], gname ) == 0 )
 
259
      if ( ft_strcmp( ft_extra_glyph_names +
 
260
                        ft_extra_glyph_name_offsets[n], gname ) == 0 )
238
261
      {
239
262
        if ( states[n] == 0 )
240
263
        {
241
 
          /* mark this WGL extra glyph as a candidate for the cmap */
 
264
          /* mark this extra glyph as a candidate for the cmap */
242
265
          states[n]     = 1;
243
 
          wgl_glyphs[n] = glyph;
 
266
          extra_glyphs[n] = glyph;
244
267
        }
245
268
 
246
269
        return;
250
273
 
251
274
 
252
275
  static void
253
 
  ps_check_wgl_unicode( FT_UInt32  uni_char,
254
 
                        FT_UInt   *states )
 
276
  ps_check_extra_glyph_unicode( FT_UInt32  uni_char,
 
277
                                FT_UInt   *states )
255
278
  {
256
279
    FT_UInt  n;
257
280
 
258
281
 
259
 
    for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
 
282
    for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
260
283
    {
261
 
      if ( uni_char == ft_wgl_extra_unicodes[n] )
 
284
      if ( uni_char == ft_extra_glyph_unicodes[n] )
262
285
      {
263
 
        /* disable this WGL extra glyph from being added to the cmap */
 
286
        /* disable this extra glyph from being added to the cmap */
264
287
        states[n] = 2;
265
288
 
266
289
        return;
280
303
  {
281
304
    FT_Error  error;
282
305
 
283
 
    FT_UInt  wgl_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
284
 
    FT_UInt  wgl_glyphs[WGL_EXTRA_LIST_SIZE];
 
306
    FT_UInt  extra_glyph_list_states[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
307
    FT_UInt  extra_glyphs[EXTRA_GLYPH_LIST_SIZE];
285
308
 
286
309
 
287
310
    /* we first allocate the table */
288
311
    table->num_maps = 0;
289
312
    table->maps     = 0;
290
313
 
291
 
    if ( !FT_NEW_ARRAY( table->maps, num_glyphs + WGL_EXTRA_LIST_SIZE ) )
 
314
    if ( !FT_NEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
292
315
    {
293
316
      FT_UInt     n;
294
317
      FT_UInt     count;
305
328
 
306
329
        if ( gname )
307
330
        {
308
 
          ps_check_wgl_name( gname, n, wgl_glyphs, wgl_list_states );
 
331
          ps_check_extra_glyph_name( gname, n,
 
332
                                     extra_glyphs, extra_glyph_list_states );
309
333
          uni_char = ps_unicode_value( gname );
310
334
 
311
335
          if ( BASE_GLYPH( uni_char ) != 0 )
312
336
          {
313
 
            ps_check_wgl_unicode( uni_char, wgl_list_states );
 
337
            ps_check_extra_glyph_unicode( uni_char,
 
338
                                          extra_glyph_list_states );
314
339
            map->unicode     = uni_char;
315
340
            map->glyph_index = n;
316
341
            map++;
321
346
        }
322
347
      }
323
348
 
324
 
      for ( n = 0; n < WGL_EXTRA_LIST_SIZE; n++ )
 
349
      for ( n = 0; n < EXTRA_GLYPH_LIST_SIZE; n++ )
325
350
      {
326
 
        if ( wgl_list_states[n] == 1 )
 
351
        if ( extra_glyph_list_states[n] == 1 )
327
352
        {
328
 
          /* This glyph name has an additional WGL4 representation. */
329
 
          /* Add it to the cmap.                                    */
 
353
          /* This glyph name has an additional representation. */
 
354
          /* Add it to the cmap.                               */
330
355
 
331
 
          map->unicode     = ft_wgl_extra_unicodes[n];
332
 
          map->glyph_index = wgl_glyphs[n];
 
356
          map->unicode     = ft_extra_glyph_unicodes[n];
 
357
          map->glyph_index = extra_glyphs[n];
333
358
          map++;
334
359
        }
335
360
      }