ftmm.h

Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftmm.h                                                                 */
00004 /*                                                                         */
00005 /*    FreeType Multiple Master font interface (specification).             */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2003, 2004, 2006, 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 #ifndef __FTMM_H__
00020 #define __FTMM_H__
00021 
00022 
00023 #include <ft2build.h>
00024 #include FT_TYPE1_TABLES_H
00025 
00026 
00027 FT_BEGIN_HEADER
00028 
00029 
00030   /*************************************************************************/
00031   /*                                                                       */
00032   /* <Section>                                                             */
00033   /*    multiple_masters                                                   */
00034   /*                                                                       */
00035   /* <Title>                                                               */
00036   /*    Multiple Masters                                                   */
00037   /*                                                                       */
00038   /* <Abstract>                                                            */
00039   /*    How to manage Multiple Masters fonts.                              */
00040   /*                                                                       */
00041   /* <Description>                                                         */
00042   /*    The following types and functions are used to manage Multiple      */
00043   /*    Master fonts, i.e., the selection of specific design instances by  */
00044   /*    setting design axis coordinates.                                   */
00045   /*                                                                       */
00046   /*    George Williams has extended this interface to make it work with   */
00047   /*    both Type~1 Multiple Masters fonts and GX distortable (var)        */
00048   /*    fonts.  Some of these routines only work with MM fonts, others     */
00049   /*    will work with both types.  They are similar enough that a         */
00050   /*    consistent interface makes sense.                                  */
00051   /*                                                                       */
00052   /*************************************************************************/
00053 
00054 
00055   /*************************************************************************/
00056   /*                                                                       */
00057   /* <Struct>                                                              */
00058   /*    FT_MM_Axis                                                         */
00059   /*                                                                       */
00060   /* <Description>                                                         */
00061   /*    A simple structure used to model a given axis in design space for  */
00062   /*    Multiple Masters fonts.                                            */
00063   /*                                                                       */
00064   /*    This structure can't be used for GX var fonts.                     */
00065   /*                                                                       */
00066   /* <Fields>                                                              */
00067   /*    name    :: The axis's name.                                        */
00068   /*                                                                       */
00069   /*    minimum :: The axis's minimum design coordinate.                   */
00070   /*                                                                       */
00071   /*    maximum :: The axis's maximum design coordinate.                   */
00072   /*                                                                       */
00073   typedef struct  FT_MM_Axis_
00074   {
00075     FT_String*  name;
00076     FT_Long     minimum;
00077     FT_Long     maximum;
00078 
00079   } FT_MM_Axis;
00080 
00081 
00082   /*************************************************************************/
00083   /*                                                                       */
00084   /* <Struct>                                                              */
00085   /*    FT_Multi_Master                                                    */
00086   /*                                                                       */
00087   /* <Description>                                                         */
00088   /*    A structure used to model the axes and space of a Multiple Masters */
00089   /*    font.                                                              */
00090   /*                                                                       */
00091   /*    This structure can't be used for GX var fonts.                     */
00092   /*                                                                       */
00093   /* <Fields>                                                              */
00094   /*    num_axis    :: Number of axes.  Cannot exceed~4.                   */
00095   /*                                                                       */
00096   /*    num_designs :: Number of designs; should be normally 2^num_axis    */
00097   /*                   even though the Type~1 specification strangely      */
00098   /*                   allows for intermediate designs to be present. This */
00099   /*                   number cannot exceed~16.                            */
00100   /*                                                                       */
00101   /*    axis        :: A table of axis descriptors.                        */
00102   /*                                                                       */
00103   typedef struct  FT_Multi_Master_
00104   {
00105     FT_UInt     num_axis;
00106     FT_UInt     num_designs;
00107     FT_MM_Axis  axis[T1_MAX_MM_AXIS];
00108 
00109   } FT_Multi_Master;
00110 
00111 
00112   /*************************************************************************/
00113   /*                                                                       */
00114   /* <Struct>                                                              */
00115   /*    FT_Var_Axis                                                        */
00116   /*                                                                       */
00117   /* <Description>                                                         */
00118   /*    A simple structure used to model a given axis in design space for  */
00119   /*    Multiple Masters and GX var fonts.                                 */
00120   /*                                                                       */
00121   /* <Fields>                                                              */
00122   /*    name    :: The axis's name.                                        */
00123   /*               Not always meaningful for GX.                           */
00124   /*                                                                       */
00125   /*    minimum :: The axis's minimum design coordinate.                   */
00126   /*                                                                       */
00127   /*    def     :: The axis's default design coordinate.                   */
00128   /*               FreeType computes meaningful default values for MM; it  */
00129   /*               is then an integer value, not in 16.16 format.          */
00130   /*                                                                       */
00131   /*    maximum :: The axis's maximum design coordinate.                   */
00132   /*                                                                       */
00133   /*    tag     :: The axis's tag (the GX equivalent to `name').           */
00134   /*               FreeType provides default values for MM if possible.    */
00135   /*                                                                       */
00136   /*    strid   :: The entry in `name' table (another GX version of        */
00137   /*               `name').                                                */
00138   /*               Not meaningful for MM.                                  */
00139   /*                                                                       */
00140   typedef struct  FT_Var_Axis_
00141   {
00142     FT_String*  name;
00143 
00144     FT_Fixed    minimum;
00145     FT_Fixed    def;
00146     FT_Fixed    maximum;
00147 
00148     FT_ULong    tag;
00149     FT_UInt     strid;
00150 
00151   } FT_Var_Axis;
00152 
00153 
00154   /*************************************************************************/
00155   /*                                                                       */
00156   /* <Struct>                                                              */
00157   /*    FT_Var_Named_Style                                                 */
00158   /*                                                                       */
00159   /* <Description>                                                         */
00160   /*    A simple structure used to model a named style in a GX var font.   */
00161   /*                                                                       */
00162   /*    This structure can't be used for MM fonts.                         */
00163   /*                                                                       */
00164   /* <Fields>                                                              */
00165   /*    coords :: The design coordinates for this style.                   */
00166   /*              This is an array with one entry for each axis.           */
00167   /*                                                                       */
00168   /*    strid  :: The entry in `name' table identifying this style.        */
00169   /*                                                                       */
00170   typedef struct  FT_Var_Named_Style_
00171   {
00172     FT_Fixed*  coords;
00173     FT_UInt    strid;
00174 
00175   } FT_Var_Named_Style;
00176 
00177 
00178   /*************************************************************************/
00179   /*                                                                       */
00180   /* <Struct>                                                              */
00181   /*    FT_MM_Var                                                          */
00182   /*                                                                       */
00183   /* <Description>                                                         */
00184   /*    A structure used to model the axes and space of a Multiple Masters */
00185   /*    or GX var distortable font.                                        */
00186   /*                                                                       */
00187   /*    Some fields are specific to one format and not to the other.       */
00188   /*                                                                       */
00189   /* <Fields>                                                              */
00190   /*    num_axis        :: The number of axes.  The maximum value is~4 for */
00191   /*                       MM; no limit in GX.                             */
00192   /*                                                                       */
00193   /*    num_designs     :: The number of designs; should be normally       */
00194   /*                       2^num_axis for MM fonts.  Not meaningful for GX */
00195   /*                       (where every glyph could have a different       */
00196   /*                       number of designs).                             */
00197   /*                                                                       */
00198   /*    num_namedstyles :: The number of named styles; only meaningful for */
00199   /*                       GX which allows certain design coordinates to   */
00200   /*                       have a string ID (in the `name' table)          */
00201   /*                       associated with them.  The font can tell the    */
00202   /*                       user that, for example, Weight=1.5 is `Bold'.   */
00203   /*                                                                       */
00204   /*    axis            :: A table of axis descriptors.                    */
00205   /*                       GX fonts contain slightly more data than MM.    */
00206   /*                                                                       */
00207   /*    namedstyles     :: A table of named styles.                        */
00208   /*                       Only meaningful with GX.                        */
00209   /*                                                                       */
00210   typedef struct  FT_MM_Var_
00211   {
00212     FT_UInt              num_axis;
00213     FT_UInt              num_designs;
00214     FT_UInt              num_namedstyles;
00215     FT_Var_Axis*         axis;
00216     FT_Var_Named_Style*  namedstyle;
00217 
00218   } FT_MM_Var;
00219 
00220 
00221   /* */
00222 
00223 
00224   /*************************************************************************/
00225   /*                                                                       */
00226   /* <Function>                                                            */
00227   /*    FT_Get_Multi_Master                                                */
00228   /*                                                                       */
00229   /* <Description>                                                         */
00230   /*    Retrieve the Multiple Master descriptor of a given font.           */
00231   /*                                                                       */
00232   /*    This function can't be used with GX fonts.                         */
00233   /*                                                                       */
00234   /* <Input>                                                               */
00235   /*    face    :: A handle to the source face.                            */
00236   /*                                                                       */
00237   /* <Output>                                                              */
00238   /*    amaster :: The Multiple Masters descriptor.                        */
00239   /*                                                                       */
00240   /* <Return>                                                              */
00241   /*    FreeType error code.  0~means success.                             */
00242   /*                                                                       */
00243   FT_EXPORT( FT_Error )
00244   FT_Get_Multi_Master( FT_Face           face,
00245                        FT_Multi_Master  *amaster );
00246 
00247 
00248   /*************************************************************************/
00249   /*                                                                       */
00250   /* <Function>                                                            */
00251   /*    FT_Get_MM_Var                                                      */
00252   /*                                                                       */
00253   /* <Description>                                                         */
00254   /*    Retrieve the Multiple Master/GX var descriptor of a given font.    */
00255   /*                                                                       */
00256   /* <Input>                                                               */
00257   /*    face    :: A handle to the source face.                            */
00258   /*                                                                       */
00259   /* <Output>                                                              */
00260   /*    amaster :: The Multiple Masters/GX var descriptor.                 */
00261   /*               Allocates a data structure, which the user must free    */
00262   /*               (a single call to FT_FREE will do it).                  */
00263   /*                                                                       */
00264   /* <Return>                                                              */
00265   /*    FreeType error code.  0~means success.                             */
00266   /*                                                                       */
00267   FT_EXPORT( FT_Error )
00268   FT_Get_MM_Var( FT_Face      face,
00269                  FT_MM_Var*  *amaster );
00270 
00271 
00272   /*************************************************************************/
00273   /*                                                                       */
00274   /* <Function>                                                            */
00275   /*    FT_Set_MM_Design_Coordinates                                       */
00276   /*                                                                       */
00277   /* <Description>                                                         */
00278   /*    For Multiple Masters fonts, choose an interpolated font design     */
00279   /*    through design coordinates.                                        */
00280   /*                                                                       */
00281   /*    This function can't be used with GX fonts.                         */
00282   /*                                                                       */
00283   /* <InOut>                                                               */
00284   /*    face       :: A handle to the source face.                         */
00285   /*                                                                       */
00286   /* <Input>                                                               */
00287   /*    num_coords :: The number of design coordinates (must be equal to   */
00288   /*                  the number of axes in the font).                     */
00289   /*                                                                       */
00290   /*    coords     :: An array of design coordinates.                      */
00291   /*                                                                       */
00292   /* <Return>                                                              */
00293   /*    FreeType error code.  0~means success.                             */
00294   /*                                                                       */
00295   FT_EXPORT( FT_Error )
00296   FT_Set_MM_Design_Coordinates( FT_Face   face,
00297                                 FT_UInt   num_coords,
00298                                 FT_Long*  coords );
00299 
00300 
00301   /*************************************************************************/
00302   /*                                                                       */
00303   /* <Function>                                                            */
00304   /*    FT_Set_Var_Design_Coordinates                                      */
00305   /*                                                                       */
00306   /* <Description>                                                         */
00307   /*    For Multiple Master or GX Var fonts, choose an interpolated font   */
00308   /*    design through design coordinates.                                 */
00309   /*                                                                       */
00310   /* <InOut>                                                               */
00311   /*    face       :: A handle to the source face.                         */
00312   /*                                                                       */
00313   /* <Input>                                                               */
00314   /*    num_coords :: The number of design coordinates (must be equal to   */
00315   /*                  the number of axes in the font).                     */
00316   /*                                                                       */
00317   /*    coords     :: An array of design coordinates.                      */
00318   /*                                                                       */
00319   /* <Return>                                                              */
00320   /*    FreeType error code.  0~means success.                             */
00321   /*                                                                       */
00322   FT_EXPORT( FT_Error )
00323   FT_Set_Var_Design_Coordinates( FT_Face    face,
00324                                  FT_UInt    num_coords,
00325                                  FT_Fixed*  coords );
00326 
00327 
00328   /*************************************************************************/
00329   /*                                                                       */
00330   /* <Function>                                                            */
00331   /*    FT_Set_MM_Blend_Coordinates                                        */
00332   /*                                                                       */
00333   /* <Description>                                                         */
00334   /*    For Multiple Masters and GX var fonts, choose an interpolated font */
00335   /*    design through normalized blend coordinates.                       */
00336   /*                                                                       */
00337   /* <InOut>                                                               */
00338   /*    face       :: A handle to the source face.                         */
00339   /*                                                                       */
00340   /* <Input>                                                               */
00341   /*    num_coords :: The number of design coordinates (must be equal to   */
00342   /*                  the number of axes in the font).                     */
00343   /*                                                                       */
00344   /*    coords     :: The design coordinates array (each element must be   */
00345   /*                  between 0 and 1.0).                                  */
00346   /*                                                                       */
00347   /* <Return>                                                              */
00348   /*    FreeType error code.  0~means success.                             */
00349   /*                                                                       */
00350   FT_EXPORT( FT_Error )
00351   FT_Set_MM_Blend_Coordinates( FT_Face    face,
00352                                FT_UInt    num_coords,
00353                                FT_Fixed*  coords );
00354 
00355 
00356   /*************************************************************************/
00357   /*                                                                       */
00358   /* <Function>                                                            */
00359   /*    FT_Set_Var_Blend_Coordinates                                       */
00360   /*                                                                       */
00361   /* <Description>                                                         */
00362   /*    This is another name of @FT_Set_MM_Blend_Coordinates.              */
00363   /*                                                                       */
00364   FT_EXPORT( FT_Error )
00365   FT_Set_Var_Blend_Coordinates( FT_Face    face,
00366                                 FT_UInt    num_coords,
00367                                 FT_Fixed*  coords );
00368 
00369 
00370   /* */
00371 
00372 
00373 FT_END_HEADER
00374 
00375 #endif /* __FTMM_H__ */
00376 
00377 
00378 /* END */

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