View | Details | Raw Unified | Return to bug 236867 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +1 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	freetype2
4
PORTNAME=	freetype2
5
PORTVERSION=	2.9.1
5
PORTVERSION=	2.10.0
6
CATEGORIES=	print
6
CATEGORIES=	print
7
MASTER_SITES=	http://savannah.nongnu.org/download/freetype/ \
7
MASTER_SITES=	http://savannah.nongnu.org/download/freetype/ \
8
		SF/freetype/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/}/ \
8
		SF/freetype/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/}/ \
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1525210487
1
TIMESTAMP = 1552633282
2
SHA256 (freetype-2.9.1.tar.bz2) = db8d87ea720ea9d5edc5388fc7a0497bb11ba9fe972245e0f7f4c7e8b1e1e84d
2
SHA256 (freetype-2.10.0.tar.bz2) = fccc62928c65192fff6c98847233b28eb7ce05f12d2fea3f6cc90e8b4e5fbe06
3
SIZE (freetype-2.9.1.tar.bz2) = 1926385
3
SIZE (freetype-2.10.0.tar.bz2) = 2743740
(-)files/patch-2.10.0.diff (+705 lines)
Line 0 Link Here
1
# [cff] Fix boundary checks.
2
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=6986ddac1ece9404c9b640a512cbd99534205fda
3
# [smooth] Fix segfault in direct mode (#56092).
4
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=1f271751a39e5bc9c639adc213183ed5e58a9401
5
# [pcf] Fix handling of undefined glyph (#56067).
6
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=c149f7397e484c97f45fb75fa1c7fdda2fc646cd
7
8
--- src/base/ftoutln.c.orig	2019-02-23 09:06:07 UTC
9
+++ src/base/ftoutln.c
10
@@ -621,6 +621,16 @@
11
 
12
     params->source = (void*)outline;
13
 
14
+    /* preset clip_box for direct mode */
15
+    if ( params->flags & FT_RASTER_FLAG_DIRECT    &&
16
+         !( params->flags & FT_RASTER_FLAG_CLIP ) )
17
+    {
18
+      params->clip_box.xMin = cbox.xMin >> 6;
19
+      params->clip_box.yMin = cbox.yMin >> 6;
20
+      params->clip_box.xMax = ( cbox.xMax + 63 ) >> 6;
21
+      params->clip_box.yMax = ( cbox.yMax + 63 ) >> 6;
22
+    }
23
+
24
     error = FT_ERR( Cannot_Render_Glyph );
25
     while ( renderer )
26
     {
27
--- src/cff/cffparse.c.orig	2019-03-11 07:20:07 UTC
28
+++ src/cff/cffparse.c
29
@@ -77,6 +77,23 @@
30
   }
31
 
32
 
33
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
34
+  static void
35
+  finalize_t2_strings( FT_Memory  memory,
36
+                       void*      data,
37
+                       void*      user )
38
+  {
39
+    CFF_T2_String  t2 = (CFF_T2_String)data;
40
+
41
+
42
+    FT_UNUSED( user );
43
+
44
+    memory->free( memory, t2->start );
45
+    memory->free( memory, data );
46
+  }
47
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
48
+
49
+
50
   FT_LOCAL_DEF( void )
51
   cff_parser_done( CFF_Parser  parser )
