forked from minhngoc25a/freetype2
* src/base/ftpfr.c (FT_Get_PFR_Metrics): Protect against NULL
arguments. Fix return value for non-PFR fonts. Both problems reported by Chi Nguyen <chint@necsv.com>.
This commit is contained in:
parent
ce33a312da
commit
478cca14a5
|
@ -1,3 +1,10 @@
|
|||
2008-12-21 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/base/ftpfr.c (FT_Get_PFR_Metrics): Protect against NULL
|
||||
arguments.
|
||||
Fix return value for non-PFR fonts. Both problems reported by Chi
|
||||
Nguyen <chint@necsv.com>.
|
||||
|
||||
2008-12-21 anonymous
|
||||
|
||||
FT_USE_MODULE declares things as:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* FreeType API for accessing PFR-specific data (specification only). */
|
||||
/* */
|
||||
/* Copyright 2002, 2003, 2004, 2006 by */
|
||||
/* Copyright 2002, 2003, 2004, 2006, 2008 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -73,11 +73,11 @@ FT_BEGIN_HEADER
|
|||
* A 16.16 fixed-point number used to scale distance expressed
|
||||
* in metrics units to device sub-pixels. This is equivalent to
|
||||
* `face->size->x_scale', but for metrics only. Optional (parameter
|
||||
* can be NULL)
|
||||
* can be NULL).
|
||||
*
|
||||
* ametrics_y_scale ::
|
||||
* Same as `ametrics_x_scale' but for the vertical direction.
|
||||
* optional (parameter can be NULL)
|
||||
* optional (parameter can be NULL).
|
||||
*
|
||||
* @return:
|
||||
* FreeType error code. 0~means success.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* FreeType API for accessing PFR-specific data (body). */
|
||||
/* */
|
||||
/* Copyright 2002, 2003, 2004 by */
|
||||
/* Copyright 2002, 2003, 2004, 2008 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -46,6 +46,9 @@
|
|||
FT_Service_PfrMetrics service;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
service = ft_pfr_check( face );
|
||||
if ( service )
|
||||
{
|
||||
|
@ -55,14 +58,17 @@
|
|||
ametrics_x_scale,
|
||||
ametrics_y_scale );
|
||||
}
|
||||
else if ( face )
|
||||
else
|
||||
{
|
||||
FT_Fixed x_scale, y_scale;
|
||||
|
||||
|
||||
/* this is not a PFR font */
|
||||
*aoutline_resolution = face->units_per_EM;
|
||||
*ametrics_resolution = face->units_per_EM;
|
||||
if ( aoutline_resolution )
|
||||
*aoutline_resolution = face->units_per_EM;
|
||||
|
||||
if ( ametrics_resolution )
|
||||
*ametrics_resolution = face->units_per_EM;
|
||||
|
||||
x_scale = y_scale = 0x10000L;
|
||||
if ( face->size )
|
||||
|
@ -70,11 +76,15 @@
|
|||
x_scale = face->size->metrics.x_scale;
|
||||
y_scale = face->size->metrics.y_scale;
|
||||
}
|
||||
*ametrics_x_scale = x_scale;
|
||||
*ametrics_y_scale = y_scale;
|
||||
|
||||
if ( ametrics_x_scale )
|
||||
*ametrics_x_scale = x_scale;
|
||||
|
||||
if ( ametrics_y_scale )
|
||||
*ametrics_y_scale = y_scale;
|
||||
|
||||
error = FT_Err_Unknown_File_Format;
|
||||
}
|
||||
else
|
||||
error = FT_Err_Invalid_Argument;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -92,14 +102,15 @@
|
|||
FT_Service_PfrMetrics service;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
service = ft_pfr_check( face );
|
||||
if ( service )
|
||||
error = service->get_kerning( face, left, right, avector );
|
||||
else if ( face )
|
||||
else
|
||||
error = FT_Get_Kerning( face, left, right,
|
||||
FT_KERNING_UNSCALED, avector );
|
||||
else
|
||||
error = FT_Err_Invalid_Argument;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue