xref: /inferno-os/libfreetype/ftmm.c (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftmm.c                                                                 */
4 /*                                                                         */
5 /*    Multiple Master font support (body).                                 */
6 /*                                                                         */
7 /*  Copyright 1996-2001 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_MULTIPLE_MASTERS_H
21 #include FT_INTERNAL_OBJECTS_H
22 
23 
24   /*************************************************************************/
25   /*                                                                       */
26   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
27   /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
28   /* messages during execution.                                            */
29   /*                                                                       */
30 #undef  FT_COMPONENT
31 #define FT_COMPONENT  trace_mm
32 
33 
34   /* documentation is in ftmm.h */
35 
36   FT_EXPORT_DEF( FT_Error )
FT_Get_Multi_Master(FT_Face face,FT_Multi_Master * amaster)37   FT_Get_Multi_Master( FT_Face           face,
38                        FT_Multi_Master  *amaster )
39   {
40     FT_Error  error;
41 
42 
43     if ( !face )
44       return FT_Err_Invalid_Face_Handle;
45 
46     error = FT_Err_Invalid_Argument;
47 
48     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
49     {
50       FT_Driver       driver = face->driver;
51       FT_Get_MM_Func  func;
52 
53 
54       func = (FT_Get_MM_Func)driver->root.clazz->get_interface(
55                                FT_MODULE( driver ), "get_mm" );
56       if ( func )
57         error = func( face, amaster );
58     }
59 
60     return error;
61   }
62 
63 
64   /* documentation is in ftmm.h */
65 
66   FT_EXPORT_DEF( FT_Error )
FT_Set_MM_Design_Coordinates(FT_Face face,FT_UInt num_coords,FT_Long * coords)67   FT_Set_MM_Design_Coordinates( FT_Face   face,
68                                 FT_UInt   num_coords,
69                                 FT_Long*  coords )
70   {
71     FT_Error  error;
72 
73 
74     if ( !face )
75       return FT_Err_Invalid_Face_Handle;
76 
77     error = FT_Err_Invalid_Argument;
78 
79     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
80     {
81       FT_Driver              driver = face->driver;
82       FT_Set_MM_Design_Func  func;
83 
84 
85       func = (FT_Set_MM_Design_Func)driver->root.clazz->get_interface(
86                                       FT_MODULE( driver ), "set_mm_design" );
87       if ( func )
88         error = func( face, num_coords, coords );
89     }
90 
91     return error;
92   }
93 
94 
95   /* documentation is in ftmm.h */
96 
97   FT_EXPORT_DEF( FT_Error )
FT_Set_MM_Blend_Coordinates(FT_Face face,FT_UInt num_coords,FT_Fixed * coords)98   FT_Set_MM_Blend_Coordinates( FT_Face    face,
99                                FT_UInt    num_coords,
100                                FT_Fixed*  coords )
101   {
102     FT_Error  error;
103 
104 
105     if ( !face )
106       return FT_Err_Invalid_Face_Handle;
107 
108     error = FT_Err_Invalid_Argument;
109 
110     if ( FT_HAS_MULTIPLE_MASTERS( face ) )
111     {
112       FT_Driver             driver = face->driver;
113       FT_Set_MM_Blend_Func  func;
114 
115 
116       func = (FT_Set_MM_Blend_Func)driver->root.clazz->get_interface(
117                                      FT_MODULE( driver ), "set_mm_blend" );
118       if ( func )
119         error = func( face, num_coords, coords );
120     }
121 
122     return error;
123   }
124 
125 
126 /* END */
127