52
   {
53
@@ -84,13 +101,65 @@
54
 
55
 
56
     FT_FREE( parser->stack );
57
+
58
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
59
+    FT_List_Finalize( &parser->t2_strings,
60
+                      finalize_t2_strings,
61
+                      memory,
62
+                      NULL );
63
+#endif
64
+  }
65
+
66
+
67
+  /* Assuming `first >= last'. */
68
+
69
+  static FT_Error
70
+  cff_parser_within_limits( CFF_Parser  parser,
71
+                            FT_Byte*    first,
72
+                            FT_Byte*    last )
73
+  {
74
+#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
75
+
76
+    /* Fast path for regular FreeType builds with the "new" engine; */
77
+    /*   `first >= parser->start' can be assumed.                   */
78
+
79
+    FT_UNUSED( first );
80
+
81
+    return last < parser->limit ? FT_Err_Ok : FT_THROW( Invalid_Argument );
82
+
83
+#else /* CFF_CONFIG_OPTION_OLD_ENGINE */
84
+
85
+    FT_ListNode  node;
86
+
87
+
88
+    if ( first >= parser->start &&
89
+         last  <  parser->limit )
90
+      return FT_Err_Ok;
91
+
92
+    node = parser->t2_strings.head;
93
+
94
+    while ( node )
95
+    {
96
+      CFF_T2_String  t2 = (CFF_T2_String)node->data;
97
+
98
+
99
+      if ( first >= t2->start &&
100
+           last  <  t2->limit )
101
+        return FT_Err_Ok;
102
+
103
+      node = node->next;
104
+    }
105
+
106
+    return FT_THROW( Invalid_Argument );
107
+
108
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
109
   }
110
 
111
 
112
   /* read an integer */
113
   static FT_Long
114
-  cff_parse_integer( FT_Byte*  start,
115
-                     FT_Byte*  limit )
116
+  cff_parse_integer( CFF_Parser  parser,
117
+                     FT_Byte*    start )
118
   {
119
     FT_Byte*  p   = start;
120
     FT_Int    v   = *p++;
121
@@ -99,14 +168,14 @@
122
 
123
     if ( v == 28 )
124
     {
125
-      if ( p + 2 > limit )
126
+      if ( cff_parser_within_limits( parser, p, p + 1 ) )
127
         goto Bad;
128
 
129
       val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] );
130
     }
131
     else if ( v == 29 )
132
     {
133
-      if ( p + 4 > limit )
134
+      if ( cff_parser_within_limits( parser, p, p + 3 ) )
135
         goto Bad;
136
 
137
       val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) |
138
@@ -120,14 +189,14 @@
139
     }
140
     else if ( v < 251 )
141
     {
142
-      if ( p + 1 > limit )
143
+      if ( cff_parser_within_limits( parser, p, p ) )
144
         goto Bad;
145
 
146
       val = ( v - 247 ) * 256 + p[0] + 108;
147
     }
148
     else
149
     {
150
-      if ( p + 1 > limit )
151
+      if ( cff_parser_within_limits( parser, p, p ) )
152
         goto Bad;
153
 
154
       val = -( v - 251 ) * 256 - p[0] - 108;
155
@@ -176,10 +245,10 @@
156
 
157
   /* read a real */
158
   static FT_Fixed
159
-  cff_parse_real( FT_Byte*  start,
160
-                  FT_Byte*  limit,
161
-                  FT_Long   power_ten,
162
-                  FT_Long*  scaling )
163
+  cff_parse_real( CFF_Parser  parser,
164
+                  FT_Byte*    start,
165
+                  FT_Long     power_ten,
166
+                  FT_Long*    scaling )
167
   {
168
     FT_Byte*  p = start;
169
     FT_Int    nib;
170
@@ -214,7 +283,7 @@
171
         p++;
172
 
173
         /* Make sure we don't read past the end. */
174
-        if ( p >= limit )
175
+        if ( cff_parser_within_limits( parser, p, p ) )
176
           goto Bad;
177
       }
178
 
179
@@ -251,7 +320,7 @@
180
           p++;
181
 
182
           /* Make sure we don't read past the end. */
183
-          if ( p >= limit )
184
+          if ( cff_parser_within_limits( parser, p, p ) )
185
             goto Bad;
186
         }
187
 
188
@@ -290,7 +359,7 @@
189
           p++;
190
 
191
           /* Make sure we don't read past the end. */
192
-          if ( p >= limit )
193
+          if ( cff_parser_within_limits( parser, p, p ) )
194
             goto Bad;
