/[freetype]/freetype2/src/psnames/psmodule.c
ViewVC logotype

Diff of /freetype2/src/psnames/psmodule.c

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

revision 1.38 by davidT, Wed Oct 29 21:43:51 2003 UTC revision 1.39 by freetype, Wed Mar 9 17:33:03 2005 UTC
# Line 39  Line 39 
39    static FT_UInt32    static FT_UInt32
40    ps_unicode_value( const char*  glyph_name )    ps_unicode_value( const char*  glyph_name )
41    {    {
     FT_Int  n;  
     char    first = glyph_name[0];  
     char    temp[64];  
   
   
42      /* If the name begins with `uni', then the glyph name may be a */      /* If the name begins with `uni', then the glyph name may be a */
43      /* hard-coded unicode character code.                          */      /* hard-coded unicode character code.                          */
44      if ( glyph_name[0] == 'u' &&      if ( glyph_name[0] == 'u' &&
# Line 127  Line 122 
122      /* look for a non-initial dot in the glyph name in order to */      /* look for a non-initial dot in the glyph name in order to */
123      /* sort-out variants like `A.swash', `e.final', etc.        */      /* sort-out variants like `A.swash', `e.final', etc.        */
124      {      {
125        const char*  p;        const char*  p   = glyph_name;
126        int          len;        const char*  dot = NULL;
   
127    
       p = glyph_name;  
128    
129        while ( *p && *p != '.' )        for ( ; *p; p++ )
         p++;  
   
       len = (int)( p - glyph_name );  
   
       if ( *p && len < 64 )  
130        {        {
131          ft_strncpy( temp, glyph_name, len );          if ( *p == '.' && p > glyph_name && !dot )
132          temp[len]  = 0;            dot = p;
         glyph_name = temp;  
133        }        }
     }  
   
     /* now, look up the glyph in the Adobe Glyph List */  
     for ( n = 0; n < NUM_ADOBE_GLYPHS; n++ )  
     {  
       const char*  name = sid_standard_names[n];  
134    
135          if ( !dot )
136            dot = p;
137    
138        if ( first == name[0] && ft_strcmp( glyph_name, name ) == 0 )        /* now, look up the glyph in the Adobe Glyph List */
139          return ps_names_to_unicode[n];        return ft_get_adobe_glyph_index( glyph_name, dot );
140      }      }
   
     /* not found, there is probably no Unicode value for this glyph name */  
     return 0;  
141    }    }
142    
143    
# Line 320  Line 300 
300    static const char*    static const char*
301    ps_get_macintosh_name( FT_UInt  name_index )    ps_get_macintosh_name( FT_UInt  name_index )
302    {    {
303      if ( name_index >= 258 )      if ( name_index >= FT_NUM_MAC_NAMES )
304        name_index = 0;        name_index = 0;
305    
306      return ps_glyph_names[mac_standard_names[name_index]];      return ft_standard_glyph_names + ft_mac_names[name_index];
307    }    }
308    
309    
310    static const char*    static const char*
311    ps_get_standard_strings( FT_UInt  sid )    ps_get_standard_strings( FT_UInt  sid )
312    {    {
313      return ( sid < NUM_SID_GLYPHS ? sid_standard_names[sid] : 0 );      if ( sid >= FT_NUM_SID_NAMES )
314          return 0;
315    
316        return ft_standard_glyph_names + ft_sid_names[sid];
317    }    }
318    
319    

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

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