Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | /* */ |
| 3 | /* ftmm.c */ |
| 4 | /* */ |
| 5 | /* Multiple Master font support (body). */ |
| 6 | /* */ |
Werner Lemberg | 44bb303 | 2004-04-25 20:15:11 +0000 | [diff] [blame] | 7 | /* Copyright 1996-2001, 2003, 2004 by */ |
Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 | /* */ |
Werner Lemberg | 4e6dd85 | 2000-06-05 05:26:15 +0000 | [diff] [blame] | 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 */ |
Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 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 | |
Werner Lemberg | cc069be | 2000-12-08 16:17:16 +0000 | [diff] [blame] | 18 | |
| 19 | #include <ft2build.h> |
| 20 | #include FT_MULTIPLE_MASTERS_H |
| 21 | #include FT_INTERNAL_OBJECTS_H |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 22 | #include FT_SERVICE_MULTIPLE_MASTERS_H |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 23 | |
Werner Lemberg | eb81e37 | 2000-06-03 06:03:11 +0000 | [diff] [blame] | 24 | |
| 25 | /*************************************************************************/ |
| 26 | /* */ |
| 27 | /* 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 */ |
| 29 | /* messages during execution. */ |
| 30 | /* */ |
| 31 | #undef FT_COMPONENT |
| 32 | #define FT_COMPONENT trace_mm |
| 33 | |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 34 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 35 | static FT_Error |
| 36 | ft_face_get_mm_service( FT_Face face, |
| 37 | FT_Service_MultiMasters *aservice ) |
| 38 | { |
| 39 | FT_Error error; |
David Turner | e2d1284 | 2003-09-21 17:15:55 +0000 | [diff] [blame] | 40 | |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 41 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 42 | *aservice = NULL; |
David Turner | e2d1284 | 2003-09-21 17:15:55 +0000 | [diff] [blame] | 43 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 44 | if ( !face ) |
| 45 | return FT_Err_Invalid_Face_Handle; |
David Turner | e2d1284 | 2003-09-21 17:15:55 +0000 | [diff] [blame] | 46 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 47 | error = FT_Err_Invalid_Argument; |
David Turner | e2d1284 | 2003-09-21 17:15:55 +0000 | [diff] [blame] | 48 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 49 | if ( FT_HAS_MULTIPLE_MASTERS( face ) ) |
| 50 | { |
Werner Lemberg | 46333a1 | 2003-09-17 19:20:02 +0000 | [diff] [blame] | 51 | FT_FACE_LOOKUP_SERVICE( face, |
David Turner | e2d1284 | 2003-09-21 17:15:55 +0000 | [diff] [blame] | 52 | *aservice, |
| 53 | MULTI_MASTERS ); |
Werner Lemberg | 52f911a | 2003-10-07 05:49:41 +0000 | [diff] [blame] | 54 | |
| 55 | if ( aservice ) |
| 56 | error = FT_Err_Ok; |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 57 | } |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 58 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 59 | return error; |
| 60 | } |
| 61 | |
Werner Lemberg | eb81e37 | 2000-06-03 06:03:11 +0000 | [diff] [blame] | 62 | |
Werner Lemberg | 90a0330 | 2000-11-07 17:21:11 +0000 | [diff] [blame] | 63 | /* documentation is in ftmm.h */ |
| 64 | |
Werner Lemberg | f814d0f | 2001-06-27 16:18:10 +0000 | [diff] [blame] | 65 | FT_EXPORT_DEF( FT_Error ) |
| 66 | FT_Get_Multi_Master( FT_Face face, |
| 67 | FT_Multi_Master *amaster ) |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 68 | { |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 69 | FT_Error error; |
| 70 | FT_Service_MultiMasters service; |
Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 71 | |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 72 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 73 | error = ft_face_get_mm_service( face, &service ); |
| 74 | if ( !error ) |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 75 | { |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 76 | error = FT_Err_Invalid_Argument; |
| 77 | if ( service->get_mm ) |
| 78 | error = service->get_mm( face, amaster ); |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 79 | } |
David Turner | e2d1284 | 2003-09-21 17:15:55 +0000 | [diff] [blame] | 80 | |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 81 | return error; |
Werner Lemberg | eb81e37 | 2000-06-03 06:03:11 +0000 | [diff] [blame] | 82 | } |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 83 | |
| 84 | |
Werner Lemberg | 90a0330 | 2000-11-07 17:21:11 +0000 | [diff] [blame] | 85 | /* documentation is in ftmm.h */ |
| 86 | |
Werner Lemberg | f814d0f | 2001-06-27 16:18:10 +0000 | [diff] [blame] | 87 | FT_EXPORT_DEF( FT_Error ) |
Werner Lemberg | 44bb303 | 2004-04-25 20:15:11 +0000 | [diff] [blame] | 88 | FT_Get_MM_Var( FT_Face face, |
| 89 | FT_MM_Var* *amaster ) |
| 90 | { |
| 91 | FT_Error error; |
| 92 | FT_Service_MultiMasters service; |
| 93 | |
| 94 | |
| 95 | error = ft_face_get_mm_service( face, &service ); |
| 96 | if ( !error ) |
| 97 | { |
| 98 | error = FT_Err_Invalid_Argument; |
| 99 | if ( service->get_mm_var ) |
| 100 | error = service->get_mm_var( face, amaster ); |
| 101 | } |
| 102 | |
| 103 | return error; |
| 104 | } |
| 105 | |
| 106 | |
| 107 | /* documentation is in ftmm.h */ |
| 108 | |
| 109 | FT_EXPORT_DEF( FT_Error ) |
Werner Lemberg | f814d0f | 2001-06-27 16:18:10 +0000 | [diff] [blame] | 110 | FT_Set_MM_Design_Coordinates( FT_Face face, |
| 111 | FT_UInt num_coords, |
| 112 | FT_Long* coords ) |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 113 | { |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 114 | FT_Error error; |
| 115 | FT_Service_MultiMasters service; |
Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 116 | |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 117 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 118 | error = ft_face_get_mm_service( face, &service ); |
| 119 | if ( !error ) |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 120 | { |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 121 | error = FT_Err_Invalid_Argument; |
| 122 | if ( service->set_mm_design ) |
| 123 | error = service->set_mm_design( face, num_coords, coords ); |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 124 | } |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 125 | |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 126 | return error; |
Werner Lemberg | eb81e37 | 2000-06-03 06:03:11 +0000 | [diff] [blame] | 127 | } |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 128 | |
Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 129 | |
Werner Lemberg | 90a0330 | 2000-11-07 17:21:11 +0000 | [diff] [blame] | 130 | /* documentation is in ftmm.h */ |
| 131 | |
Werner Lemberg | f814d0f | 2001-06-27 16:18:10 +0000 | [diff] [blame] | 132 | FT_EXPORT_DEF( FT_Error ) |
Werner Lemberg | 44bb303 | 2004-04-25 20:15:11 +0000 | [diff] [blame] | 133 | FT_Set_Var_Design_Coordinates( FT_Face face, |
| 134 | FT_UInt num_coords, |
| 135 | FT_Fixed* coords ) |
| 136 | { |
| 137 | FT_Error error; |
| 138 | FT_Service_MultiMasters service; |
| 139 | |
| 140 | |
| 141 | error = ft_face_get_mm_service( face, &service ); |
| 142 | if ( !error ) |
| 143 | { |
| 144 | error = FT_Err_Invalid_Argument; |
| 145 | if ( service->set_var_design ) |
| 146 | error = service->set_var_design( face, num_coords, coords ); |
| 147 | } |
| 148 | |
| 149 | return error; |
| 150 | } |
| 151 | |
| 152 | |
| 153 | /* documentation is in ftmm.h */ |
| 154 | |
| 155 | FT_EXPORT_DEF( FT_Error ) |
Werner Lemberg | f814d0f | 2001-06-27 16:18:10 +0000 | [diff] [blame] | 156 | FT_Set_MM_Blend_Coordinates( FT_Face face, |
Werner Lemberg | dc72aff | 2000-11-04 08:33:38 +0000 | [diff] [blame] | 157 | FT_UInt num_coords, |
| 158 | FT_Fixed* coords ) |
Werner Lemberg | eb81e37 | 2000-06-03 06:03:11 +0000 | [diff] [blame] | 159 | { |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 160 | FT_Error error; |
| 161 | FT_Service_MultiMasters service; |
Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 162 | |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 163 | |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 164 | error = ft_face_get_mm_service( face, &service ); |
| 165 | if ( !error ) |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 166 | { |
David Turner | c313c50 | 2003-09-11 19:51:54 +0000 | [diff] [blame] | 167 | error = FT_Err_Invalid_Argument; |
| 168 | if ( service->set_mm_blend ) |
| 169 | error = service->set_mm_blend( face, num_coords, coords ); |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 170 | } |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 171 | |
David Turner | 1118720 | 2000-05-26 17:13:23 +0000 | [diff] [blame] | 172 | return error; |
| 173 | } |
| 174 | |
Werner Lemberg | 013efd1 | 2003-09-17 05:26:33 +0000 | [diff] [blame] | 175 | |
Werner Lemberg | 44bb303 | 2004-04-25 20:15:11 +0000 | [diff] [blame] | 176 | /* documentation is in ftmm.h */ |
Werner Lemberg | 9b774e2 | 2007-01-16 06:11:27 +0000 | [diff] [blame] | 177 | |
Werner Lemberg | 44bb303 | 2004-04-25 20:15:11 +0000 | [diff] [blame] | 178 | /* This is exactly the same as the previous function. It exists for */ |
| 179 | /* orthogonality. */ |
| 180 | |
| 181 | FT_EXPORT_DEF( FT_Error ) |
| 182 | FT_Set_Var_Blend_Coordinates( FT_Face face, |
| 183 | FT_UInt num_coords, |
| 184 | FT_Fixed* coords ) |
| 185 | { |
| 186 | FT_Error error; |
| 187 | FT_Service_MultiMasters service; |
| 188 | |
| 189 | |
| 190 | error = ft_face_get_mm_service( face, &service ); |
| 191 | if ( !error ) |
| 192 | { |
| 193 | error = FT_Err_Invalid_Argument; |
| 194 | if ( service->set_mm_blend ) |
| 195 | error = service->set_mm_blend( face, num_coords, coords ); |
| 196 | } |
| 197 | |
| 198 | return error; |
| 199 | } |
| 200 | |
| 201 | |
Werner Lemberg | a3b6c6c | 2000-05-31 06:55:12 +0000 | [diff] [blame] | 202 | /* END */ |