195
         }
196
 
197
@@ -457,7 +526,7 @@
198
     if ( **d == 30 )
199
     {
200
       /* binary-coded decimal is truncated to integer */
201
-      return cff_parse_real( *d, parser->limit, 0, NULL ) >> 16;
202
+      return cff_parse_real( parser, *d, 0, NULL ) >> 16;
203
     }
204
 
205
     else if ( **d == 255 )
206
@@ -483,7 +552,7 @@
207
     }
208
 
209
     else
210
-      return cff_parse_integer( *d, parser->limit );
211
+      return cff_parse_integer( parser, *d );
212
   }
213
 
214
 
215
@@ -494,10 +563,10 @@
216
             FT_Long     scaling )
217
   {
218
     if ( **d == 30 )
219
-      return cff_parse_real( *d, parser->limit, scaling, NULL );
220
+      return cff_parse_real( parser, *d, scaling, NULL );
221
     else
222
     {
223
-      FT_Long  val = cff_parse_integer( *d, parser->limit );
224
+      FT_Long  val = cff_parse_integer( parser, *d );
225
 
226
 
227
       if ( scaling )
228
@@ -562,14 +631,14 @@
229
     FT_ASSERT( scaling );
230
 
231
     if ( **d == 30 )
232
-      return cff_parse_real( *d, parser->limit, 0, scaling );
233
+      return cff_parse_real( parser, *d, 0, scaling );
234
     else
235
     {
236
       FT_Long  number;
237
       FT_Int   integer_length;
238
 
239
 
240
-      number = cff_parse_integer( d[0], d[1] );
241
+      number = cff_parse_integer( parser, d[0] );
242
 
243
       if ( number > 0x7FFFL )
244
       {
245
@@ -1122,18 +1191,6 @@
246
 #endif /* FT_DEBUG_LEVEL_TRACE */
247
 
248
 
249
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
250
-  static void
251
-  destruct_t2s_item( FT_Memory  memory,
252
-                     void*      data,
253
-                     void*      user )
254
-  {
255
-    FT_UNUSED( user );
256
-    memory->free( memory, data );
257
-  }
258
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
259
-
260
-
261
   FT_LOCAL_DEF( FT_Error )
262
   cff_parser_run( CFF_Parser  parser,
263
                   FT_Byte*    start,
264
@@ -1147,11 +1204,6 @@
265
 
266
     FT_Library  library = parser->library;
267
     FT_Memory   memory  = library->memory;
268
-
269
-    FT_ListRec  t2s;
270
-
271
-
272
-    FT_ZERO( &t2s );
273
 #endif
274
 
275
     parser->top    = parser->stack;
276
@@ -1212,9 +1264,11 @@
277
         FT_Byte*     charstring_base;
278
         FT_ULong     charstring_len;
279
 
280
-        FT_Fixed*    stack;
281
-        FT_ListNode  node;
282
-        FT_Byte*     q;
283
+        FT_Fixed*     stack;
284
+        FT_ListNode   node;
285
+        CFF_T2_String t2;
286
+        size_t        t2_size;
287
+        FT_Byte*      q;
288
 
289
 
290
         charstring_base = ++p;
291
@@ -1261,16 +1315,26 @@
292
         if ( !node )
293
           goto Out_Of_Memory_Error;
294
 
295
+        FT_List_Add( &parser->t2_strings, node );
296
+
297
+        t2 = (CFF_T2_String)memory->alloc( memory,
298
+                                           sizeof ( CFF_T2_StringRec ) );
299
+        if ( !t2 )
300
+          goto Out_Of_Memory_Error;
301
+
302
+        node->data = t2;
303
+
304
         /* `5' is the conservative upper bound of required bytes per stack */
305
         /* element.                                                        */
306
-        q = (FT_Byte*)memory->alloc( memory,
307
-                                     5 * ( decoder.top - decoder.stack ) );
308
+
309
+        t2_size = 5 * ( decoder.top - decoder.stack );
310
+
311
+        q = (FT_Byte*)memory->alloc( memory, t2_size );
312
         if ( !q )
313
           goto Out_Of_Memory_Error;
314
 
315
-        node->data = q;
316
-
317
-        FT_List_Add( &t2s, node );
318
+        t2->start = q;
319
+        t2->limit = q + t2_size;
320
 
321
         stack = decoder.stack;
322
 
323
@@ -1531,9 +1595,6 @@
324
     } /* while ( p < limit ) */
325
 
326
   Exit:
327
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
328
-    FT_List_Finalize( &t2s, destruct_t2s_item, memory, NULL );
329
-#endif
330
     return error;
331
 
332
 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
333
--- src/cff/cffparse.h.orig	2019-02-23 09:06:07 UTC
334
+++ src/cff/cffparse.h
335
@@ -60,6 +60,10 @@ FT_BEGIN_HEADER
336
     FT_Byte**   top;
337
     FT_UInt     stackSize;  /* allocated size */
338
 
339
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
340
+    FT_ListRec  t2_strings;
341
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
342
+
343
     FT_UInt     object_code;
344
     void*       object;
345
 
346
@@ -130,6 +134,15 @@ FT_BEGIN_HEADER
347
 FT_END_HEADER
348
 
349
 
350
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
351
+  typedef struct  CFF_T2_String_
352
+  {
353
+    FT_Byte*  start;
354
+    FT_Byte*  limit;
355
+
356
+  } CFF_T2_StringRec, *CFF_T2_String;
357
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
358
+
359
 #endif /* CFFPARSE_H_ */
360
 
361
 
362
--- src/pcf/pcf.h.orig	2019-02-23 08:39:04 UTC
363
+++ src/pcf/pcf.h
364
@@ -99,7 +99,8 @@ FT_BEGIN_HEADER
365
     FT_Short  ascent;
366
     FT_Short  descent;
367
     FT_Short  attributes;
368
-    FT_ULong  bits;
369
+
370
+    FT_ULong  bits;  /* offset into the PCF_BITMAPS table */
371
 
372
   } PCF_MetricRec, *PCF_Metric;
373
 
374
--- src/pcf/pcfdrivr.c.orig	2019-02-23 08:39:04 UTC
375
+++ src/pcf/pcfdrivr.c
376
@@ -122,9 +122,9 @@ THE SOFTWARE.
377
          charcodeCol > enc->lastCol  )
378
       return 0;
379
 
380
-    return (FT_UInt)enc->offset[ ( charcodeRow - enc->firstRow ) *
381
-                                 ( enc->lastCol - enc->firstCol + 1 ) +
382
-                                   charcodeCol - enc->firstCol          ];
383
+    return (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) *
384
+                                  ( enc->lastCol - enc->firstCol + 1 ) +
385
+                                charcodeCol - enc->firstCol];
386
   }
