src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c
changeset 54876 da3834261f0c
parent 49234 3375a8039fde
equal deleted inserted replaced
54875:bcfedddcf4ce 54876:da3834261f0c
     1 /***************************************************************************/
     1 /****************************************************************************
     2 /*                                                                         */
     2  *
     3 /*  cffdrivr.c                                                             */
     3  * cffdrivr.c
     4 /*                                                                         */
     4  *
     5 /*    OpenType font driver implementation (body).                          */
     5  *   OpenType font driver implementation (body).
     6 /*                                                                         */
     6  *
     7 /*  Copyright 1996-2018 by                                                 */
     7  * Copyright (C) 1996-2019 by
     8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
     8  * David Turner, Robert Wilhelm, and Werner Lemberg.
     9 /*                                                                         */
     9  *
    10 /*  This file is part of the FreeType project, and may only be used,       */
    10  * This file is part of the FreeType project, and may only be used,
    11 /*  modified, and distributed under the terms of the FreeType project      */
    11  * modified, and distributed under the terms of the FreeType project
    12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
    13 /*  this file you indicate that you have read the license and              */
    13  * this file you indicate that you have read the license and
    14 /*  understand and accept it fully.                                        */
    14  * understand and accept it fully.
    15 /*                                                                         */
    15  *
    16 /***************************************************************************/
    16  */
    17 
    17 
    18 
    18 
    19 #include <ft2build.h>
    19 #include <ft2build.h>
    20 #include FT_FREETYPE_H
    20 #include FT_FREETYPE_H
    21 #include FT_INTERNAL_DEBUG_H
    21 #include FT_INTERNAL_DEBUG_H
    40 #include FT_SERVICE_MULTIPLE_MASTERS_H
    40 #include FT_SERVICE_MULTIPLE_MASTERS_H
    41 #include FT_SERVICE_METRICS_VARIATIONS_H
    41 #include FT_SERVICE_METRICS_VARIATIONS_H
    42 #endif
    42 #endif
    43 
    43 
    44 #include "cfferrs.h"
    44 #include "cfferrs.h"
    45 #include "cffpic.h"
       
    46 
    45 
    47 #include FT_SERVICE_FONT_FORMAT_H
    46 #include FT_SERVICE_FONT_FORMAT_H
    48 #include FT_SERVICE_GLYPH_DICT_H
    47 #include FT_SERVICE_GLYPH_DICT_H
    49 #include FT_SERVICE_PROPERTIES_H
    48 #include FT_SERVICE_PROPERTIES_H
    50 #include FT_DRIVER_H
    49 #include FT_DRIVER_H
    51 
    50 
    52 
    51 
    53   /*************************************************************************/
    52   /**************************************************************************
    54   /*                                                                       */
    53    *
    55   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
    54    * The macro FT_COMPONENT is used in trace mode.  It is an implicit
    56   /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
    55    * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
    57   /* messages during execution.                                            */
    56    * messages during execution.
    58   /*                                                                       */
    57    */
    59 #undef  FT_COMPONENT
    58 #undef  FT_COMPONENT
    60 #define FT_COMPONENT  trace_cffdriver
    59 #define FT_COMPONENT  cffdriver
    61 
    60 
    62 
    61 
    63   /*************************************************************************/
    62   /*************************************************************************/
    64   /*************************************************************************/
    63   /*************************************************************************/
    65   /*************************************************************************/
    64   /*************************************************************************/
    71   /*************************************************************************/
    70   /*************************************************************************/
    72   /*************************************************************************/
    71   /*************************************************************************/
    73   /*************************************************************************/
    72   /*************************************************************************/
    74 
    73 
    75 
    74 
    76   /*************************************************************************/
    75   /**************************************************************************
    77   /*                                                                       */
    76    *
    78   /* <Function>                                                            */
    77    * @Function:
    79   /*    cff_get_kerning                                                    */
    78    *   cff_get_kerning
    80   /*                                                                       */
    79    *
    81   /* <Description>                                                         */
    80    * @Description:
    82   /*    A driver method used to return the kerning vector between two      */
    81    *   A driver method used to return the kerning vector between two
    83   /*    glyphs of the same face.                                           */
    82    *   glyphs of the same face.
    84   /*                                                                       */
    83    *
    85   /* <Input>                                                               */
    84    * @Input:
    86   /*    face        :: A handle to the source face object.                 */
    85    *   face ::
    87   /*                                                                       */
    86    *     A handle to the source face object.
    88   /*    left_glyph  :: The index of the left glyph in the kern pair.       */
    87    *
    89   /*                                                                       */
    88    *   left_glyph ::
    90   /*    right_glyph :: The index of the right glyph in the kern pair.      */
    89    *     The index of the left glyph in the kern pair.
    91   /*                                                                       */
    90    *
    92   /* <Output>                                                              */
    91    *   right_glyph ::
    93   /*    kerning     :: The kerning vector.  This is in font units for      */
    92    *     The index of the right glyph in the kern pair.
    94   /*                   scalable formats, and in pixels for fixed-sizes     */
    93    *
    95   /*                   formats.                                            */
    94    * @Output:
    96   /*                                                                       */
    95    *   kerning ::
    97   /* <Return>                                                              */
    96    *     The kerning vector.  This is in font units for
    98   /*    FreeType error code.  0 means success.                             */
    97    *     scalable formats, and in pixels for fixed-sizes
    99   /*                                                                       */
    98    *     formats.
   100   /* <Note>                                                                */
    99    *
   101   /*    Only horizontal layouts (left-to-right & right-to-left) are        */
   100    * @Return:
   102   /*    supported by this function.  Other layouts, or more sophisticated  */
   101    *   FreeType error code.  0 means success.
   103   /*    kernings, are out of scope of this method (the basic driver        */
   102    *
   104   /*    interface is meant to be simple).                                  */
   103    * @Note:
   105   /*                                                                       */
   104    *   Only horizontal layouts (left-to-right & right-to-left) are
   106   /*    They can be implemented by format-specific interfaces.             */
   105    *   supported by this function.  Other layouts, or more sophisticated
   107   /*                                                                       */
   106    *   kernings, are out of scope of this method (the basic driver
       
   107    *   interface is meant to be simple).
       
   108    *
       
   109    *   They can be implemented by format-specific interfaces.
       
   110    */
   108   FT_CALLBACK_DEF( FT_Error )
   111   FT_CALLBACK_DEF( FT_Error )
   109   cff_get_kerning( FT_Face     ttface,          /* TT_Face */
   112   cff_get_kerning( FT_Face     ttface,          /* TT_Face */
   110                    FT_UInt     left_glyph,
   113                    FT_UInt     left_glyph,
   111                    FT_UInt     right_glyph,
   114                    FT_UInt     right_glyph,
   112                    FT_Vector*  kerning )
   115                    FT_Vector*  kerning )
   123 
   126 
   124     return FT_Err_Ok;
   127     return FT_Err_Ok;
   125   }
   128   }
   126 
   129 
   127 
   130 
   128   /*************************************************************************/
   131   /**************************************************************************
   129   /*                                                                       */
   132    *
   130   /* <Function>                                                            */
   133    * @Function:
   131   /*    cff_glyph_load                                                     */
   134    *   cff_glyph_load
   132   /*                                                                       */
   135    *
   133   /* <Description>                                                         */
   136    * @Description:
   134   /*    A driver method used to load a glyph within a given glyph slot.    */
   137    *   A driver method used to load a glyph within a given glyph slot.
   135   /*                                                                       */
   138    *
   136   /* <Input>                                                               */
   139    * @Input:
   137   /*    slot        :: A handle to the target slot object where the glyph  */
   140    *   slot ::
   138   /*                   will be loaded.                                     */
   141    *     A handle to the target slot object where the glyph
   139   /*                                                                       */
   142    *     will be loaded.
   140   /*    size        :: A handle to the source face size at which the glyph */
   143    *
   141   /*                   must be scaled, loaded, etc.                        */
   144    *   size ::
   142   /*                                                                       */
   145    *     A handle to the source face size at which the glyph
   143   /*    glyph_index :: The index of the glyph in the font file.            */
   146    *     must be scaled, loaded, etc.
   144   /*                                                                       */
   147    *
   145   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
   148    *   glyph_index ::
   146   /*                   FT_LOAD_??? constants can be used to control the    */
   149    *     The index of the glyph in the font file.
   147   /*                   glyph loading process (e.g., whether the outline    */
   150    *
   148   /*                   should be scaled, whether to load bitmaps or not,   */
   151    *   load_flags ::
   149   /*                   whether to hint the outline, etc).                  */
   152    *     A flag indicating what to load for this glyph.  The
   150   /*                                                                       */
   153    *     FT_LOAD_??? constants can be used to control the
   151   /* <Return>                                                              */
   154    *     glyph loading process (e.g., whether the outline
   152   /*    FreeType error code.  0 means success.                             */
   155    *     should be scaled, whether to load bitmaps or not,
   153   /*                                                                       */
   156    *     whether to hint the outline, etc).
       
   157    *
       
   158    * @Return:
       
   159    *   FreeType error code.  0 means success.
       
   160    */
   154   FT_CALLBACK_DEF( FT_Error )
   161   FT_CALLBACK_DEF( FT_Error )
   155   cff_glyph_load( FT_GlyphSlot  cffslot,      /* CFF_GlyphSlot */
   162   cff_glyph_load( FT_GlyphSlot  cffslot,      /* CFF_GlyphSlot */
   156                   FT_Size       cffsize,      /* CFF_Size      */
   163                   FT_Size       cffsize,      /* CFF_Size      */
   157                   FT_UInt       glyph_index,
   164                   FT_UInt       glyph_index,
   158                   FT_Int32      load_flags )
   165                   FT_Int32      load_flags )
   300     return error;
   307     return error;
   301   }
   308   }
   302 
   309 
   303 
   310 
   304   /*
   311   /*
   305    *  GLYPH DICT SERVICE
   312    * GLYPH DICT SERVICE
   306    *
   313    *
   307    */
   314    */
   308 
   315 
   309   static FT_Error
   316   static FT_Error
   310   cff_get_glyph_name( CFF_Face    face,
   317   cff_get_glyph_name( CFF_Face    face,
   339       else
   346       else
   340       {
   347       {
   341         FT_ERROR(( "cff_get_glyph_name:"
   348         FT_ERROR(( "cff_get_glyph_name:"
   342                    " cannot get glyph name from a CFF2 font\n"
   349                    " cannot get glyph name from a CFF2 font\n"
   343                    "                   "
   350                    "                   "
   344                    " without the `PSNames' module\n" ));
   351                    " without the `psnames' module\n" ));
   345         error = FT_THROW( Missing_Module );
   352         error = FT_THROW( Missing_Module );
   346         goto Exit;
   353         goto Exit;
   347       }
   354       }
   348     }
   355     }
   349 
   356 
   350     if ( !font->psnames )
   357     if ( !font->psnames )
   351     {
   358     {
   352       FT_ERROR(( "cff_get_glyph_name:"
   359       FT_ERROR(( "cff_get_glyph_name:"
   353                  " cannot get glyph name from CFF & CEF fonts\n"
   360                  " cannot get glyph name from CFF & CEF fonts\n"
   354                  "                   "
   361                  "                   "
   355                  " without the `PSNames' module\n" ));
   362                  " without the `psnames' module\n" ));
   356       error = FT_THROW( Missing_Module );
   363       error = FT_THROW( Missing_Module );
   357       goto Exit;
   364       goto Exit;
   358     }
   365     }
   359 
   366 
   360     /* first, locate the sid in the charset table */
   367     /* first, locate the sid in the charset table */
   406       else
   413       else
   407       {
   414       {
   408         FT_ERROR(( "cff_get_name_index:"
   415         FT_ERROR(( "cff_get_name_index:"
   409                    " cannot get glyph index from a CFF2 font\n"
   416                    " cannot get glyph index from a CFF2 font\n"
   410                    "                   "
   417                    "                   "
   411                    " without the `PSNames' module\n" ));
   418                    " without the `psnames' module\n" ));
   412         return 0;
   419         return 0;
   413       }
   420       }
   414     }
   421     }
   415 
   422 
   416     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
   423     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
   444     (FT_GlyphDict_NameIndexFunc)cff_get_name_index       /* name_index */
   451     (FT_GlyphDict_NameIndexFunc)cff_get_name_index       /* name_index */
   445   )
   452   )
   446 
   453 
   447 
   454 
   448   /*
   455   /*
   449    *  POSTSCRIPT INFO SERVICE
   456    * POSTSCRIPT INFO SERVICE
   450    *
   457    *
   451    */
   458    */
   452 
   459 
   453   static FT_Int
   460   static FT_Int
   454   cff_ps_has_glyph_names( FT_Face  face )
   461   cff_ps_has_glyph_names( FT_Face  face )
   591     (PS_GetFontValueFunc)  NULL                     /* ps_get_font_value   */
   598     (PS_GetFontValueFunc)  NULL                     /* ps_get_font_value   */
   592   )
   599   )
   593 
   600 
   594 
   601 
   595   /*
   602   /*
   596    *  POSTSCRIPT NAME SERVICE
   603    * POSTSCRIPT NAME SERVICE
   597    *
   604    *
   598    */
   605    */
   599 
   606 
   600   static const char*
   607   static const char*
   601   cff_get_ps_name( CFF_Face  face )
   608   cff_get_ps_name( CFF_Face  face )
   652 
   659 
   653     FT_Face     face    = FT_CMAP_FACE( cmap );
   660     FT_Face     face    = FT_CMAP_FACE( cmap );
   654     FT_Library  library = FT_FACE_LIBRARY( face );
   661     FT_Library  library = FT_FACE_LIBRARY( face );
   655 
   662 
   656 
   663 
   657     if ( cmap->clazz != &CFF_CMAP_ENCODING_CLASS_REC_GET &&
   664     if ( cmap->clazz != &cff_cmap_encoding_class_rec &&
   658          cmap->clazz != &CFF_CMAP_UNICODE_CLASS_REC_GET  )
   665          cmap->clazz != &cff_cmap_unicode_class_rec  )
   659     {
   666     {
   660       FT_Module           sfnt    = FT_Get_Module( library, "sfnt" );
   667       FT_Module           sfnt    = FT_Get_Module( library, "sfnt" );
   661       FT_Service_TTCMaps  service =
   668       FT_Service_TTCMaps  service =
   662         (FT_Service_TTCMaps)ft_module_get_service( sfnt,
   669         (FT_Service_TTCMaps)ft_module_get_service( sfnt,
   663                                                    FT_SERVICE_ID_TT_CMAP,
   670                                                    FT_SERVICE_ID_TT_CMAP,
   680     (TT_CMap_Info_GetFunc)cff_get_cmap_info    /* get_cmap_info */
   687     (TT_CMap_Info_GetFunc)cff_get_cmap_info    /* get_cmap_info */
   681   )
   688   )
   682 
   689 
   683 
   690 
   684   /*
   691   /*
   685    *  CID INFO SERVICE
   692    * CID INFO SERVICE
   686    *
   693    *
   687    */
   694    */
   688   static FT_Error
   695   static FT_Error
   689   cff_get_ros( CFF_Face      face,
   696   cff_get_ros( CFF_Face      face,
   690                const char*  *registry,
   697                const char*  *registry,
   786       {
   793       {
   787         error = FT_THROW( Invalid_Argument );
   794         error = FT_THROW( Invalid_Argument );
   788         goto Fail;
   795         goto Fail;
   789       }
   796       }
   790 
   797 
   791       if ( glyph_index > cff->num_glyphs )
   798       if ( glyph_index >= cff->num_glyphs )
   792       {
   799       {
   793         error = FT_THROW( Invalid_Argument );
   800         error = FT_THROW( Invalid_Argument );
   794         goto Fail;
   801         goto Fail;
   795       }
   802       }
   796 
   803 
   816       cff_get_cid_from_glyph_index             /* get_cid_from_glyph_index */
   823       cff_get_cid_from_glyph_index             /* get_cid_from_glyph_index */
   817   )
   824   )
   818 
   825 
   819 
   826 
   820   /*
   827   /*
   821    *  PROPERTY SERVICE
   828    * PROPERTY SERVICE
   822    *
   829    *
   823    */
   830    */
   824 
   831 
   825   FT_DEFINE_SERVICE_PROPERTIESREC(
   832   FT_DEFINE_SERVICE_PROPERTIESREC(
   826     cff_service_properties,
   833     cff_service_properties,
   830 
   837 
   831 
   838 
   832 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
   839 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
   833 
   840 
   834   /*
   841   /*
   835    *  MULTIPLE MASTER SERVICE
   842    * MULTIPLE MASTER SERVICE
   836    *
   843    *
   837    */
   844    */
   838 
   845 
   839   static FT_Error
   846   static FT_Error
   840   cff_set_mm_blend( CFF_Face   face,
   847   cff_set_mm_blend( CFF_Face   face,
   859     return mm->get_mm_blend( FT_FACE( face ), num_coords, coords );
   866     return mm->get_mm_blend( FT_FACE( face ), num_coords, coords );
   860   }
   867   }
   861 
   868 
   862 
   869 
   863   static FT_Error
   870   static FT_Error
       
   871   cff_set_mm_weightvector( CFF_Face   face,
       
   872                            FT_UInt    len,
       
   873                            FT_Fixed*  weightvector )
       
   874   {
       
   875     FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
       
   876 
       
   877 
       
   878     return mm->set_mm_weightvector( FT_FACE( face ), len, weightvector );
       
   879   }
       
   880 
       
   881 
       
   882   static FT_Error
       
   883   cff_get_mm_weightvector( CFF_Face   face,
       
   884                            FT_UInt*   len,
       
   885                            FT_Fixed*  weightvector )
       
   886   {
       
   887     FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
       
   888 
       
   889 
       
   890     return mm->get_mm_weightvector( FT_FACE( face ), len, weightvector );
       
   891   }
       
   892 
       
   893 
       
   894   static FT_Error
   864   cff_get_mm_var( CFF_Face     face,
   895   cff_get_mm_var( CFF_Face     face,
   865                   FT_MM_Var*  *master )
   896                   FT_MM_Var*  *master )
   866   {
   897   {
   867     FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
   898     FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
   868 
   899 
   907 
   938 
   908 
   939 
   909   FT_DEFINE_SERVICE_MULTIMASTERSREC(
   940   FT_DEFINE_SERVICE_MULTIMASTERSREC(
   910     cff_service_multi_masters,
   941     cff_service_multi_masters,
   911 
   942 
   912     (FT_Get_MM_Func)        NULL,                   /* get_mm         */
   943     (FT_Get_MM_Func)             NULL,                    /* get_mm              */
   913     (FT_Set_MM_Design_Func) NULL,                   /* set_mm_design  */
   944     (FT_Set_MM_Design_Func)      NULL,                    /* set_mm_design       */
   914     (FT_Set_MM_Blend_Func)  cff_set_mm_blend,       /* set_mm_blend   */
   945     (FT_Set_MM_Blend_Func)       cff_set_mm_blend,        /* set_mm_blend        */
   915     (FT_Get_MM_Blend_Func)  cff_get_mm_blend,       /* get_mm_blend   */
   946     (FT_Get_MM_Blend_Func)       cff_get_mm_blend,        /* get_mm_blend        */
   916     (FT_Get_MM_Var_Func)    cff_get_mm_var,         /* get_mm_var     */
   947     (FT_Get_MM_Var_Func)         cff_get_mm_var,          /* get_mm_var          */
   917     (FT_Set_Var_Design_Func)cff_set_var_design,     /* set_var_design */
   948     (FT_Set_Var_Design_Func)     cff_set_var_design,      /* set_var_design      */
   918     (FT_Get_Var_Design_Func)cff_get_var_design,     /* get_var_design */
   949     (FT_Get_Var_Design_Func)     cff_get_var_design,      /* get_var_design      */
   919     (FT_Set_Instance_Func)  cff_set_instance,       /* set_instance   */
   950     (FT_Set_Instance_Func)       cff_set_instance,        /* set_instance        */
   920 
   951     (FT_Set_MM_WeightVector_Func)cff_set_mm_weightvector, /* set_mm_weightvector */
   921     (FT_Get_Var_Blend_Func) cff_get_var_blend,      /* get_var_blend  */
   952     (FT_Get_MM_WeightVector_Func)cff_get_mm_weightvector, /* get_mm_weightvector */
   922     (FT_Done_Blend_Func)    cff_done_blend          /* done_blend     */
   953 
       
   954     (FT_Get_Var_Blend_Func)      cff_get_var_blend,       /* get_var_blend       */
       
   955     (FT_Done_Blend_Func)         cff_done_blend           /* done_blend          */
   923   )
   956   )
   924 
   957 
   925 
   958 
   926   /*
   959   /*
   927    *  METRICS VARIATIONS SERVICE
   960    * METRICS VARIATIONS SERVICE
   928    *
   961    *
   929    */
   962    */
   930 
   963 
   931   static FT_Error
   964   static FT_Error
   932   cff_hadvance_adjust( CFF_Face  face,
   965   cff_hadvance_adjust( CFF_Face  face,
   966   )
   999   )
   967 #endif
  1000 #endif
   968 
  1001 
   969 
  1002 
   970   /*
  1003   /*
   971    *  CFFLOAD SERVICE
  1004    * CFFLOAD SERVICE
   972    *
  1005    *
   973    */
  1006    */
   974 
  1007 
   975   FT_DEFINE_SERVICE_CFFLOADREC(
  1008   FT_DEFINE_SERVICE_CFFLOADREC(
   976     cff_service_cff_load,
  1009     cff_service_cff_load,
   999      defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
  1032      defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
  1000   FT_DEFINE_SERVICEDESCREC10(
  1033   FT_DEFINE_SERVICEDESCREC10(
  1001     cff_services,
  1034     cff_services,
  1002 
  1035 
  1003     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1036     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1004     FT_SERVICE_ID_MULTI_MASTERS,        &CFF_SERVICE_MULTI_MASTERS_GET,
  1037     FT_SERVICE_ID_MULTI_MASTERS,        &cff_service_multi_masters,
  1005     FT_SERVICE_ID_METRICS_VARIATIONS,   &CFF_SERVICE_METRICS_VAR_GET,
  1038     FT_SERVICE_ID_METRICS_VARIATIONS,   &cff_service_metrics_variations,
  1006     FT_SERVICE_ID_POSTSCRIPT_INFO,      &CFF_SERVICE_PS_INFO_GET,
  1039     FT_SERVICE_ID_POSTSCRIPT_INFO,      &cff_service_ps_info,
  1007     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
  1040     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
  1008     FT_SERVICE_ID_GLYPH_DICT,           &CFF_SERVICE_GLYPH_DICT_GET,
  1041     FT_SERVICE_ID_GLYPH_DICT,           &cff_service_glyph_dict,
  1009     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
  1042     FT_SERVICE_ID_TT_CMAP,              &cff_service_get_cmap_info,
  1010     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
  1043     FT_SERVICE_ID_CID,                  &cff_service_cid_info,
  1011     FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
  1044     FT_SERVICE_ID_PROPERTIES,           &cff_service_properties,
  1012     FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
  1045     FT_SERVICE_ID_CFF_LOAD,             &cff_service_cff_load
  1013   )
  1046   )
  1014 #elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
  1047 #elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
  1015   FT_DEFINE_SERVICEDESCREC8(
  1048   FT_DEFINE_SERVICEDESCREC8(
  1016     cff_services,
  1049     cff_services,
  1017 
  1050 
  1018     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1051     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1019     FT_SERVICE_ID_POSTSCRIPT_INFO,      &CFF_SERVICE_PS_INFO_GET,
  1052     FT_SERVICE_ID_POSTSCRIPT_INFO,      &cff_service_ps_info,
  1020     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
  1053     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
  1021     FT_SERVICE_ID_GLYPH_DICT,           &CFF_SERVICE_GLYPH_DICT_GET,
  1054     FT_SERVICE_ID_GLYPH_DICT,           &cff_service_glyph_dict,
  1022     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
  1055     FT_SERVICE_ID_TT_CMAP,              &cff_service_get_cmap_info,
  1023     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
  1056     FT_SERVICE_ID_CID,                  &cff_service_cid_info,
  1024     FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
  1057     FT_SERVICE_ID_PROPERTIES,           &cff_service_properties,
  1025     FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
  1058     FT_SERVICE_ID_CFF_LOAD,             &cff_service_cff_load
  1026   )
  1059   )
  1027 #elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
  1060 #elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
  1028   FT_DEFINE_SERVICEDESCREC9(
  1061   FT_DEFINE_SERVICEDESCREC9(
  1029     cff_services,
  1062     cff_services,
  1030 
  1063 
  1031     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1064     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1032     FT_SERVICE_ID_MULTI_MASTERS,        &CFF_SERVICE_MULTI_MASTERS_GET,
  1065     FT_SERVICE_ID_MULTI_MASTERS,        &cff_service_multi_masters,
  1033     FT_SERVICE_ID_METRICS_VARIATIONS,   &CFF_SERVICE_METRICS_VAR_GET,
  1066     FT_SERVICE_ID_METRICS_VARIATIONS,   &cff_service_metrics_var,
  1034     FT_SERVICE_ID_POSTSCRIPT_INFO,      &CFF_SERVICE_PS_INFO_GET,
  1067     FT_SERVICE_ID_POSTSCRIPT_INFO,      &cff_service_ps_info,
  1035     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
  1068     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
  1036     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
  1069     FT_SERVICE_ID_TT_CMAP,              &cff_service_get_cmap_info,
  1037     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
  1070     FT_SERVICE_ID_CID,                  &cff_service_cid_info,
  1038     FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
  1071     FT_SERVICE_ID_PROPERTIES,           &cff_service_properties,
  1039     FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
  1072     FT_SERVICE_ID_CFF_LOAD,             &cff_service_cff_load
  1040   )
  1073   )
  1041 #else
  1074 #else
  1042   FT_DEFINE_SERVICEDESCREC7(
  1075   FT_DEFINE_SERVICEDESCREC7(
  1043     cff_services,
  1076     cff_services,
  1044 
  1077 
  1045     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1078     FT_SERVICE_ID_FONT_FORMAT,          FT_FONT_FORMAT_CFF,
  1046     FT_SERVICE_ID_POSTSCRIPT_INFO,      &CFF_SERVICE_PS_INFO_GET,
  1079     FT_SERVICE_ID_POSTSCRIPT_INFO,      &cff_service_ps_info,
  1047     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
  1080     FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
  1048     FT_SERVICE_ID_TT_CMAP,              &CFF_SERVICE_GET_CMAP_INFO_GET,
  1081     FT_SERVICE_ID_TT_CMAP,              &cff_service_get_cmap_info,
  1049     FT_SERVICE_ID_CID,                  &CFF_SERVICE_CID_INFO_GET,
  1082     FT_SERVICE_ID_CID,                  &cff_service_cid_info,
  1050     FT_SERVICE_ID_PROPERTIES,           &CFF_SERVICE_PROPERTIES_GET,
  1083     FT_SERVICE_ID_PROPERTIES,           &cff_service_properties,
  1051     FT_SERVICE_ID_CFF_LOAD,             &CFF_SERVICE_CFF_LOAD_GET
  1084     FT_SERVICE_ID_CFF_LOAD,             &cff_service_cff_load
  1052   )
  1085   )
  1053 #endif
  1086 #endif
  1054 
  1087 
  1055 
  1088 
  1056   FT_CALLBACK_DEF( FT_Module_Interface )
  1089   FT_CALLBACK_DEF( FT_Module_Interface )
  1060     FT_Library           library;
  1093     FT_Library           library;
  1061     FT_Module            sfnt;
  1094     FT_Module            sfnt;
  1062     FT_Module_Interface  result;
  1095     FT_Module_Interface  result;
  1063 
  1096 
  1064 
  1097 
  1065     /* CFF_SERVICES_GET dereferences `library' in PIC mode */
  1098     result = ft_service_list_lookup( cff_services, module_interface );
  1066 #ifdef FT_CONFIG_OPTION_PIC
  1099     if ( result )
       
  1100       return result;
       
  1101 
       
  1102     /* `driver' is not yet evaluated */
  1067     if ( !driver )
  1103     if ( !driver )
  1068       return NULL;
  1104       return NULL;
  1069     library = driver->library;
  1105     library = driver->library;
  1070     if ( !library )
  1106     if ( !library )
  1071       return NULL;
  1107       return NULL;
  1072 #endif
       
  1073 
       
  1074     result = ft_service_list_lookup( CFF_SERVICES_GET, module_interface );
       
  1075     if ( result )
       
  1076       return result;
       
  1077 
       
  1078     /* `driver' is not yet evaluated in non-PIC mode */
       
  1079 #ifndef FT_CONFIG_OPTION_PIC
       
  1080     if ( !driver )
       
  1081       return NULL;
       
  1082     library = driver->library;
       
  1083     if ( !library )
       
  1084       return NULL;
       
  1085 #endif
       
  1086 
  1108 
  1087     /* we pass our request to the `sfnt' module */
  1109     /* we pass our request to the `sfnt' module */
  1088     sfnt = FT_Get_Module( library, "sfnt" );
  1110     sfnt = FT_Get_Module( library, "sfnt" );
  1089 
  1111 
  1090     return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
  1112     return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;