< prev index next >

src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c

Print this page


   1 /***************************************************************************/
   2 /*                                                                         */
   3 /*  ttdriver.c                                                             */
   4 /*                                                                         */
   5 /*    TrueType font driver implementation (body).                          */
   6 /*                                                                         */
   7 /*  Copyright 1996-2018 by                                                 */
   8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
   9 /*                                                                         */
  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      */
  12 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  13 /*  this file you indicate that you have read the license and              */
  14 /*  understand and accept it fully.                                        */
  15 /*                                                                         */
  16 /***************************************************************************/
  17 
  18 
  19 #include <ft2build.h>
  20 #include FT_INTERNAL_DEBUG_H
  21 #include FT_INTERNAL_STREAM_H
  22 #include FT_INTERNAL_SFNT_H
  23 #include FT_SERVICE_FONT_FORMAT_H
  24 
  25 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  26 #include FT_MULTIPLE_MASTERS_H
  27 #include FT_SERVICE_MULTIPLE_MASTERS_H
  28 #include FT_SERVICE_METRICS_VARIATIONS_H
  29 #endif
  30 
  31 #include FT_SERVICE_TRUETYPE_ENGINE_H
  32 #include FT_SERVICE_TRUETYPE_GLYF_H
  33 #include FT_SERVICE_PROPERTIES_H
  34 #include FT_DRIVER_H
  35 
  36 #include "ttdriver.h"
  37 #include "ttgload.h"
  38 #include "ttpload.h"
  39 
  40 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  41 #include "ttgxvar.h"
  42 #endif
  43 
  44 #include "tterrors.h"
  45 
  46 #include "ttpic.h"
  47 
  48   /*************************************************************************/
  49   /*                                                                       */
  50   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
  51   /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
  52   /* messages during execution.                                            */
  53   /*                                                                       */
  54 #undef  FT_COMPONENT
  55 #define FT_COMPONENT  trace_ttdriver
  56 
  57 
  58   /*
  59    *  PROPERTY SERVICE
  60    *
  61    */
  62   static FT_Error
  63   tt_property_set( FT_Module    module,         /* TT_Driver */
  64                    const char*  property_name,
  65                    const void*  value,
  66                    FT_Bool      value_is_string )
  67   {
  68     FT_Error   error  = FT_Err_Ok;
  69     TT_Driver  driver = (TT_Driver)module;
  70 
  71 #ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
  72     FT_UNUSED( value_is_string );
  73 #endif
  74 
  75 


 147     tt_service_properties,
 148 
 149     (FT_Properties_SetFunc)tt_property_set,     /* set_property */
 150     (FT_Properties_GetFunc)tt_property_get      /* get_property */
 151   )
 152 
 153 
 154   /*************************************************************************/
 155   /*************************************************************************/
 156   /*************************************************************************/
 157   /****                                                                 ****/
 158   /****                                                                 ****/
 159   /****                          F A C E S                              ****/
 160   /****                                                                 ****/
 161   /****                                                                 ****/
 162   /*************************************************************************/
 163   /*************************************************************************/
 164   /*************************************************************************/
 165 
 166 
 167   /*************************************************************************/
 168   /*                                                                       */
 169   /* <Function>                                                            */
 170   /*    tt_get_kerning                                                     */
 171   /*                                                                       */
 172   /* <Description>                                                         */
 173   /*    A driver method used to return the kerning vector between two      */
 174   /*    glyphs of the same face.                                           */
 175   /*                                                                       */
 176   /* <Input>                                                               */
 177   /*    face        :: A handle to the source face object.                 */
 178   /*                                                                       */
 179   /*    left_glyph  :: The index of the left glyph in the kern pair.       */
 180   /*                                                                       */
 181   /*    right_glyph :: The index of the right glyph in the kern pair.      */
 182   /*                                                                       */
 183   /* <Output>                                                              */
 184   /*    kerning     :: The kerning vector.  This is in font units for      */
 185   /*                   scalable formats, and in pixels for fixed-sizes     */
 186   /*                   formats.                                            */
 187   /*                                                                       */
 188   /* <Return>                                                              */
 189   /*    FreeType error code.  0 means success.                             */
 190   /*                                                                       */
 191   /* <Note>                                                                */
 192   /*    Only horizontal layouts (left-to-right & right-to-left) are        */
 193   /*    supported by this function.  Other layouts, or more sophisticated  */
 194   /*    kernings, are out of scope of this method (the basic driver        */
 195   /*    interface is meant to be simple).                                  */
 196   /*                                                                       */
 197   /*    They can be implemented by format-specific interfaces.             */
 198   /*                                                                       */




 199   static FT_Error
 200   tt_get_kerning( FT_Face     ttface,          /* TT_Face */
 201                   FT_UInt     left_glyph,
 202                   FT_UInt     right_glyph,
 203                   FT_Vector*  kerning )
 204   {
 205     TT_Face       face = (TT_Face)ttface;
 206     SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
 207 
 208 
 209     kerning->x = 0;
 210     kerning->y = 0;
 211 
 212     if ( sfnt )
 213       kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
 214 
 215     return 0;
 216   }
 217 
 218 


 367                      ? req->horiResolution
 368                      : req->vertResolution;
 369 
 370 
 371         /* if we don't have a resolution value, assume 72dpi */
 372         if ( req->type == FT_SIZE_REQUEST_TYPE_SCALES ||
 373              !resolution                              )
 374           resolution = 72;
 375 
 376         ttsize->point_size = FT_MulDiv( ttsize->ttmetrics.ppem,
 377                                         64 * 72,
 378                                         resolution );
 379       }
 380 #endif
 381     }
 382 
 383     return error;
 384   }
 385 
 386 
 387   /*************************************************************************/
 388   /*                                                                       */
 389   /* <Function>                                                            */
 390   /*    tt_glyph_load                                                      */
 391   /*                                                                       */
 392   /* <Description>                                                         */
 393   /*    A driver method used to load a glyph within a given glyph slot.    */
 394   /*                                                                       */
 395   /* <Input>                                                               */
 396   /*    slot        :: A handle to the target slot object where the glyph  */
 397   /*                   will be loaded.                                     */
 398   /*                                                                       */
 399   /*    size        :: A handle to the source face size at which the glyph */
 400   /*                   must be scaled, loaded, etc.                        */
 401   /*                                                                       */
 402   /*    glyph_index :: The index of the glyph in the font file.            */
 403   /*                                                                       */
 404   /*    load_flags  :: A flag indicating what to load for this glyph.  The */
 405   /*                   FT_LOAD_XXX constants can be used to control the    */
 406   /*                   glyph loading process (e.g., whether the outline    */
 407   /*                   should be scaled, whether to load bitmaps or not,   */
 408   /*                   whether to hint the outline, etc).                  */
 409   /*                                                                       */
 410   /* <Return>                                                              */
 411   /*    FreeType error code.  0 means success.                             */
 412   /*                                                                       */




 413   static FT_Error
 414   tt_glyph_load( FT_GlyphSlot  ttslot,      /* TT_GlyphSlot */
 415                  FT_Size       ttsize,      /* TT_Size      */
 416                  FT_UInt       glyph_index,
 417                  FT_Int32      load_flags )
 418   {
 419     TT_GlyphSlot  slot = (TT_GlyphSlot)ttslot;
 420     TT_Size       size = (TT_Size)ttsize;
 421     FT_Face       face = ttslot->face;
 422     FT_Error      error;
 423 
 424 
 425     if ( !slot )
 426       return FT_THROW( Invalid_Slot_Handle );
 427 
 428     if ( !size )
 429       return FT_THROW( Invalid_Size_Handle );
 430 
 431     if ( !face )
 432       return FT_THROW( Invalid_Face_Handle );


 447       if ( FT_IS_TRICKY( face ) )
 448         load_flags &= ~FT_LOAD_NO_HINTING;
 449 
 450       if ( load_flags & FT_LOAD_NO_AUTOHINT )
 451         load_flags |= FT_LOAD_NO_HINTING;
 452     }
 453 
 454     if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
 455     {
 456       load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
 457 
 458       if ( !FT_IS_TRICKY( face ) )
 459         load_flags |= FT_LOAD_NO_HINTING;
 460     }
 461 
 462     /* use hinted metrics only if we load a glyph with hinting */
 463     size->metrics = ( load_flags & FT_LOAD_NO_HINTING )
 464                       ? &ttsize->metrics
 465                       : &size->hinted_metrics;
 466 
 467     /* now load the glyph outline if necessary */
 468     error = TT_Load_Glyph( size, slot, glyph_index, load_flags );
 469 
 470     /* force drop-out mode to 2 - irrelevant now */
 471     /* slot->outline.dropout_mode = 2; */
 472 
 473     return error;
 474   }
 475 
 476 
 477   /*************************************************************************/
 478   /*************************************************************************/
 479   /*************************************************************************/
 480   /****                                                                 ****/
 481   /****                                                                 ****/
 482   /****                D R I V E R  I N T E R F A C E                   ****/
 483   /****                                                                 ****/
 484   /****                                                                 ****/
 485   /*************************************************************************/
 486   /*************************************************************************/
 487   /*************************************************************************/
 488 
 489 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 490 
 491   FT_DEFINE_SERVICE_MULTIMASTERSREC(
 492     tt_service_gx_multi_masters,
 493 
 494     (FT_Get_MM_Func)        NULL,                   /* get_mm         */
 495     (FT_Set_MM_Design_Func) NULL,                   /* set_mm_design  */
 496     (FT_Set_MM_Blend_Func)  TT_Set_MM_Blend,        /* set_mm_blend   */
 497     (FT_Get_MM_Blend_Func)  TT_Get_MM_Blend,        /* get_mm_blend   */
 498     (FT_Get_MM_Var_Func)    TT_Get_MM_Var,          /* get_mm_var     */
 499     (FT_Set_Var_Design_Func)TT_Set_Var_Design,      /* set_var_design */
 500     (FT_Get_Var_Design_Func)TT_Get_Var_Design,      /* get_var_design */
 501     (FT_Set_Instance_Func)  TT_Set_Named_Instance,  /* set_instance   */


 502 
 503     (FT_Get_Var_Blend_Func) tt_get_var_blend,       /* get_var_blend  */
 504     (FT_Done_Blend_Func)    tt_done_blend           /* done_blend     */
 505   )
 506 
 507   FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
 508     tt_service_metrics_variations,
 509 
 510     (FT_HAdvance_Adjust_Func)tt_hadvance_adjust,     /* hadvance_adjust */
 511     (FT_LSB_Adjust_Func)     NULL,                   /* lsb_adjust      */
 512     (FT_RSB_Adjust_Func)     NULL,                   /* rsb_adjust      */
 513 
 514     (FT_VAdvance_Adjust_Func)tt_vadvance_adjust,     /* vadvance_adjust */
 515     (FT_TSB_Adjust_Func)     NULL,                   /* tsb_adjust      */
 516     (FT_BSB_Adjust_Func)     NULL,                   /* bsb_adjust      */
 517     (FT_VOrg_Adjust_Func)    NULL,                   /* vorg_adjust     */
 518 
 519     (FT_Metrics_Adjust_Func) tt_apply_mvar           /* metrics_adjust  */
 520   )
 521 


 531 #else /* !TT_USE_BYTECODE_INTERPRETER */
 532 
 533     FT_TRUETYPE_ENGINE_TYPE_NONE
 534 
 535 #endif /* TT_USE_BYTECODE_INTERPRETER */
 536   };
 537 
 538 
 539   FT_DEFINE_SERVICE_TTGLYFREC(
 540     tt_service_truetype_glyf,
 541 
 542     (TT_Glyf_GetLocationFunc)tt_face_get_location      /* get_location */
 543   )
 544 
 545 
 546 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 547   FT_DEFINE_SERVICEDESCREC6(
 548     tt_services,
 549 
 550     FT_SERVICE_ID_FONT_FORMAT,        FT_FONT_FORMAT_TRUETYPE,
 551     FT_SERVICE_ID_MULTI_MASTERS,      &TT_SERVICE_GX_MULTI_MASTERS_GET,
 552     FT_SERVICE_ID_METRICS_VARIATIONS, &TT_SERVICE_METRICS_VARIATIONS_GET,
 553     FT_SERVICE_ID_TRUETYPE_ENGINE,    &tt_service_truetype_engine,
 554     FT_SERVICE_ID_TT_GLYF,            &TT_SERVICE_TRUETYPE_GLYF_GET,
 555     FT_SERVICE_ID_PROPERTIES,         &TT_SERVICE_PROPERTIES_GET )
 556 #else
 557   FT_DEFINE_SERVICEDESCREC4(
 558     tt_services,
 559 
 560     FT_SERVICE_ID_FONT_FORMAT,     FT_FONT_FORMAT_TRUETYPE,
 561     FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
 562     FT_SERVICE_ID_TT_GLYF,         &TT_SERVICE_TRUETYPE_GLYF_GET,
 563     FT_SERVICE_ID_PROPERTIES,      &TT_SERVICE_PROPERTIES_GET )
 564 #endif
 565 
 566 
 567   FT_CALLBACK_DEF( FT_Module_Interface )
 568   tt_get_interface( FT_Module    driver,    /* TT_Driver */
 569                     const char*  tt_interface )
 570   {
 571     FT_Library           library;
 572     FT_Module_Interface  result;
 573     FT_Module            sfntd;
 574     SFNT_Service         sfnt;
 575 
 576 
 577     /* TT_SERVICES_GET dereferences `library' in PIC mode */
 578 #ifdef FT_CONFIG_OPTION_PIC
 579     if ( !driver )
 580       return NULL;
 581     library = driver->library;
 582     if ( !library )
 583       return NULL;
 584 #endif
 585 
 586     result = ft_service_list_lookup( TT_SERVICES_GET, tt_interface );
 587     if ( result )
 588       return result;
 589 
 590 #ifndef FT_CONFIG_OPTION_PIC
 591     if ( !driver )
 592       return NULL;
 593     library = driver->library;
 594     if ( !library )
 595       return NULL;
 596 #endif
 597 
 598     /* only return the default interface from the SFNT module */
 599     sfntd = FT_Get_Module( library, "sfnt" );
 600     if ( sfntd )
 601     {
 602       sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
 603       if ( sfnt )
 604         return sfnt->get_interface( driver, tt_interface );
 605     }
 606 
 607     return 0;
 608   }
 609 
 610 
 611   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 612 
 613 #ifdef TT_USE_BYTECODE_INTERPRETER
 614 #define TT_HINTER_FLAG  FT_MODULE_DRIVER_HAS_HINTER
 615 #else
 616 #define TT_HINTER_FLAG  0


   1 /****************************************************************************
   2  *
   3  * ttdriver.c
   4  *
   5  *   TrueType font driver implementation (body).
   6  *
   7  * Copyright (C) 1996-2019 by
   8  * David Turner, Robert Wilhelm, and Werner Lemberg.
   9  *
  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
  12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
  13  * this file you indicate that you have read the license and
  14  * understand and accept it fully.
  15  *
  16  */
  17 
  18 
  19 #include <ft2build.h>
  20 #include FT_INTERNAL_DEBUG_H
  21 #include FT_INTERNAL_STREAM_H
  22 #include FT_INTERNAL_SFNT_H
  23 #include FT_SERVICE_FONT_FORMAT_H
  24 
  25 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  26 #include FT_MULTIPLE_MASTERS_H
  27 #include FT_SERVICE_MULTIPLE_MASTERS_H
  28 #include FT_SERVICE_METRICS_VARIATIONS_H
  29 #endif
  30 
  31 #include FT_SERVICE_TRUETYPE_ENGINE_H
  32 #include FT_SERVICE_TRUETYPE_GLYF_H
  33 #include FT_SERVICE_PROPERTIES_H
  34 #include FT_DRIVER_H
  35 
  36 #include "ttdriver.h"
  37 #include "ttgload.h"
  38 #include "ttpload.h"
  39 
  40 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  41 #include "ttgxvar.h"
  42 #endif
  43 
  44 #include "tterrors.h"
  45 

  46 
  47   /**************************************************************************
  48    *
  49    * The macro FT_COMPONENT is used in trace mode.  It is an implicit
  50    * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
  51    * messages during execution.
  52    */
  53 #undef  FT_COMPONENT
  54 #define FT_COMPONENT  ttdriver
  55 
  56 
  57   /*
  58    * PROPERTY SERVICE
  59    *
  60    */
  61   static FT_Error
  62   tt_property_set( FT_Module    module,         /* TT_Driver */
  63                    const char*  property_name,
  64                    const void*  value,
  65                    FT_Bool      value_is_string )
  66   {
  67     FT_Error   error  = FT_Err_Ok;
  68     TT_Driver  driver = (TT_Driver)module;
  69 
  70 #ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
  71     FT_UNUSED( value_is_string );
  72 #endif
  73 
  74 


 146     tt_service_properties,
 147 
 148     (FT_Properties_SetFunc)tt_property_set,     /* set_property */
 149     (FT_Properties_GetFunc)tt_property_get      /* get_property */
 150   )
 151 
 152 
 153   /*************************************************************************/
 154   /*************************************************************************/
 155   /*************************************************************************/
 156   /****                                                                 ****/
 157   /****                                                                 ****/
 158   /****                          F A C E S                              ****/
 159   /****                                                                 ****/
 160   /****                                                                 ****/
 161   /*************************************************************************/
 162   /*************************************************************************/
 163   /*************************************************************************/
 164 
 165 
 166   /**************************************************************************
 167    *
 168    * @Function:
 169    *   tt_get_kerning
 170    *
 171    * @Description:
 172    *   A driver method used to return the kerning vector between two
 173    *   glyphs of the same face.
 174    *
 175    * @Input:
 176    *   face ::
 177    *     A handle to the source face object.
 178    *
 179    *   left_glyph ::
 180    *     The index of the left glyph in the kern pair.
 181    *
 182    *   right_glyph ::
 183    *     The index of the right glyph in the kern pair.
 184    *
 185    * @Output:
 186    *   kerning ::
 187    *     The kerning vector.  This is in font units for
 188    *     scalable formats, and in pixels for fixed-sizes
 189    *     formats.
 190    *
 191    * @Return:
 192    *   FreeType error code.  0 means success.
 193    *
 194    * @Note:
 195    *   Only horizontal layouts (left-to-right & right-to-left) are
 196    *   supported by this function.  Other layouts, or more sophisticated
 197    *   kernings, are out of scope of this method (the basic driver
 198    *   interface is meant to be simple).
 199    *
 200    *   They can be implemented by format-specific interfaces.
 201    */
 202   static FT_Error
 203   tt_get_kerning( FT_Face     ttface,          /* TT_Face */
 204                   FT_UInt     left_glyph,
 205                   FT_UInt     right_glyph,
 206                   FT_Vector*  kerning )
 207   {
 208     TT_Face       face = (TT_Face)ttface;
 209     SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
 210 
 211 
 212     kerning->x = 0;
 213     kerning->y = 0;
 214 
 215     if ( sfnt )
 216       kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
 217 
 218     return 0;
 219   }
 220 
 221 


 370                      ? req->horiResolution
 371                      : req->vertResolution;
 372 
 373 
 374         /* if we don't have a resolution value, assume 72dpi */
 375         if ( req->type == FT_SIZE_REQUEST_TYPE_SCALES ||
 376              !resolution                              )
 377           resolution = 72;
 378 
 379         ttsize->point_size = FT_MulDiv( ttsize->ttmetrics.ppem,
 380                                         64 * 72,
 381                                         resolution );
 382       }
 383 #endif
 384     }
 385 
 386     return error;
 387   }
 388 
 389 
 390   /**************************************************************************
 391    *
 392    * @Function:
 393    *   tt_glyph_load
 394    *
 395    * @Description:
 396    *   A driver method used to load a glyph within a given glyph slot.
 397    *
 398    * @Input:
 399    *   slot ::
 400    *     A handle to the target slot object where the glyph
 401    *     will be loaded.
 402    *
 403    *   size ::
 404    *     A handle to the source face size at which the glyph
 405    *     must be scaled, loaded, etc.
 406    *
 407    *   glyph_index ::
 408    *     The index of the glyph in the font file.
 409    *
 410    *   load_flags ::
 411    *     A flag indicating what to load for this glyph.  The
 412    *     FT_LOAD_XXX constants can be used to control the
 413    *     glyph loading process (e.g., whether the outline
 414    *     should be scaled, whether to load bitmaps or not,
 415    *     whether to hint the outline, etc).
 416    *
 417    * @Return:
 418    *   FreeType error code.  0 means success.
 419    */
 420   static FT_Error
 421   tt_glyph_load( FT_GlyphSlot  ttslot,      /* TT_GlyphSlot */
 422                  FT_Size       ttsize,      /* TT_Size      */
 423                  FT_UInt       glyph_index,
 424                  FT_Int32      load_flags )
 425   {
 426     TT_GlyphSlot  slot = (TT_GlyphSlot)ttslot;
 427     TT_Size       size = (TT_Size)ttsize;
 428     FT_Face       face = ttslot->face;
 429     FT_Error      error;
 430 
 431 
 432     if ( !slot )
 433       return FT_THROW( Invalid_Slot_Handle );
 434 
 435     if ( !size )
 436       return FT_THROW( Invalid_Size_Handle );
 437 
 438     if ( !face )
 439       return FT_THROW( Invalid_Face_Handle );


 454       if ( FT_IS_TRICKY( face ) )
 455         load_flags &= ~FT_LOAD_NO_HINTING;
 456 
 457       if ( load_flags & FT_LOAD_NO_AUTOHINT )
 458         load_flags |= FT_LOAD_NO_HINTING;
 459     }
 460 
 461     if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
 462     {
 463       load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
 464 
 465       if ( !FT_IS_TRICKY( face ) )
 466         load_flags |= FT_LOAD_NO_HINTING;
 467     }
 468 
 469     /* use hinted metrics only if we load a glyph with hinting */
 470     size->metrics = ( load_flags & FT_LOAD_NO_HINTING )
 471                       ? &ttsize->metrics
 472                       : &size->hinted_metrics;
 473 
 474     /* now fill in the glyph slot with outline/bitmap/layered */
 475     error = TT_Load_Glyph( size, slot, glyph_index, load_flags );
 476 
 477     /* force drop-out mode to 2 - irrelevant now */
 478     /* slot->outline.dropout_mode = 2; */
 479 
 480     return error;
 481   }
 482 
 483 
 484   /*************************************************************************/
 485   /*************************************************************************/
 486   /*************************************************************************/
 487   /****                                                                 ****/
 488   /****                                                                 ****/
 489   /****                D R I V E R  I N T E R F A C E                   ****/
 490   /****                                                                 ****/
 491   /****                                                                 ****/
 492   /*************************************************************************/
 493   /*************************************************************************/
 494   /*************************************************************************/
 495 
 496 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 497 
 498   FT_DEFINE_SERVICE_MULTIMASTERSREC(
 499     tt_service_gx_multi_masters,
 500 
 501     (FT_Get_MM_Func)             NULL,                  /* get_mm              */
 502     (FT_Set_MM_Design_Func)      NULL,                  /* set_mm_design       */
 503     (FT_Set_MM_Blend_Func)       TT_Set_MM_Blend,       /* set_mm_blend        */
 504     (FT_Get_MM_Blend_Func)       TT_Get_MM_Blend,       /* get_mm_blend        */
 505     (FT_Get_MM_Var_Func)         TT_Get_MM_Var,         /* get_mm_var          */
 506     (FT_Set_Var_Design_Func)     TT_Set_Var_Design,     /* set_var_design      */
 507     (FT_Get_Var_Design_Func)     TT_Get_Var_Design,     /* get_var_design      */
 508     (FT_Set_Instance_Func)       TT_Set_Named_Instance, /* set_instance        */
 509     (FT_Set_MM_WeightVector_Func)NULL,                  /* set_mm_weightvector */
 510     (FT_Get_MM_WeightVector_Func)NULL,                  /* get_mm_weightvector */
 511 
 512     (FT_Get_Var_Blend_Func)      tt_get_var_blend,      /* get_var_blend       */
 513     (FT_Done_Blend_Func)         tt_done_blend          /* done_blend          */
 514   )
 515 
 516   FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
 517     tt_service_metrics_variations,
 518 
 519     (FT_HAdvance_Adjust_Func)tt_hadvance_adjust,     /* hadvance_adjust */
 520     (FT_LSB_Adjust_Func)     NULL,                   /* lsb_adjust      */
 521     (FT_RSB_Adjust_Func)     NULL,                   /* rsb_adjust      */
 522 
 523     (FT_VAdvance_Adjust_Func)tt_vadvance_adjust,     /* vadvance_adjust */
 524     (FT_TSB_Adjust_Func)     NULL,                   /* tsb_adjust      */
 525     (FT_BSB_Adjust_Func)     NULL,                   /* bsb_adjust      */
 526     (FT_VOrg_Adjust_Func)    NULL,                   /* vorg_adjust     */
 527 
 528     (FT_Metrics_Adjust_Func) tt_apply_mvar           /* metrics_adjust  */
 529   )
 530 


 540 #else /* !TT_USE_BYTECODE_INTERPRETER */
 541 
 542     FT_TRUETYPE_ENGINE_TYPE_NONE
 543 
 544 #endif /* TT_USE_BYTECODE_INTERPRETER */
 545   };
 546 
 547 
 548   FT_DEFINE_SERVICE_TTGLYFREC(
 549     tt_service_truetype_glyf,
 550 
 551     (TT_Glyf_GetLocationFunc)tt_face_get_location      /* get_location */
 552   )
 553 
 554 
 555 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 556   FT_DEFINE_SERVICEDESCREC6(
 557     tt_services,
 558 
 559     FT_SERVICE_ID_FONT_FORMAT,        FT_FONT_FORMAT_TRUETYPE,
 560     FT_SERVICE_ID_MULTI_MASTERS,      &tt_service_gx_multi_masters,
 561     FT_SERVICE_ID_METRICS_VARIATIONS, &tt_service_metrics_variations,
 562     FT_SERVICE_ID_TRUETYPE_ENGINE,    &tt_service_truetype_engine,
 563     FT_SERVICE_ID_TT_GLYF,            &tt_service_truetype_glyf,
 564     FT_SERVICE_ID_PROPERTIES,         &tt_service_properties )
 565 #else
 566   FT_DEFINE_SERVICEDESCREC4(
 567     tt_services,
 568 
 569     FT_SERVICE_ID_FONT_FORMAT,     FT_FONT_FORMAT_TRUETYPE,
 570     FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
 571     FT_SERVICE_ID_TT_GLYF,         &tt_service_truetype_glyf,
 572     FT_SERVICE_ID_PROPERTIES,      &tt_service_properties )
 573 #endif
 574 
 575 
 576   FT_CALLBACK_DEF( FT_Module_Interface )
 577   tt_get_interface( FT_Module    driver,    /* TT_Driver */
 578                     const char*  tt_interface )
 579   {
 580     FT_Library           library;
 581     FT_Module_Interface  result;
 582     FT_Module            sfntd;
 583     SFNT_Service         sfnt;
 584 
 585 
 586     result = ft_service_list_lookup( tt_services, tt_interface );









 587     if ( result )
 588       return result;
 589 

 590     if ( !driver )
 591       return NULL;
 592     library = driver->library;
 593     if ( !library )
 594       return NULL;

 595 
 596     /* only return the default interface from the SFNT module */
 597     sfntd = FT_Get_Module( library, "sfnt" );
 598     if ( sfntd )
 599     {
 600       sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
 601       if ( sfnt )
 602         return sfnt->get_interface( driver, tt_interface );
 603     }
 604 
 605     return 0;
 606   }
 607 
 608 
 609   /* The FT_DriverInterface structure is defined in ftdriver.h. */
 610 
 611 #ifdef TT_USE_BYTECODE_INTERPRETER
 612 #define TT_HINTER_FLAG  FT_MODULE_DRIVER_HAS_HINTER
 613 #else
 614 #define TT_HINTER_FLAG  0


< prev index next >