387
 
388
 
389
@@ -160,9 +160,9 @@ THE SOFTWARE.
390
 
391
       charcode = (FT_UInt32)( charcodeRow * 256 + charcodeCol );
392
 
393
-      result = (FT_UInt)enc->offset[ ( charcodeRow - enc->firstRow ) *
394
-                                     ( enc->lastCol - enc->firstCol + 1 ) +
395
-                                       charcodeCol - enc->firstCol          ];
396
+      result = (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) *
397
+                                      ( enc->lastCol - enc->firstCol + 1 ) +
398
+                                    charcodeCol - enc->firstCol];
399
       if ( result != 0xFFFFU )
400
         break;
401
     }
402
--- src/pcf/pcfread.c.orig	2019-02-23 08:39:04 UTC
403
+++ src/pcf/pcfread.c
404
@@ -743,33 +743,39 @@ THE SOFTWARE.
405
     if ( !orig_nmetrics )
406
       return FT_THROW( Invalid_Table );
407
 
408
-    /* PCF is a format from ancient times; Unicode was in its       */
409
-    /* infancy, and widely used two-byte character sets for CJK     */
410
-    /* scripts (Big 5, GB 2312, JIS X 0208, etc.) did have at most  */
411
-    /* 15000 characters.  Even the more exotic CNS 11643 and CCCII  */
412
-    /* standards, which were essentially three-byte character sets, */
413
-    /* provided less then 65536 assigned characters.                */
414
-    /*                                                              */
415
-    /* While technically possible to have a larger number of glyphs */
416
-    /* in PCF files, we thus limit the number to 65536.             */
417
-    if ( orig_nmetrics > 65536 )
418
+    /*
419
+     * PCF is a format from ancient times; Unicode was in its infancy, and
420
+     * widely used two-byte character sets for CJK scripts (Big 5, GB 2312,
421
+     * JIS X 0208, etc.) did have at most 15000 characters.  Even the more
422
+     * exotic CNS 11643 and CCCII standards, which were essentially
423
+     * three-byte character sets, provided less then 65536 assigned
424
+     * characters.
425
+     *
426
+     * While technically possible to have a larger number of glyphs in PCF
427
+     * files, we thus limit the number to 65535, taking into account that we
428
+     * synthesize the metrics of glyph 0 to be a copy of the `default
429
+     * character', and that 0xFFFF in the encodings array indicates a
430
+     * missing glyph.
431
+     */
432
+    if ( orig_nmetrics > 65534 )
433
     {
434
       FT_TRACE0(( "pcf_get_metrics:"
435
-                  " only loading first 65536 metrics\n" ));
436
-      nmetrics = 65536;
437
+                  " only loading first 65534 metrics\n" ));
438
+      nmetrics = 65534;
439
     }
