00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <ft2build.h>
00019 #include FT_INTERNAL_OBJECTS_H
00020 #include FT_SERVICE_PFR_H
00021
00022
00023
00024 static FT_Service_PfrMetrics
00025 ft_pfr_check( FT_Face face )
00026 {
00027 FT_Service_PfrMetrics service;
00028
00029
00030 FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
00031
00032 return service;
00033 }
00034
00035
00036
00037
00038 FT_EXPORT_DEF( FT_Error )
00039 FT_Get_PFR_Metrics( FT_Face face,
00040 FT_UInt *aoutline_resolution,
00041 FT_UInt *ametrics_resolution,
00042 FT_Fixed *ametrics_x_scale,
00043 FT_Fixed *ametrics_y_scale )
00044 {
00045 FT_Error error = FT_Err_Ok;
00046 FT_Service_PfrMetrics service;
00047
00048
00049 if ( !face )
00050 return FT_Err_Invalid_Argument;
00051
00052 service = ft_pfr_check( face );
00053 if ( service )
00054 {
00055 error = service->get_metrics( face,
00056 aoutline_resolution,
00057 ametrics_resolution,
00058 ametrics_x_scale,
00059 ametrics_y_scale );
00060 }
00061 else
00062 {
00063 FT_Fixed x_scale, y_scale;
00064
00065
00066
00067 if ( aoutline_resolution )
00068 *aoutline_resolution = face->units_per_EM;
00069
00070 if ( ametrics_resolution )
00071 *ametrics_resolution = face->units_per_EM;
00072
00073 x_scale = y_scale = 0x10000L;
00074 if ( face->size )
00075 {
00076 x_scale = face->size->metrics.x_scale;
00077 y_scale = face->size->metrics.y_scale;
00078 }
00079
00080 if ( ametrics_x_scale )
00081 *ametrics_x_scale = x_scale;
00082
00083 if ( ametrics_y_scale )
00084 *ametrics_y_scale = y_scale;
00085
00086 error = FT_Err_Unknown_File_Format;
00087 }
00088
00089 return error;
00090 }
00091
00092
00093
00094
00095 FT_EXPORT_DEF( FT_Error )
00096 FT_Get_PFR_Kerning( FT_Face face,
00097 FT_UInt left,
00098 FT_UInt right,
00099 FT_Vector *avector )
00100 {
00101 FT_Error error;
00102 FT_Service_PfrMetrics service;
00103
00104
00105 if ( !face )
00106 return FT_Err_Invalid_Argument;
00107
00108 service = ft_pfr_check( face );
00109 if ( service )
00110 error = service->get_kerning( face, left, right, avector );
00111 else
00112 error = FT_Get_Kerning( face, left, right,
00113 FT_KERNING_UNSCALED, avector );
00114
00115 return error;
00116 }
00117
00118
00119
00120
00121 FT_EXPORT_DEF( FT_Error )
00122 FT_Get_PFR_Advance( FT_Face face,
00123 FT_UInt gindex,
00124 FT_Pos *aadvance )
00125 {
00126 FT_Error error;
00127 FT_Service_PfrMetrics service;
00128
00129
00130 service = ft_pfr_check( face );
00131 if ( service )
00132 {
00133 error = service->get_advance( face, gindex, aadvance );
00134 }
00135 else
00136
00137 error = FT_Err_Invalid_Argument;
00138
00139 return error;
00140 }
00141
00142
00143