/[freetype]/freetype2/src/truetype/ttpload.c
ViewVC logotype

Diff of /freetype2/src/truetype/ttpload.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.30 by wl, Thu Mar 10 15:49:45 2005 UTC revision 1.31 by wl, Thu May 5 07:44:20 2005 UTC
# Line 68  Line 68 
68      FT_ULong  table_len;      FT_ULong  table_len;
69    
70    
71        /* we need the size of the `glyf' table for malformed `loca' tables */
72        error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
73        if ( error )
74          goto Exit;
75    
76      FT_TRACE2(( "Locations " ));      FT_TRACE2(( "Locations " ));
77      error = face->goto_table( face, TTAG_loca, stream, &table_len );      error = face->goto_table( face, TTAG_loca, stream, &table_len );
78      if ( error )      if ( error )
# Line 152  Line 157 
157        }        }
158      }      }
159    
160      *asize = (FT_UInt)( pos2 - pos1 );      /* It isn't mentioned explicitly that the `loca' table must be  */
161        /* ordered, but implicitly it refers to the length of an entry  */
162        /* as the difference between the current and the next position. */
163        /* Anyway, there do exist (malformed) fonts which don't obey    */
164        /* this rule, so we are only able to provide an upper bound for */
165        /* the size.                                                    */
166        if ( pos2 > pos1 )
167          *asize = (FT_UInt)( pos2 - pos1 );
168        else
169          *asize = (FT_UInt)( face->glyf_len - pos1 );
170    
171      return pos1;      return pos1;
172    }    }
# Line 182  Line 196 
196      FT_ULong   table_len;      FT_ULong   table_len;
197    
198    
199        /* we need the size of the `glyf' table for malformed `loca' tables */
200        error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
201        if ( error )
202          goto Exit;
203    
204      FT_TRACE2(( "Locations " ));      FT_TRACE2(( "Locations " ));
205      LongOffsets = face->header.Index_To_Loc_Format;      LongOffsets = face->header.Index_To_Loc_Format;
206    
# Line 259  Line 278 
278      count  = 0;      count  = 0;
279    
280      if ( gindex < (FT_UInt)face->num_locations - 1 )      if ( gindex < (FT_UInt)face->num_locations - 1 )
281        count = (FT_UInt)( face->glyph_locations[gindex + 1] - offset );      {
282          FT_ULong  offset1 = face->glyph_locations[gindex + 1];
283    
284    
285          /* It isn't mentioned explicitly that the `loca' table must be  */
286          /* ordered, but implicitly it refers to the length of an entry  */
287          /* as the difference between the current and the next position. */
288          /* Anyway, there do exist (malformed) fonts which don't obey    */
289          /* this rule, so we are only able to provide an upper bound for */
290          /* the size.                                                    */
291          if ( offset1 > offset )
292            count = (FT_UInt)( offset1 - offset );
293          else
294            count = (FT_UInt)( face->glyf_len - offset );
295        }
296    
297      *asize = count;      *asize = count;
298      return offset;      return offset;

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26