440
     else
441
       nmetrics = orig_nmetrics;
442
 
443
-    face->nmetrics = nmetrics;
444
+    face->nmetrics = nmetrics + 1;
445
 
446
-    if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )
447
+    if ( FT_NEW_ARRAY( face->metrics, face->nmetrics ) )
448
       return error;
449
 
450
-    metrics = face->metrics;
451
+    /* we handle glyph index 0 later on */
452
+    metrics = face->metrics + 1;
453
 
454
     FT_TRACE4(( "\n" ));
455
-    for ( i = 0; i < nmetrics; i++, metrics++ )
456
+    for ( i = 1; i < face->nmetrics; i++, metrics++ )
457
     {
458
       FT_TRACE5(( "  idx %ld:", i ));
459
       error = pcf_get_metric( stream, format, metrics );
460
@@ -808,12 +814,10 @@ THE SOFTWARE.
461
   pcf_get_bitmaps( FT_Stream  stream,
462
                    PCF_Face   face )
463
   {
464
-    FT_Error   error;
465
-    FT_Memory  memory  = FT_FACE( face )->memory;
466
-    FT_ULong*  offsets = NULL;
467
-    FT_ULong   bitmapSizes[GLYPHPADOPTIONS];
468
-    FT_ULong   format, size;
469
-    FT_ULong   nbitmaps, orig_nbitmaps, i, sizebitmaps = 0;
470
+    FT_Error  error;
471
+    FT_ULong  bitmapSizes[GLYPHPADOPTIONS];
472
+    FT_ULong  format, size, pos;
473
+    FT_ULong  nbitmaps, orig_nbitmaps, i, sizebitmaps = 0;
474
 
475
 
476
     error = pcf_seek_to_table_type( stream,
477
@@ -859,31 +863,46 @@ THE SOFTWARE.
478
     FT_TRACE4(( "  number of bitmaps: %ld\n", orig_nbitmaps ));
479
 
480
     /* see comment in `pcf_get_metrics' */
481
-    if ( orig_nbitmaps > 65536 )
482
+    if ( orig_nbitmaps > 65534 )
483
     {
484
       FT_TRACE0(( "pcf_get_bitmaps:"
485
-                  " only loading first 65536 bitmaps\n" ));
486
-      nbitmaps = 65536;
487
+                  " only loading first 65534 bitmaps\n" ));
488
+      nbitmaps = 65534;
489
     }
490
     else
491
       nbitmaps = orig_nbitmaps;
492
 
493
-    if ( nbitmaps != face->nmetrics )
494
+    /* no extra bitmap for glyph 0 */
495
+    if ( nbitmaps != face->nmetrics - 1 )
496
       return FT_THROW( Invalid_File_Format );
497
 
498
-    if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
499
-      return error;
500
+    /* start position of bitmap data */
501
+    pos = stream->pos + nbitmaps * 4 + 4 * 4;
502
 
503
     FT_TRACE5(( "\n" ));
504
-    for ( i = 0; i < nbitmaps; i++ )
505
+    for ( i = 1; i <= nbitmaps; i++ )
506
     {
507
+      FT_ULong  offset;
508
+
509
+
510
       if ( PCF_BYTE_ORDER( format ) == MSBFirst )
511
-        (void)FT_READ_ULONG( offsets[i] );
512
+        (void)FT_READ_ULONG( offset );
513
       else
514
-        (void)FT_READ_ULONG_LE( offsets[i] );
515
+        (void)FT_READ_ULONG_LE( offset );
516
 
517
       FT_TRACE5(( "  bitmap %lu: offset %lu (0x%lX)\n",
518
-                  i, offsets[i], offsets[i] ));
519
+                  i, offset, offset ));
520
+
521
+      /* right now, we only check the offset with a rough estimate; */
522
+      /* actual bitmaps are only loaded on demand                   */
523
+      if ( offset > size )
524
+      {
525
+        FT_TRACE0(( "pcf_get_bitmaps:"
526
+                    " invalid offset to bitmap data of glyph %lu\n", i ));
527
+        face->metrics[i].bits = pos;
528
+      }
529
+      else
530
+        face->metrics[i].bits = pos + offset;
531
     }
