ftmm.c

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftmm.c                                                                 */
00004 /*                                                                         */
00005 /*    Multiple Master font support (body).                                 */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2003, 2004, 2009 by                               */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #include <ft2build.h>
00020 #include FT_MULTIPLE_MASTERS_H
00021 #include FT_INTERNAL_OBJECTS_H
00022 #include FT_SERVICE_MULTIPLE_MASTERS_H
00023 
00024 
00025   /*************************************************************************/
00026   /*                                                                       */
00027   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
00028   /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
00029   /* messages during execution.                                            */
00030   /*                                                                       */
00031 #undef  FT_COMPONENT
00032 #define FT_COMPONENT  trace_mm
00033 
00034 
00035   static FT_Error
00036   ft_face_get_mm_service( FT_Face                   face,
00037                           FT_Service_MultiMasters  *aservice )
00038   {
00039     FT_Error  error;
00040 
00041 
00042     *aservice = NULL;
00043 
00044     if ( !face )
00045       return FT_Err_Invalid_Face_Handle;
00046 
00047     error = FT_Err_Invalid_Argument;
00048 
00049     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
00050     {
00051       FT_FACE_LOOKUP_SERVICE( face,
00052                               *aservice,
00053                               MULTI_MASTERS );
00054 
00055       if ( *aservice )
00056         error = FT_Err_Ok;
00057     }
00058 
00059     return error;
00060   }
00061 
00062 
00063   /* documentation is in ftmm.h */
00064 
00065   FT_EXPORT_DEF( FT_Error )
00066   FT_Get_Multi_Master( FT_Face           face,
00067                        FT_Multi_Master  *amaster )
00068   {
00069     FT_Error                 error;
00070     FT_Service_MultiMasters  service;
00071 
00072 
00073     error = ft_face_get_mm_service( face, &service );
00074     if ( !error )
00075     {
00076       error = FT_Err_Invalid_Argument;
00077       if ( service->get_mm )
00078         error = service->get_mm( face, amaster );
00079     }
00080 
00081     return error;
00082   }
00083 
00084 
00085   /* documentation is in ftmm.h */
00086 
00087   FT_EXPORT_DEF( FT_Error )
00088   FT_Get_MM_Var( FT_Face      face,
00089                  FT_MM_Var*  *amaster )
00090   {
00091     FT_Error                 error;
00092     FT_Service_MultiMasters  service;
00093 
00094 
00095     error = ft_face_get_mm_service( face, &service );
00096     if ( !error )
00097     {
00098       error = FT_Err_Invalid_Argument;
00099       if ( service->get_mm_var )
00100         error = service->get_mm_var( face, amaster );
00101     }
00102 
00103     return error;
00104   }
00105 
00106 
00107   /* documentation is in ftmm.h */
00108 
00109   FT_EXPORT_DEF( FT_Error )
00110   FT_Set_MM_Design_Coordinates( FT_Face   face,
00111                                 FT_UInt   num_coords,
00112                                 FT_Long*  coords )
00113   {
00114     FT_Error                 error;
00115     FT_Service_MultiMasters  service;
00116 
00117 
00118     error = ft_face_get_mm_service( face, &service );
00119     if ( !error )
00120     {
00121       error = FT_Err_Invalid_Argument;
00122       if ( service->set_mm_design )
00123         error = service->set_mm_design( face, num_coords, coords );
00124     }
00125 
00126     return error;
00127   }
00128 
00129 
00130   /* documentation is in ftmm.h */
00131 
00132   FT_EXPORT_DEF( FT_Error )
00133   FT_Set_Var_Design_Coordinates( FT_Face    face,
00134                                  FT_UInt    num_coords,
00135                                  FT_Fixed*  coords )
00136   {
00137     FT_Error                 error;
00138     FT_Service_MultiMasters  service;
00139 
00140 
00141     error = ft_face_get_mm_service( face, &service );
00142     if ( !error )
00143     {
00144       error = FT_Err_Invalid_Argument;
00145       if ( service->set_var_design )
00146         error = service->set_var_design( face, num_coords, coords );
00147     }
00148 
00149     return error;
00150   }
00151 
00152 
00153   /* documentation is in ftmm.h */
00154 
00155   FT_EXPORT_DEF( FT_Error )
00156   FT_Set_MM_Blend_Coordinates( FT_Face    face,
00157                                FT_UInt    num_coords,
00158                                FT_Fixed*  coords )
00159   {
00160     FT_Error                 error;
00161     FT_Service_MultiMasters  service;
00162 
00163 
00164     error = ft_face_get_mm_service( face, &service );
00165     if ( !error )
00166     {
00167       error = FT_Err_Invalid_Argument;
00168       if ( service->set_mm_blend )
00169          error = service->set_mm_blend( face, num_coords, coords );
00170     }
00171 
00172     return error;
00173   }
00174 
00175 
00176   /* documentation is in ftmm.h */
00177 
00178   /* This is exactly the same as the previous function.  It exists for */
00179   /* orthogonality.                                                    */
00180 
00181   FT_EXPORT_DEF( FT_Error )
00182   FT_Set_Var_Blend_Coordinates( FT_Face    face,
00183                                 FT_UInt    num_coords,
00184                                 FT_Fixed*  coords )
00185   {
00186     FT_Error                 error;
00187     FT_Service_MultiMasters  service;
00188 
00189 
00190     error = ft_face_get_mm_service( face, &service );
00191     if ( !error )
00192     {
00193       error = FT_Err_Invalid_Argument;
00194       if ( service->set_mm_blend )
00195          error = service->set_mm_blend( face, num_coords, coords );
00196     }
00197 
00198     return error;
00199   }
00200 
00201 
00202 /* END */

Generated on Tue Jul 5 14:13:42 2011 for ROOT_528-00b_version by  doxygen 1.5.1