2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ftpfr.c
|
|
|
|
*
|
|
|
|
* FreeType API for accessing PFR-specific data (body).
|
|
|
|
*
|
2020-01-19 17:05:19 +01:00
|
|
|
* Copyright (C) 2002-2020 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
2002-10-31 09:30:19 +01:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftdebug.h>
|
2013-03-14 10:27:35 +01:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftobjs.h>
|
|
|
|
#include <freetype/internal/services/svpfr.h>
|
2002-10-31 09:30:19 +01:00
|
|
|
|
|
|
|
|
2003-04-23 07:38:13 +02:00
|
|
|
/* check the format */
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
static FT_Service_PfrMetrics
|
|
|
|
ft_pfr_check( FT_Face face )
|
2002-10-31 09:30:19 +01:00
|
|
|
{
|
2010-05-22 20:03:41 +02:00
|
|
|
FT_Service_PfrMetrics service = NULL;
|
2002-10-31 09:30:19 +01:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
|
2010-05-22 20:03:41 +02:00
|
|
|
if ( face )
|
|
|
|
FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
|
2003-04-23 07:38:13 +02:00
|
|
|
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
return service;
|
2002-10-31 09:30:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-14 00:16:59 +01:00
|
|
|
/* documentation is in ftpfr.h */
|
|
|
|
|
2002-10-31 09:30:19 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
2003-04-23 07:38:13 +02:00
|
|
|
FT_Get_PFR_Metrics( FT_Face face,
|
|
|
|
FT_UInt *aoutline_resolution,
|
|
|
|
FT_UInt *ametrics_resolution,
|
|
|
|
FT_Fixed *ametrics_x_scale,
|
|
|
|
FT_Fixed *ametrics_y_scale )
|
2002-10-31 09:30:19 +01:00
|
|
|
{
|
2003-10-20 10:29:46 +02:00
|
|
|
FT_Error error = FT_Err_Ok;
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
FT_Service_PfrMetrics service;
|
2002-10-31 09:30:19 +01:00
|
|
|
|
2003-04-23 07:38:13 +02:00
|
|
|
|
2008-12-21 18:38:23 +01:00
|
|
|
if ( !face )
|
2014-11-25 10:21:13 +01:00
|
|
|
return FT_THROW( Invalid_Face_Handle );
|
2008-12-21 18:38:23 +01:00
|
|
|
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
service = ft_pfr_check( face );
|
|
|
|
if ( service )
|
2002-10-31 09:30:19 +01:00
|
|
|
{
|
|
|
|
error = service->get_metrics( face,
|
|
|
|
aoutline_resolution,
|
|
|
|
ametrics_resolution,
|
|
|
|
ametrics_x_scale,
|
|
|
|
ametrics_y_scale );
|
|
|
|
}
|
2008-12-21 18:38:23 +01:00
|
|
|
else
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
{
|
|
|
|
FT_Fixed x_scale, y_scale;
|
|
|
|
|
2003-09-22 11:53:56 +02:00
|
|
|
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
/* this is not a PFR font */
|
2008-12-21 18:38:23 +01:00
|
|
|
if ( aoutline_resolution )
|
|
|
|
*aoutline_resolution = face->units_per_EM;
|
|
|
|
|
|
|
|
if ( ametrics_resolution )
|
|
|
|
*ametrics_resolution = face->units_per_EM;
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
|
|
|
|
x_scale = y_scale = 0x10000L;
|
|
|
|
if ( face->size )
|
|
|
|
{
|
|
|
|
x_scale = face->size->metrics.x_scale;
|
|
|
|
y_scale = face->size->metrics.y_scale;
|
|
|
|
}
|
2008-12-21 18:38:23 +01:00
|
|
|
|
|
|
|
if ( ametrics_x_scale )
|
|
|
|
*ametrics_x_scale = x_scale;
|
|
|
|
|
|
|
|
if ( ametrics_y_scale )
|
|
|
|
*ametrics_y_scale = y_scale;
|
|
|
|
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Unknown_File_Format );
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
}
|
|
|
|
|
2002-10-31 09:30:19 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2003-04-23 07:38:13 +02:00
|
|
|
|
2004-12-14 00:16:59 +01:00
|
|
|
/* documentation is in ftpfr.h */
|
|
|
|
|
2002-10-31 09:30:19 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_Get_PFR_Kerning( FT_Face face,
|
|
|
|
FT_UInt left,
|
|
|
|
FT_UInt right,
|
|
|
|
FT_Vector *avector )
|
|
|
|
{
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Service_PfrMetrics service;
|
2002-10-31 09:30:19 +01:00
|
|
|
|
2003-04-23 07:38:13 +02:00
|
|
|
|
2008-12-21 18:38:23 +01:00
|
|
|
if ( !face )
|
2014-11-25 10:21:13 +01:00
|
|
|
return FT_THROW( Invalid_Face_Handle );
|
2008-12-21 18:38:23 +01:00
|
|
|
|
2014-11-26 21:59:21 +01:00
|
|
|
if ( !avector )
|
|
|
|
return FT_THROW( Invalid_Argument );
|
|
|
|
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
service = ft_pfr_check( face );
|
|
|
|
if ( service )
|
2002-10-31 09:30:19 +01:00
|
|
|
error = service->get_kerning( face, left, right, avector );
|
2008-12-21 18:38:23 +01:00
|
|
|
else
|
2003-09-22 11:53:56 +02:00
|
|
|
error = FT_Get_Kerning( face, left, right,
|
|
|
|
FT_KERNING_UNSCALED, avector );
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
|
2002-10-31 09:30:19 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-14 00:16:59 +01:00
|
|
|
/* documentation is in ftpfr.h */
|
|
|
|
|
2002-10-31 09:30:19 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
2003-04-23 07:38:13 +02:00
|
|
|
FT_Get_PFR_Advance( FT_Face face,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FT_Pos *aadvance )
|
2002-10-31 09:30:19 +01:00
|
|
|
{
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Service_PfrMetrics service;
|
2002-10-31 09:30:19 +01:00
|
|
|
|
2003-04-23 07:38:13 +02:00
|
|
|
|
2014-11-26 21:59:21 +01:00
|
|
|
if ( !face )
|
|
|
|
return FT_THROW( Invalid_Face_Handle );
|
|
|
|
|
|
|
|
if ( !aadvance )
|
|
|
|
return FT_THROW( Invalid_Argument );
|
|
|
|
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
service = ft_pfr_check( face );
|
|
|
|
if ( service )
|
2002-10-31 09:30:19 +01:00
|
|
|
error = service->get_advance( face, gindex, aadvance );
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
else
|
2003-09-22 11:53:56 +02:00
|
|
|
/* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Argument );
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
|
2002-10-31 09:30:19 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2003-04-23 07:38:13 +02:00
|
|
|
|
2002-10-31 09:30:19 +01:00
|
|
|
/* END */
|