532
     if ( error )
533
       goto Bail;
534
@@ -910,24 +929,9 @@ THE SOFTWARE.
535
 
536
     FT_UNUSED( sizebitmaps );       /* only used for debugging */
537
 
538
-    /* right now, we only check the bitmap offsets; */
539
-    /* actual bitmaps are only loaded on demand     */
540
-    for ( i = 0; i < nbitmaps; i++ )
541
-    {
542
-      /* rough estimate */
543
-      if ( offsets[i] > size )
544
-      {
545
-        FT_TRACE0(( "pcf_get_bitmaps:"
546
-                    " invalid offset to bitmap data of glyph %lu\n", i ));
547
-      }
548
-      else
549
-        face->metrics[i].bits = stream->pos + offsets[i];
550
-    }
551
-
552
     face->bitmapsFormat = format;
553
 
554
   Bail:
555
-    FT_FREE( offsets );
556
     return error;
557
   }
558
 
559
@@ -1062,41 +1066,52 @@ THE SOFTWARE.
560
       defaultCharCol = enc->firstCol;
561
     }
562
 
563
-    /* FreeType mandates that glyph index 0 is the `undefined glyph',  */
564
-    /* which PCF calls the `default character'.  For this reason, we   */
565
-    /* swap the positions of glyph index 0 and the index corresponding */
566
-    /* to `defaultChar' in case they are different.                    */
567
-
568
-    /* `stream->cursor' still points at the beginning of the frame; */
569
-    /* we can thus easily get the offset to the default character   */
570
+    /*
571
+     * FreeType mandates that glyph index 0 is the `undefined glyph', which
572
+     * PCF calls the `default character'.  However, FreeType needs glyph
573
+     * index 0 to be used for the undefined glyph only, which is is not the
574
+     * case for PCF.  For this reason, we add one slot for glyph index 0 and
575
+     * simply copy the default character to it.
576
+     *
577
+     * `stream->cursor' still points to the beginning of the frame; we can
578
+     * thus easily get the offset to the default character.
579
+     */
580
     pos = stream->cursor +
