summaryrefslogtreecommitdiff
path: root/graphics/freetype2/patches/patch-af
blob: a3aacdf82f20aafa2d8c7d130628175968189c5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$NetBSD: patch-af,v 1.1.2.1 2006/06/06 07:51:29 snj Exp $

--- src/cff/cffgload.c.orig	2005-04-18 06:53:05.000000000 +0200
+++ src/cff/cffgload.c	2006-06-05 23:23:48.000000000 +0200
@@ -2284,7 +2284,7 @@
   FT_LOCAL_DEF( FT_Error )
   cff_slot_load( CFF_GlyphSlot  glyph,
                  CFF_Size       size,
-                 FT_Int         glyph_index,
+                 FT_UInt         glyph_index,
                  FT_Int32       load_flags )
   {
     FT_Error      error;
@@ -2330,7 +2330,7 @@
 
         error = sfnt->load_sbit_image( face,
                                        (FT_ULong)size->strike_index,
-                                       (FT_UInt)glyph_index,
+                                       glyph_index,
                                        (FT_Int)load_flags,
                                        stream,
                                        &glyph->root.bitmap,
@@ -2393,7 +2393,13 @@
       /* subsetted font, glyph_indices and CIDs are identical, though */
       if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
            cff->charset.cids )
+      {
+        if ( glyph_index < cff->charset.max_cid )
         glyph_index = cff->charset.cids[glyph_index];
+        else
+          glyph_index = 0;
+      }
+
 
       cff_decoder_init( &decoder, face, size, glyph, hinting,
                         FT_LOAD_TARGET_MODE( load_flags ) );