ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ftpfr.c
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ftpfr.c                                                                */
00004 /*                                                                         */
00005 /*    FreeType API for accessing PFR-specific data (body).                 */
00006 /*                                                                         */
00007 /*  Copyright 2002, 2003, 2004, 2008, 2010 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 #include <ft2build.h>
00019 #include FT_INTERNAL_OBJECTS_H
00020 #include FT_SERVICE_PFR_H
00021 
00022 
00023   /* check the format */
00024   static FT_Service_PfrMetrics
00025   ft_pfr_check( FT_Face  face )
00026   {
00027     FT_Service_PfrMetrics  service = NULL;
00028 
00029 
00030     if ( face )
00031       FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
00032 
00033     return service;
00034   }
00035 
00036 
00037   /* documentation is in ftpfr.h */
00038 
00039   FT_EXPORT_DEF( FT_Error )
00040   FT_Get_PFR_Metrics( FT_Face    face,
00041                       FT_UInt   *aoutline_resolution,
00042                       FT_UInt   *ametrics_resolution,
00043                       FT_Fixed  *ametrics_x_scale,
00044                       FT_Fixed  *ametrics_y_scale )
00045   {
00046     FT_Error               error = FT_Err_Ok;
00047     FT_Service_PfrMetrics  service;
00048 
00049 
00050     if ( !face )
00051       return FT_Err_Invalid_Argument;
00052 
00053     service = ft_pfr_check( face );
00054     if ( service )
00055     {
00056       error = service->get_metrics( face,
00057                                     aoutline_resolution,
00058                                     ametrics_resolution,
00059                                     ametrics_x_scale,
00060                                     ametrics_y_scale );
00061     }
00062     else
00063     {
00064       FT_Fixed  x_scale, y_scale;
00065 
00066 
00067       /* this is not a PFR font */
00068       if ( aoutline_resolution )
00069         *aoutline_resolution = face->units_per_EM;
00070 
00071       if ( ametrics_resolution )
00072         *ametrics_resolution = face->units_per_EM;
00073 
00074       x_scale = y_scale = 0x10000L;
00075       if ( face->size )
00076       {
00077         x_scale = face->size->metrics.x_scale;
00078         y_scale = face->size->metrics.y_scale;
00079       }
00080 
00081       if ( ametrics_x_scale )
00082         *ametrics_x_scale = x_scale;
00083 
00084       if ( ametrics_y_scale )
00085         *ametrics_y_scale = y_scale;
00086 
00087       error = FT_Err_Unknown_File_Format;
00088     }
00089 
00090     return error;
00091   }
00092 
00093 
00094   /* documentation is in ftpfr.h */
00095 
00096   FT_EXPORT_DEF( FT_Error )
00097   FT_Get_PFR_Kerning( FT_Face     face,
00098                       FT_UInt     left,
00099                       FT_UInt     right,
00100                       FT_Vector  *avector )
00101   {
00102     FT_Error               error;
00103     FT_Service_PfrMetrics  service;
00104 
00105 
00106     if ( !face )
00107       return FT_Err_Invalid_Argument;
00108 
00109     service = ft_pfr_check( face );
00110     if ( service )
00111       error = service->get_kerning( face, left, right, avector );
00112     else
00113       error = FT_Get_Kerning( face, left, right,
00114                               FT_KERNING_UNSCALED, avector );
00115 
00116     return error;
00117   }
00118 
00119 
00120   /* documentation is in ftpfr.h */
00121 
00122   FT_EXPORT_DEF( FT_Error )
00123   FT_Get_PFR_Advance( FT_Face   face,
00124                       FT_UInt   gindex,
00125                       FT_Pos   *aadvance )
00126   {
00127     FT_Error               error;
00128     FT_Service_PfrMetrics  service;
00129 
00130 
00131     service = ft_pfr_check( face );
00132     if ( service )
00133     {
00134       error = service->get_advance( face, gindex, aadvance );
00135     }
00136     else
00137       /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
00138       error = FT_Err_Invalid_Argument;
00139 
00140     return error;
00141   }
00142 
00143 
00144 /* END */

Generated on Fri May 25 2012 04:32:10 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.