581
             2 * ( ( defaultCharRow - enc->firstRow ) *
582
-                  ( enc->lastCol - enc->firstCol + 1 ) +
583
-                    defaultCharCol - enc->firstCol       );
584
+                    ( enc->lastCol - enc->firstCol + 1 ) +
585
+                  defaultCharCol - enc->firstCol );
586
 
587
     if ( PCF_BYTE_ORDER( format ) == MSBFirst )
588
       defaultCharEncodingOffset = FT_PEEK_USHORT( pos );
589
     else
590
       defaultCharEncodingOffset = FT_PEEK_USHORT_LE( pos );
591
 
592
-    if ( defaultCharEncodingOffset >= face->nmetrics )
593
+    if ( defaultCharEncodingOffset == 0xFFFF )
594
     {
595
       FT_TRACE0(( "pcf_get_encodings:"
596
-                  " Invalid glyph index for default character,"
597
-                  " setting to zero\n" ));
598
-      defaultCharEncodingOffset = 0;
599
+                  " No glyph for default character,\n"
600
+                  "                  "
601
+                  " setting it to the first glyph of the font\n" ));
602
+      defaultCharEncodingOffset = 1;
603
     }
604
-
605
-    if ( defaultCharEncodingOffset )
606
+    else
607
     {
608
-      /* do the swapping */
609
-      PCF_MetricRec  tmp = face->metrics[defaultCharEncodingOffset];
610
-
611
+      defaultCharEncodingOffset++;
612
 
613
-      face->metrics[defaultCharEncodingOffset] = face->metrics[0];
614
-      face->metrics[0]                         = tmp;
615
+      if ( defaultCharEncodingOffset >= face->nmetrics )
616
+      {
617
+        FT_TRACE0(( "pcf_get_encodings:"
618
+                    " Invalid glyph index for default character,\n"
619
+                    "                  "
620
+                    " setting it to the first glyph of the font\n" ));
621
+        defaultCharEncodingOffset = 1;
622
+      }
623
     }
624
 
625
+    /* copy metrics of default character to index 0 */
626
+    face->metrics[0] = face->metrics[defaultCharEncodingOffset];
627
+
628
+    /* now loop over all values */
629
     offset = enc->offset;
630
     for ( i = enc->firstRow; i <= enc->lastRow; i++ )
631
     {
632
@@ -1111,15 +1126,9 @@ THE SOFTWARE.
633
         else
634
           encodingOffset = FT_GET_USHORT_LE();
635
 
636
-        if ( encodingOffset != 0xFFFFU )
637
-        {
638
-          if ( encodingOffset == defaultCharEncodingOffset )
639
-            encodingOffset = 0;
640
-          else if ( encodingOffset == 0 )
641
-            encodingOffset = defaultCharEncodingOffset;
642
-        }
643
-
644
-        *offset++ = encodingOffset;
645
+        /* everything is off by 1 due to the artificial glyph 0 */
646
+        *offset++ = encodingOffset == 0xFFFF ? 0xFFFF
647
+                                             : encodingOffset + 1;
648
       }
649
     }
650
     FT_Stream_ExitFrame( stream );
