Edit

kc3-lang/freetype/src/cff/cffload.h

Branch :

  • Show log

    Commit

  • Author : Werner Lemberg
    Date : 2010-03-02 13:00:55
    Hash : 03b3da8b
    Message : Improve CFF string (especially glyphname) lookup performance. We do this by avoiding memory allocation and file I/O. This is Savannah patch #7104. * src/cff/cfftypes.h: Include PS cmaps service and FT_INTERNAL_POSTSCRIPT_HINTS_H. (CFF_SubFontRec): Remove `num_local_subrs'. (CFF_FontRec): Add `num_strings', `strings', and `string_pool' fields. Remove `string_index' and `num_global_subrs' fields. Use real types instead of `void' for `pshinter' and `psnames' fields. * src/cff/cffload.c: Don't include PS cmaps service. (cff_index_get_pointers): Add `pool' parameter which allows to insert an extra NUL character for each String INDEX entry. (cff_index_get_name): Make it a local function. (cff_index_get_string): New function. (cff_subfont_load): Updated. (cff_font_load): Initialize `num_strings', `strings', and `string_pool' fields in the `CFF_FontRec' structure. (cff_index_get_sid_string): Use `cff_index_get_string' instead of `cff_index_get_name'. (cff_font_done): Updated. * src/cff/cffload.h: Don't include PS cmaps service. (cff_index_get_string): Added. (cff_index_get_sid_string): Updated. * src/cff/cffobjs.c: Don't include PS cmaps service and FT_INTERNAL_POSTSCRIPT_HINTS_H. (cff_size_get_globals_funcs, cff_slot_init): Updated. (cff_face_init): Follow `cff_index_get_name', `cff_index_get_string', and `cff_index_get_sid_string' changes. * src/cff/cffcmap.c (cff_sid_free_glyph_name): Removed. (cff_sid_to_glyph_name): Use `cff_index_get_cid_string'. (cff_cmap_unicode_init): Updated. * src/cff/cffdrivr.c: Don't include PS cmap service. (cff_get_glyph_name): Avoid unnecessary lookup for POSTSCRIPT_CMAPS service. (cff_get_glyph_name, cff_ps_get_font_info, cff_get_ros): Follow API `cff_index_get_sid_string' change. (cff_get_name_index): Use `cff_index_get_string' instead of `cff_index_get_name'. * src/cff/cffgload.c: Don't include FT_INTERNAL_POSTSCRIPT_HINTS_H. (cff_decoder_init, cff_decoder_prepare): Updated.

  • src/cff/cffload.h
  • /***************************************************************************/
    /*                                                                         */
    /*  cffload.h                                                              */
    /*                                                                         */
    /*    OpenType & CFF data/program tables loader (specification).           */
    /*                                                                         */
    /*  Copyright 1996-2001, 2002, 2003, 2007, 2008, 2010 by                   */
    /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    /*                                                                         */
    /*  This file is part of the FreeType project, and may only be used,       */
    /*  modified, and distributed under the terms of the FreeType project      */
    /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    /*  this file you indicate that you have read the license and              */
    /*  understand and accept it fully.                                        */
    /*                                                                         */
    /***************************************************************************/
    
    
    #ifndef __CFFLOAD_H__
    #define __CFFLOAD_H__
    
    
    #include <ft2build.h>
    #include "cfftypes.h"
    
    
    FT_BEGIN_HEADER
    
      FT_LOCAL( FT_UShort )
      cff_get_standard_encoding( FT_UInt  charcode );
    
    
      FT_LOCAL( FT_String* )
      cff_index_get_string( CFF_Font  font,
                            FT_UInt   element );
    
      FT_LOCAL( FT_String* )
      cff_index_get_sid_string( CFF_Font  font,
                                FT_UInt   sid );
    
    
      FT_LOCAL( FT_Error )
      cff_index_access_element( CFF_Index  idx,
                                FT_UInt    element,
                                FT_Byte**  pbytes,
                                FT_ULong*  pbyte_len );
    
      FT_LOCAL( void )
      cff_index_forget_element( CFF_Index  idx,
                                FT_Byte**  pbytes );
    
    
      FT_LOCAL( FT_UInt )
      cff_charset_cid_to_gindex( CFF_Charset  charset,
                                 FT_UInt      cid );
    
    
      FT_LOCAL( FT_Error )
      cff_font_load( FT_Library library, 
                     FT_Stream  stream,
                     FT_Int     face_index,
                     CFF_Font   font,
                     FT_Bool    pure_cff );
    
      FT_LOCAL( void )
      cff_font_done( CFF_Font  font );
    
    
      FT_LOCAL( FT_Byte )
      cff_fd_select_get( CFF_FDSelect  fdselect,
                         FT_UInt       glyph_index );
    
    
    FT_END_HEADER
    
    #endif /* __CFFLOAD_H__ */
    
    
    /* END */