< prev index next >

src/java.desktop/share/native/libfreetype/src/base/ftmm.c

Print this page


   1 /***************************************************************************/
   2 /*                                                                         */
   3 /*  ftmm.c                                                                 */
   4 /*                                                                         */
   5 /*    Multiple Master font support (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 
  22 #include FT_MULTIPLE_MASTERS_H
  23 #include FT_INTERNAL_OBJECTS_H
  24 #include FT_SERVICE_MULTIPLE_MASTERS_H
  25 #include FT_SERVICE_METRICS_VARIATIONS_H
  26 
  27 
  28   /*************************************************************************/
  29   /*                                                                       */
  30   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
  31   /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
  32   /* messages during execution.                                            */
  33   /*                                                                       */
  34 #undef  FT_COMPONENT
  35 #define FT_COMPONENT  trace_mm
  36 
  37 
  38   static FT_Error
  39   ft_face_get_mm_service( FT_Face                   face,
  40                           FT_Service_MultiMasters  *aservice )
  41   {
  42     FT_Error  error;
  43 
  44 
  45     *aservice = NULL;
  46 
  47     if ( !face )
  48       return FT_THROW( Invalid_Face_Handle );
  49 
  50     error = FT_ERR( Invalid_Argument );
  51 
  52     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
  53     {
  54       FT_FACE_LOOKUP_SERVICE( face,
  55                               *aservice,


 176 
 177 
 178     /* check of `face' delayed to `ft_face_get_mm_service' */
 179 
 180     if ( num_coords && !coords )
 181       return FT_THROW( Invalid_Argument );
 182 
 183     error = ft_face_get_mm_service( face, &service );
 184     if ( !error )
 185     {
 186       error = FT_ERR( Invalid_Argument );
 187       if ( service->set_mm_design )
 188         error = service->set_mm_design( face, num_coords, coords );
 189     }
 190 
 191     /* enforce recomputation of auto-hinting data */
 192     if ( !error && face->autohint.finalizer )
 193     {
 194       face->autohint.finalizer( face->autohint.data );
 195       face->autohint.data = NULL;





























































 196     }
 197 
 198     return error;
 199   }
 200 
 201 
 202   /* documentation is in ftmm.h */
 203 
 204   FT_EXPORT_DEF( FT_Error )
 205   FT_Set_Var_Design_Coordinates( FT_Face    face,
 206                                  FT_UInt    num_coords,
 207                                  FT_Fixed*  coords )
 208   {
 209     FT_Error                      error;
 210     FT_Service_MultiMasters       service_mm   = NULL;
 211     FT_Service_MetricsVariations  service_mvar = NULL;
 212 
 213 
 214     /* check of `face' delayed to `ft_face_get_mm_service' */
 215 


   1 /****************************************************************************
   2  *
   3  * ftmm.c
   4  *
   5  *   Multiple Master font support (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 
  22 #include FT_MULTIPLE_MASTERS_H
  23 #include FT_INTERNAL_OBJECTS_H
  24 #include FT_SERVICE_MULTIPLE_MASTERS_H
  25 #include FT_SERVICE_METRICS_VARIATIONS_H
  26 
  27 
  28   /**************************************************************************
  29    *
  30    * The macro FT_COMPONENT is used in trace mode.  It is an implicit
  31    * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
  32    * messages during execution.
  33    */
  34 #undef  FT_COMPONENT
  35 #define FT_COMPONENT  mm
  36 
  37 
  38   static FT_Error
  39   ft_face_get_mm_service( FT_Face                   face,
  40                           FT_Service_MultiMasters  *aservice )
  41   {
  42     FT_Error  error;
  43 
  44 
  45     *aservice = NULL;
  46 
  47     if ( !face )
  48       return FT_THROW( Invalid_Face_Handle );
  49 
  50     error = FT_ERR( Invalid_Argument );
  51 
  52     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
  53     {
  54       FT_FACE_LOOKUP_SERVICE( face,
  55                               *aservice,


 176 
 177 
 178     /* check of `face' delayed to `ft_face_get_mm_service' */
 179 
 180     if ( num_coords && !coords )
 181       return FT_THROW( Invalid_Argument );
 182 
 183     error = ft_face_get_mm_service( face, &service );
 184     if ( !error )
 185     {
 186       error = FT_ERR( Invalid_Argument );
 187       if ( service->set_mm_design )
 188         error = service->set_mm_design( face, num_coords, coords );
 189     }
 190 
 191     /* enforce recomputation of auto-hinting data */
 192     if ( !error && face->autohint.finalizer )
 193     {
 194       face->autohint.finalizer( face->autohint.data );
 195       face->autohint.data = NULL;
 196     }
 197 
 198     return error;
 199   }
 200 
 201 
 202   /* documentation is in ftmm.h */
 203 
 204   FT_EXPORT_DEF( FT_Error )
 205   FT_Set_MM_WeightVector( FT_Face    face,
 206                           FT_UInt    len,
 207                           FT_Fixed*  weightvector )
 208   {
 209     FT_Error                 error;
 210     FT_Service_MultiMasters  service;
 211 
 212 
 213     /* check of `face' delayed to `ft_face_get_mm_service' */
 214 
 215     if ( len && !weightvector )
 216       return FT_THROW( Invalid_Argument );
 217 
 218     error = ft_face_get_mm_service( face, &service );
 219     if ( !error )
 220     {
 221       error = FT_ERR( Invalid_Argument );
 222       if ( service->set_mm_weightvector )
 223         error = service->set_mm_weightvector( face, len, weightvector );
 224     }
 225 
 226     /* enforce recomputation of auto-hinting data */
 227     if ( !error && face->autohint.finalizer )
 228     {
 229       face->autohint.finalizer( face->autohint.data );
 230       face->autohint.data = NULL;
 231     }
 232 
 233     return error;
 234   }
 235 
 236 
 237   FT_EXPORT_DEF( FT_Error )
 238   FT_Get_MM_WeightVector( FT_Face    face,
 239                           FT_UInt*   len,
 240                           FT_Fixed*  weightvector )
 241   {
 242     FT_Error                 error;
 243     FT_Service_MultiMasters  service;
 244 
 245 
 246     /* check of `face' delayed to `ft_face_get_mm_service' */
 247 
 248     if ( len && !weightvector )
 249       return FT_THROW( Invalid_Argument );
 250 
 251     error = ft_face_get_mm_service( face, &service );
 252     if ( !error )
 253     {
 254       error = FT_ERR( Invalid_Argument );
 255       if ( service->get_mm_weightvector )
 256         error = service->get_mm_weightvector( face, len, weightvector );
 257     }
 258 
 259     return error;
 260   }
 261 
 262 
 263   /* documentation is in ftmm.h */
 264 
 265   FT_EXPORT_DEF( FT_Error )
 266   FT_Set_Var_Design_Coordinates( FT_Face    face,
 267                                  FT_UInt    num_coords,
 268                                  FT_Fixed*  coords )
 269   {
 270     FT_Error                      error;
 271     FT_Service_MultiMasters       service_mm   = NULL;
 272     FT_Service_MetricsVariations  service_mvar = NULL;
 273 
 274 
 275     /* check of `face' delayed to `ft_face_get_mm_service' */
 276 


< prev index next >