651
--- src/smooth/ftgrays.c.orig	2019-02-23 09:06:07 UTC
652
+++ src/smooth/ftgrays.c
653
@@ -1755,7 +1755,6 @@ typedef ptrdiff_t  FT_PtrDist;
654
   {
655
     const FT_Outline*  outline    = (const FT_Outline*)params->source;
656
     const FT_Bitmap*   target_map = params->target;
657
-    FT_BBox            clip;
658
 
659
 #ifndef FT_STATIC_RASTER
660
     gray_TWorker  worker[1];
661
@@ -1792,6 +1791,11 @@ typedef ptrdiff_t  FT_PtrDist;
662
 
663
       ras.render_span      = (FT_Raster_Span_Func)params->gray_spans;
664
       ras.render_span_data = params->user;
665
+
666
+      ras.min_ex = params->clip_box.xMin;
667
+      ras.min_ey = params->clip_box.yMin;
668
+      ras.max_ex = params->clip_box.xMax;
669
+      ras.max_ey = params->clip_box.yMax;
670
     }
671
     else
672
     {
673
@@ -1816,27 +1820,14 @@ typedef ptrdiff_t  FT_PtrDist;
674
 
675
       ras.render_span      = (FT_Raster_Span_Func)NULL;
676
       ras.render_span_data = NULL;
677
-    }
678
 
679
-    /* compute clipping box */
680
-    if ( params->flags & FT_RASTER_FLAG_DIRECT &&
681
-         params->flags & FT_RASTER_FLAG_CLIP   )
682
-      clip = params->clip_box;
683
-    else
684
-    {
685
-      /* compute clip box from target pixmap */
686
-      clip.xMin = 0;
687
-      clip.yMin = 0;
688
-      clip.xMax = (FT_Pos)target_map->width;
689
-      clip.yMax = (FT_Pos)target_map->rows;
690
+      ras.min_ex = 0;
691
+      ras.min_ey = 0;
692
+      ras.max_ex = (FT_Pos)target_map->width;
693
+      ras.max_ey = (FT_Pos)target_map->rows;
694
     }
695
 
696
-    /* clip to target bitmap, exit if nothing to do */
697
-    ras.min_ex = clip.xMin;
698
-    ras.min_ey = clip.yMin;
699
-    ras.max_ex = clip.xMax;
700
-    ras.max_ey = clip.yMax;
701
-
702
+    /* exit if nothing to do */
703
     if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
704
       return 0;
705
 
(-)files/pkg-message.in (-1 / +1 lines)
Lines 16-19 Link Here
16
16
17
The controllable properties are listed in the section "Controlling FreeType
17
The controllable properties are listed in the section "Controlling FreeType
18
Modules" in the reference's table of contents
18
Modules" in the reference's table of contents
19
(%%DOCSDIR%%/reference/ft2-toc.html, if documentation was installed).
19
(%%DOCSDIR%%/reference/site/index.html, if documentation was installed).
(-)pkg-plist (-1 / +2 lines)
Lines 15-20 Link Here
15
include/freetype2/freetype/ftcache.h
15
include/freetype2/freetype/ftcache.h
16
include/freetype2/freetype/ftchapters.h
16
include/freetype2/freetype/ftchapters.h
17
include/freetype2/freetype/ftcid.h
17
include/freetype2/freetype/ftcid.h
18
include/freetype2/freetype/ftcolor.h
18
include/freetype2/freetype/fterrdef.h
19
include/freetype2/freetype/fterrdef.h
19
include/freetype2/freetype/fterrors.h
20
include/freetype2/freetype/fterrors.h
20
include/freetype2/freetype/ftfntfmt.h
21
include/freetype2/freetype/ftfntfmt.h
Lines 51-57 Link Here
51
lib/libfreetype.a
52
lib/libfreetype.a
52
lib/libfreetype.so
53
lib/libfreetype.so
53
lib/libfreetype.so.6
54
lib/libfreetype.so.6
54
lib/libfreetype.so.6.16.1
55
lib/libfreetype.so.6.17.0
55
libdata/pkgconfig/freetype2.pc
56
libdata/pkgconfig/freetype2.pc
56
%%CONFIG%%man/man1/freetype-config.1.gz
57
%%CONFIG%%man/man1/freetype-config.1.gz
57
share/aclocal/freetype2.m4
58
share/aclocal/freetype2.m4

Return to bug 236867