| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ftmm.c */ | 3 /* ftmm.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* Multiple Master font support (body). */ | 5 /* Multiple Master font support (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2001, 2003, 2004, 2009 by */ | 7 /* Copyright 1996-2001, 2003, 2004, 2009, 2013 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_INTERNAL_DEBUG_H |
| 21 |
| 20 #include FT_MULTIPLE_MASTERS_H | 22 #include FT_MULTIPLE_MASTERS_H |
| 21 #include FT_INTERNAL_OBJECTS_H | 23 #include FT_INTERNAL_OBJECTS_H |
| 22 #include FT_SERVICE_MULTIPLE_MASTERS_H | 24 #include FT_SERVICE_MULTIPLE_MASTERS_H |
| 23 | 25 |
| 24 | 26 |
| 25 /*************************************************************************/ | 27 /*************************************************************************/ |
| 26 /* */ | 28 /* */ |
| 27 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ | 29 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
| 28 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ | 30 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
| 29 /* messages during execution. */ | 31 /* messages during execution. */ |
| 30 /* */ | 32 /* */ |
| 31 #undef FT_COMPONENT | 33 #undef FT_COMPONENT |
| 32 #define FT_COMPONENT trace_mm | 34 #define FT_COMPONENT trace_mm |
| 33 | 35 |
| 34 | 36 |
| 35 static FT_Error | 37 static FT_Error |
| 36 ft_face_get_mm_service( FT_Face face, | 38 ft_face_get_mm_service( FT_Face face, |
| 37 FT_Service_MultiMasters *aservice ) | 39 FT_Service_MultiMasters *aservice ) |
| 38 { | 40 { |
| 39 FT_Error error; | 41 FT_Error error; |
| 40 | 42 |
| 41 | 43 |
| 42 *aservice = NULL; | 44 *aservice = NULL; |
| 43 | 45 |
| 44 if ( !face ) | 46 if ( !face ) |
| 45 return FT_Err_Invalid_Face_Handle; | 47 return FT_THROW( Invalid_Face_Handle ); |
| 46 | 48 |
| 47 error = FT_Err_Invalid_Argument; | 49 error = FT_ERR( Invalid_Argument ); |
| 48 | 50 |
| 49 if ( FT_HAS_MULTIPLE_MASTERS( face ) ) | 51 if ( FT_HAS_MULTIPLE_MASTERS( face ) ) |
| 50 { | 52 { |
| 51 FT_FACE_LOOKUP_SERVICE( face, | 53 FT_FACE_LOOKUP_SERVICE( face, |
| 52 *aservice, | 54 *aservice, |
| 53 MULTI_MASTERS ); | 55 MULTI_MASTERS ); |
| 54 | 56 |
| 55 if ( *aservice ) | 57 if ( *aservice ) |
| 56 error = FT_Err_Ok; | 58 error = FT_Err_Ok; |
| 57 } | 59 } |
| 58 | 60 |
| 59 return error; | 61 return error; |
| 60 } | 62 } |
| 61 | 63 |
| 62 | 64 |
| 63 /* documentation is in ftmm.h */ | 65 /* documentation is in ftmm.h */ |
| 64 | 66 |
| 65 FT_EXPORT_DEF( FT_Error ) | 67 FT_EXPORT_DEF( FT_Error ) |
| 66 FT_Get_Multi_Master( FT_Face face, | 68 FT_Get_Multi_Master( FT_Face face, |
| 67 FT_Multi_Master *amaster ) | 69 FT_Multi_Master *amaster ) |
| 68 { | 70 { |
| 69 FT_Error error; | 71 FT_Error error; |
| 70 FT_Service_MultiMasters service; | 72 FT_Service_MultiMasters service; |
| 71 | 73 |
| 72 | 74 |
| 73 error = ft_face_get_mm_service( face, &service ); | 75 error = ft_face_get_mm_service( face, &service ); |
| 74 if ( !error ) | 76 if ( !error ) |
| 75 { | 77 { |
| 76 error = FT_Err_Invalid_Argument; | 78 error = FT_ERR( Invalid_Argument ); |
| 77 if ( service->get_mm ) | 79 if ( service->get_mm ) |
| 78 error = service->get_mm( face, amaster ); | 80 error = service->get_mm( face, amaster ); |
| 79 } | 81 } |
| 80 | 82 |
| 81 return error; | 83 return error; |
| 82 } | 84 } |
| 83 | 85 |
| 84 | 86 |
| 85 /* documentation is in ftmm.h */ | 87 /* documentation is in ftmm.h */ |
| 86 | 88 |
| 87 FT_EXPORT_DEF( FT_Error ) | 89 FT_EXPORT_DEF( FT_Error ) |
| 88 FT_Get_MM_Var( FT_Face face, | 90 FT_Get_MM_Var( FT_Face face, |
| 89 FT_MM_Var* *amaster ) | 91 FT_MM_Var* *amaster ) |
| 90 { | 92 { |
| 91 FT_Error error; | 93 FT_Error error; |
| 92 FT_Service_MultiMasters service; | 94 FT_Service_MultiMasters service; |
| 93 | 95 |
| 94 | 96 |
| 95 error = ft_face_get_mm_service( face, &service ); | 97 error = ft_face_get_mm_service( face, &service ); |
| 96 if ( !error ) | 98 if ( !error ) |
| 97 { | 99 { |
| 98 error = FT_Err_Invalid_Argument; | 100 error = FT_ERR( Invalid_Argument ); |
| 99 if ( service->get_mm_var ) | 101 if ( service->get_mm_var ) |
| 100 error = service->get_mm_var( face, amaster ); | 102 error = service->get_mm_var( face, amaster ); |
| 101 } | 103 } |
| 102 | 104 |
| 103 return error; | 105 return error; |
| 104 } | 106 } |
| 105 | 107 |
| 106 | 108 |
| 107 /* documentation is in ftmm.h */ | 109 /* documentation is in ftmm.h */ |
| 108 | 110 |
| 109 FT_EXPORT_DEF( FT_Error ) | 111 FT_EXPORT_DEF( FT_Error ) |
| 110 FT_Set_MM_Design_Coordinates( FT_Face face, | 112 FT_Set_MM_Design_Coordinates( FT_Face face, |
| 111 FT_UInt num_coords, | 113 FT_UInt num_coords, |
| 112 FT_Long* coords ) | 114 FT_Long* coords ) |
| 113 { | 115 { |
| 114 FT_Error error; | 116 FT_Error error; |
| 115 FT_Service_MultiMasters service; | 117 FT_Service_MultiMasters service; |
| 116 | 118 |
| 117 | 119 |
| 118 error = ft_face_get_mm_service( face, &service ); | 120 error = ft_face_get_mm_service( face, &service ); |
| 119 if ( !error ) | 121 if ( !error ) |
| 120 { | 122 { |
| 121 error = FT_Err_Invalid_Argument; | 123 error = FT_ERR( Invalid_Argument ); |
| 122 if ( service->set_mm_design ) | 124 if ( service->set_mm_design ) |
| 123 error = service->set_mm_design( face, num_coords, coords ); | 125 error = service->set_mm_design( face, num_coords, coords ); |
| 124 } | 126 } |
| 125 | 127 |
| 126 return error; | 128 return error; |
| 127 } | 129 } |
| 128 | 130 |
| 129 | 131 |
| 130 /* documentation is in ftmm.h */ | 132 /* documentation is in ftmm.h */ |
| 131 | 133 |
| 132 FT_EXPORT_DEF( FT_Error ) | 134 FT_EXPORT_DEF( FT_Error ) |
| 133 FT_Set_Var_Design_Coordinates( FT_Face face, | 135 FT_Set_Var_Design_Coordinates( FT_Face face, |
| 134 FT_UInt num_coords, | 136 FT_UInt num_coords, |
| 135 FT_Fixed* coords ) | 137 FT_Fixed* coords ) |
| 136 { | 138 { |
| 137 FT_Error error; | 139 FT_Error error; |
| 138 FT_Service_MultiMasters service; | 140 FT_Service_MultiMasters service; |
| 139 | 141 |
| 140 | 142 |
| 141 error = ft_face_get_mm_service( face, &service ); | 143 error = ft_face_get_mm_service( face, &service ); |
| 142 if ( !error ) | 144 if ( !error ) |
| 143 { | 145 { |
| 144 error = FT_Err_Invalid_Argument; | 146 error = FT_ERR( Invalid_Argument ); |
| 145 if ( service->set_var_design ) | 147 if ( service->set_var_design ) |
| 146 error = service->set_var_design( face, num_coords, coords ); | 148 error = service->set_var_design( face, num_coords, coords ); |
| 147 } | 149 } |
| 148 | 150 |
| 149 return error; | 151 return error; |
| 150 } | 152 } |
| 151 | 153 |
| 152 | 154 |
| 153 /* documentation is in ftmm.h */ | 155 /* documentation is in ftmm.h */ |
| 154 | 156 |
| 155 FT_EXPORT_DEF( FT_Error ) | 157 FT_EXPORT_DEF( FT_Error ) |
| 156 FT_Set_MM_Blend_Coordinates( FT_Face face, | 158 FT_Set_MM_Blend_Coordinates( FT_Face face, |
| 157 FT_UInt num_coords, | 159 FT_UInt num_coords, |
| 158 FT_Fixed* coords ) | 160 FT_Fixed* coords ) |
| 159 { | 161 { |
| 160 FT_Error error; | 162 FT_Error error; |
| 161 FT_Service_MultiMasters service; | 163 FT_Service_MultiMasters service; |
| 162 | 164 |
| 163 | 165 |
| 164 error = ft_face_get_mm_service( face, &service ); | 166 error = ft_face_get_mm_service( face, &service ); |
| 165 if ( !error ) | 167 if ( !error ) |
| 166 { | 168 { |
| 167 error = FT_Err_Invalid_Argument; | 169 error = FT_ERR( Invalid_Argument ); |
| 168 if ( service->set_mm_blend ) | 170 if ( service->set_mm_blend ) |
| 169 error = service->set_mm_blend( face, num_coords, coords ); | 171 error = service->set_mm_blend( face, num_coords, coords ); |
| 170 } | 172 } |
| 171 | 173 |
| 172 return error; | 174 return error; |
| 173 } | 175 } |
| 174 | 176 |
| 175 | 177 |
| 176 /* documentation is in ftmm.h */ | 178 /* documentation is in ftmm.h */ |
| 177 | 179 |
| 178 /* This is exactly the same as the previous function. It exists for */ | 180 /* This is exactly the same as the previous function. It exists for */ |
| 179 /* orthogonality. */ | 181 /* orthogonality. */ |
| 180 | 182 |
| 181 FT_EXPORT_DEF( FT_Error ) | 183 FT_EXPORT_DEF( FT_Error ) |
| 182 FT_Set_Var_Blend_Coordinates( FT_Face face, | 184 FT_Set_Var_Blend_Coordinates( FT_Face face, |
| 183 FT_UInt num_coords, | 185 FT_UInt num_coords, |
| 184 FT_Fixed* coords ) | 186 FT_Fixed* coords ) |
| 185 { | 187 { |
| 186 FT_Error error; | 188 FT_Error error; |
| 187 FT_Service_MultiMasters service; | 189 FT_Service_MultiMasters service; |
| 188 | 190 |
| 189 | 191 |
| 190 error = ft_face_get_mm_service( face, &service ); | 192 error = ft_face_get_mm_service( face, &service ); |
| 191 if ( !error ) | 193 if ( !error ) |
| 192 { | 194 { |
| 193 error = FT_Err_Invalid_Argument; | 195 error = FT_ERR( Invalid_Argument ); |
| 194 if ( service->set_mm_blend ) | 196 if ( service->set_mm_blend ) |
| 195 error = service->set_mm_blend( face, num_coords, coords ); | 197 error = service->set_mm_blend( face, num_coords, coords ); |
| 196 } | 198 } |
| 197 | 199 |
| 198 return error; | 200 return error; |
| 199 } | 201 } |
| 200 | 202 |
| 201 | 203 |
| 202 /* END */ | 204 /* END */ |
| OLD | NEW |