Al-Qurtas-Islamic-bank-The-.../src/truetype/ttdriver.c

689 lines
21 KiB
C
Raw Normal View History

/****************************************************************************
*
* ttdriver.c
*
* TrueType font driver implementation (body).
*
2022-01-11 10:54:10 +01:00
* Copyright (C) 1996-2022 by
* 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.
*
*/
1999-12-17 00:11:37 +01:00
2000-12-08 17:17:16 +01:00
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/sfnt.h>
#include <freetype/internal/services/svfntfmt.h>
Complete redesign of error codes. Please check ftmoderr.h for more details. * include/freetype/internal/cfferrs.h, include/freetype/internal/tterrors.h, include/freetype/internal/t1errors.h: Removed. Replaced with files local to the module. All extra error codes have been moved to `fterrors.h'. * src/sfnt/ttpost.h: Move error codes to `fterrors.h'. * src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h, src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h, src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h, src/smooth/ftsmerrs.h, src/truetype/tterrors.h, src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the error names for the module it belongs to. * include/freetype/ftmoderr.h: New file, defining the module error offsets. Its structure is similar to `fterrors.h'. * include/freetype/fterrors.h (FT_NOERRORDEF): New macro. (FT_ERRORDEF): Redefined to use module error offsets. All internal error codes are now public; unused error codes have been removed, some are new. * include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New macro. * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro. All other source files have been updated to use the new error codes; some already existing (internal) error codes local to a module have been renamed to give them the same name as in the base module. All make files have been updated to include the local error files. * src/cid/cidtokens.h: Replaced with... * src/cid/cidtoken.h: This file for 8+3 consistency. * src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include <freetype/ftmm.h>
#include <freetype/internal/services/svmm.h>
#include <freetype/internal/services/svmetric.h>
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
#endif
#include <freetype/internal/services/svtteng.h>
#include <freetype/internal/services/svttglyf.h>
#include <freetype/internal/services/svprop.h>
#include <freetype/ftdriver.h>
#include "ttdriver.h"
#include "ttgload.h"
#include "ttpload.h"
1999-12-17 00:11:37 +01:00
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include "ttgxvar.h"
#endif
Complete redesign of error codes. Please check ftmoderr.h for more details. * include/freetype/internal/cfferrs.h, include/freetype/internal/tterrors.h, include/freetype/internal/t1errors.h: Removed. Replaced with files local to the module. All extra error codes have been moved to `fterrors.h'. * src/sfnt/ttpost.h: Move error codes to `fterrors.h'. * src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h, src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h, src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h, src/smooth/ftsmerrs.h, src/truetype/tterrors.h, src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the error names for the module it belongs to. * include/freetype/ftmoderr.h: New file, defining the module error offsets. Its structure is similar to `fterrors.h'. * include/freetype/fterrors.h (FT_NOERRORDEF): New macro. (FT_ERRORDEF): Redefined to use module error offsets. All internal error codes are now public; unused error codes have been removed, some are new. * include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New macro. * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro. All other source files have been updated to use the new error codes; some already existing (internal) error codes local to a module have been renamed to give them the same name as in the base module. All make files have been updated to include the local error files. * src/cid/cidtokens.h: Replaced with... * src/cid/cidtoken.h: This file for 8+3 consistency. * src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
#include "tterrors.h"
1999-12-17 00:11:37 +01:00
/**************************************************************************
*
* The macro FT_COMPONENT is used in trace mode. It is an implicit
* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
* messages during execution.
*/
1999-12-17 00:11:37 +01:00
#undef FT_COMPONENT
#define FT_COMPONENT ttdriver
1999-12-17 00:11:37 +01:00
/*
* PROPERTY SERVICE
*
*/
static FT_Error
tt_property_set( FT_Module module, /* TT_Driver */
const char* property_name,
const void* value,
FT_Bool value_is_string )
{
FT_Error error = FT_Err_Ok;
TT_Driver driver = (TT_Driver)module;
#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
FT_UNUSED( value_is_string );
#endif
if ( !ft_strcmp( property_name, "interpreter-version" ) )
{
FT_UInt interpreter_version;
#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
if ( value_is_string )
{
const char* s = (const char*)value;
interpreter_version = (FT_UInt)ft_strtol( s, NULL, 10 );
}
else
#endif
{
FT_UInt* iv = (FT_UInt*)value;
interpreter_version = *iv;
}
if ( interpreter_version == TT_INTERPRETER_VERSION_35
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|| interpreter_version == TT_INTERPRETER_VERSION_38
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|| interpreter_version == TT_INTERPRETER_VERSION_40
#endif
)
driver->interpreter_version = interpreter_version;
else
error = FT_ERR( Unimplemented_Feature );
return error;
}
2020-11-20 20:54:35 +01:00
FT_TRACE2(( "tt_property_set: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
static FT_Error
tt_property_get( FT_Module module, /* TT_Driver */
const char* property_name,
const void* value )
{
FT_Error error = FT_Err_Ok;
TT_Driver driver = (TT_Driver)module;
FT_UInt interpreter_version = driver->interpreter_version;
if ( !ft_strcmp( property_name, "interpreter-version" ) )
{
FT_UInt* val = (FT_UInt*)value;
*val = interpreter_version;
return error;
}
2020-11-20 20:54:35 +01:00
FT_TRACE2(( "tt_property_get: missing property `%s'\n",
property_name ));
return FT_THROW( Missing_Property );
}
FT_DEFINE_SERVICE_PROPERTIESREC(
tt_service_properties,
2015-10-30 08:07:56 +01:00
(FT_Properties_SetFunc)tt_property_set, /* set_property */
(FT_Properties_GetFunc)tt_property_get /* get_property */
)
1999-12-17 00:11:37 +01:00
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** F A C E S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @Function:
* tt_get_kerning
*
* @Description:
* A driver method used to return the kerning vector between two
* glyphs of the same face.
*
* @Input:
* face ::
* A handle to the source face object.
*
* left_glyph ::
* The index of the left glyph in the kern pair.
*
* right_glyph ::
* The index of the right glyph in the kern pair.
*
* @Output:
* kerning ::
* The kerning vector. This is in font units for
* scalable formats, and in pixels for fixed-sizes
* formats.
*
* @Return:
* FreeType error code. 0 means success.
*
* @Note:
* Only horizontal layouts (left-to-right & right-to-left) are
* supported by this function. Other layouts, or more sophisticated
* kernings, are out of scope of this method (the basic driver
* interface is meant to be simple).
*
* They can be implemented by format-specific interfaces.
*/
2001-06-28 09:17:51 +02:00
static FT_Error
tt_get_kerning( FT_Face ttface, /* TT_Face */
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_Vector* kerning )
1999-12-17 00:11:37 +01:00
{
TT_Face face = (TT_Face)ttface;
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
1999-12-17 00:11:37 +01:00
kerning->x = 0;
kerning->y = 0;
if ( sfnt )
kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
return 0;
1999-12-17 00:11:37 +01:00
}
static FT_Error
tt_get_advances( FT_Face ttface,
FT_UInt start,
FT_UInt count,
FT_Int32 flags,
FT_Fixed *advances )
{
FT_UInt nn;
TT_Face face = (TT_Face)ttface;
/* XXX: TODO: check for sbits */
if ( flags & FT_LOAD_VERTICAL_LAYOUT )
{
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without VVAR table */
if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) &&
!( face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
for ( nn = 0; nn < count; nn++ )
{
FT_Short tsb;
FT_UShort ah;
/* since we don't need `tsb', we use zero for `yMax' parameter */
TT_Get_VMetrics( face, start + nn, 0, &tsb, &ah );
advances[nn] = ah;
}
}
else
{
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without HVAR table */
if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) &&
!( face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
for ( nn = 0; nn < count; nn++ )
{
FT_Short lsb;
FT_UShort aw;
TT_Get_HMetrics( face, start + nn, &lsb, &aw );
advances[nn] = aw;
}
}
return FT_Err_Ok;
}
2016-02-05 11:52:50 +01:00
1999-12-17 00:11:37 +01:00
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** S I Z E S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
2001-06-28 09:17:51 +02:00
static FT_Error
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
tt_size_select( FT_Size size,
FT_ULong strike_index )
1999-12-17 00:11:37 +01:00
{
* include/freetype/internal/sfnt.h (SFNT_Interface): New method `load_strike_metrics' used to load the strike's metrics. * src/sfnt/sfdriver.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: New function `tt_face_load_strike_metrics'. * src/pfr/pfrobjs.c (pfr_face_init): Set FT_Bitmap_Size correctly. * src/winfonts/winfnt.c (FNT_Face_Init): Use `nominal_point_size' for nominal size unless it is obviously incorrect. * include/freetype/freetype.h (FT_Bitmap_Size): Update the comments on FNT driver. Introduce new size selection interface. * include/freetype/internal/ftdriver.h (struct FT_Driver_ClassRec_): Replace `set_char_sizes' and `set_pixel_sizes' by `request_size' and `select_size'. * include/freetype/freetype.h (FT_Select_Size, FT_Size_Request_Type, FT_Size_Request, FT_Request_Size, FT_Select_Size), src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): API additions to export the new size selection interface. * src/base/ftobjs.c (FT_Set_Char_Size, FT_Set_Pixel_Sizes): Use `FT_Request_Size'. * include/freetype/internal/ftobjs.h (FT_Match_Size), src/base/ftobjs.c (FT_Match_Size): New function to match a size request against `available_sizes'. Drivers supporting bitmap strikes can use this function to implement `request_size'. * src/bdf/bdfdrivr.c, src/cid/cidobjs.c, src/cid/cidobjs.h, src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42drivr.c, src/type42/t42objs.c, src/type42/t42objs.h, src/winfonts/winfnt.c: Update to new size selection interface. * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffobjs.h, src/truetype/ttdriver.c, src/truetype/ttgload.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h: Update to new size selection interface. Make `strike_index' FT_ULong and always defined. Use `load_strike_metrics' provided by SFNT interface.
2006-01-13 13:21:31 +01:00
TT_Face ttface = (TT_Face)size->face;
TT_Size ttsize = (TT_Size)size;
FT_Error error = FT_Err_Ok;
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
ttsize->strike_index = strike_index;
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
if ( FT_IS_SCALABLE( size->face ) )
{
/* use the scaled metrics, even when tt_size_reset fails */
FT_Select_Metrics( size->face, strike_index );
tt_size_reset( ttsize, 0 ); /* ignore return value */
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
}
else
1999-12-17 00:11:37 +01:00
{
SFNT_Service sfnt = (SFNT_Service)ttface->sfnt;
FT_Size_Metrics* size_metrics = &size->metrics;
* include/freetype/internal/sfnt.h (SFNT_Interface): New method `load_strike_metrics' used to load the strike's metrics. * src/sfnt/sfdriver.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: New function `tt_face_load_strike_metrics'. * src/pfr/pfrobjs.c (pfr_face_init): Set FT_Bitmap_Size correctly. * src/winfonts/winfnt.c (FNT_Face_Init): Use `nominal_point_size' for nominal size unless it is obviously incorrect. * include/freetype/freetype.h (FT_Bitmap_Size): Update the comments on FNT driver. Introduce new size selection interface. * include/freetype/internal/ftdriver.h (struct FT_Driver_ClassRec_): Replace `set_char_sizes' and `set_pixel_sizes' by `request_size' and `select_size'. * include/freetype/freetype.h (FT_Select_Size, FT_Size_Request_Type, FT_Size_Request, FT_Request_Size, FT_Select_Size), src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): API additions to export the new size selection interface. * src/base/ftobjs.c (FT_Set_Char_Size, FT_Set_Pixel_Sizes): Use `FT_Request_Size'. * include/freetype/internal/ftobjs.h (FT_Match_Size), src/base/ftobjs.c (FT_Match_Size): New function to match a size request against `available_sizes'. Drivers supporting bitmap strikes can use this function to implement `request_size'. * src/bdf/bdfdrivr.c, src/cid/cidobjs.c, src/cid/cidobjs.h, src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42drivr.c, src/type42/t42objs.c, src/type42/t42objs.h, src/winfonts/winfnt.c: Update to new size selection interface. * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffobjs.h, src/truetype/ttdriver.c, src/truetype/ttgload.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h: Update to new size selection interface. Make `strike_index' FT_ULong and always defined. Use `load_strike_metrics' provided by SFNT interface.
2006-01-13 13:21:31 +01:00
error = sfnt->load_strike_metrics( ttface,
strike_index,
size_metrics );
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
if ( error )
ttsize->strike_index = 0xFFFFFFFFUL;
}
2000-05-17 01:44:38 +02:00
* include/freetype/internal/sfnt.h (SFNT_Interface): New method `load_strike_metrics' used to load the strike's metrics. * src/sfnt/sfdriver.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: New function `tt_face_load_strike_metrics'. * src/pfr/pfrobjs.c (pfr_face_init): Set FT_Bitmap_Size correctly. * src/winfonts/winfnt.c (FNT_Face_Init): Use `nominal_point_size' for nominal size unless it is obviously incorrect. * include/freetype/freetype.h (FT_Bitmap_Size): Update the comments on FNT driver. Introduce new size selection interface. * include/freetype/internal/ftdriver.h (struct FT_Driver_ClassRec_): Replace `set_char_sizes' and `set_pixel_sizes' by `request_size' and `select_size'. * include/freetype/freetype.h (FT_Select_Size, FT_Size_Request_Type, FT_Size_Request, FT_Request_Size, FT_Select_Size), src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): API additions to export the new size selection interface. * src/base/ftobjs.c (FT_Set_Char_Size, FT_Set_Pixel_Sizes): Use `FT_Request_Size'. * include/freetype/internal/ftobjs.h (FT_Match_Size), src/base/ftobjs.c (FT_Match_Size): New function to match a size request against `available_sizes'. Drivers supporting bitmap strikes can use this function to implement `request_size'. * src/bdf/bdfdrivr.c, src/cid/cidobjs.c, src/cid/cidobjs.h, src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42drivr.c, src/type42/t42objs.c, src/type42/t42objs.h, src/winfonts/winfnt.c: Update to new size selection interface. * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffobjs.h, src/truetype/ttdriver.c, src/truetype/ttgload.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h: Update to new size selection interface. Make `strike_index' FT_ULong and always defined. Use `load_strike_metrics' provided by SFNT interface.
2006-01-13 13:21:31 +01:00
return error;
1999-12-17 00:11:37 +01:00
}
2006-01-26 22:03:58 +01:00
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
1999-12-17 00:11:37 +01:00
* include/freetype/internal/sfnt.h (SFNT_Interface): New method `load_strike_metrics' used to load the strike's metrics. * src/sfnt/sfdriver.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: New function `tt_face_load_strike_metrics'. * src/pfr/pfrobjs.c (pfr_face_init): Set FT_Bitmap_Size correctly. * src/winfonts/winfnt.c (FNT_Face_Init): Use `nominal_point_size' for nominal size unless it is obviously incorrect. * include/freetype/freetype.h (FT_Bitmap_Size): Update the comments on FNT driver. Introduce new size selection interface. * include/freetype/internal/ftdriver.h (struct FT_Driver_ClassRec_): Replace `set_char_sizes' and `set_pixel_sizes' by `request_size' and `select_size'. * include/freetype/freetype.h (FT_Select_Size, FT_Size_Request_Type, FT_Size_Request, FT_Request_Size, FT_Select_Size), src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): API additions to export the new size selection interface. * src/base/ftobjs.c (FT_Set_Char_Size, FT_Set_Pixel_Sizes): Use `FT_Request_Size'. * include/freetype/internal/ftobjs.h (FT_Match_Size), src/base/ftobjs.c (FT_Match_Size): New function to match a size request against `available_sizes'. Drivers supporting bitmap strikes can use this function to implement `request_size'. * src/bdf/bdfdrivr.c, src/cid/cidobjs.c, src/cid/cidobjs.h, src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42drivr.c, src/type42/t42objs.c, src/type42/t42objs.h, src/winfonts/winfnt.c: Update to new size selection interface. * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffobjs.h, src/truetype/ttdriver.c, src/truetype/ttgload.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h: Update to new size selection interface. Make `strike_index' FT_ULong and always defined. Use `load_strike_metrics' provided by SFNT interface.
2006-01-13 13:21:31 +01:00
2001-06-28 09:17:51 +02:00
static FT_Error
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
tt_size_request( FT_Size size,
FT_Size_Request req )
1999-12-17 00:11:37 +01:00
{
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
TT_Size ttsize = (TT_Size)size;
FT_Error error = FT_Err_Ok;
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
1999-12-17 00:11:37 +01:00
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
if ( FT_HAS_FIXED_SIZES( size->face ) )
{
* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove unused `max_points' and `max_contours'. * src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Update. * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused `max_components'. * src/truetype/ttinterp.h (TT_ExecContextRec): Remove unused `loadSize' and `loadStack'. * src/truetype/ttinterp.c (TT_Done_Context, TT_Load_Context), src/sfnt/ttload.c (tt_face_load_maxp): Update. * src/cff/cffobjs.h (cff_size_select), src/sfnt/sfdriver.c (sfnt_interface), src/truetype/ttdriver.c (tt_size_request): Fix compiler errors/warnings when TT_CONFIG_OPTION_EMBEDDED_BITMAPS is not defined. * src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_get_metrics): Fix possible segment faults for the non-FT_OPTIMIZE_MEMORY'ed versions. (finally!) For most OpenType tables, `tt_face_load_xxxx' simply loads the table and `face->root' is set later in `sfnt_load_face'. Here, we try to make this work for _all_ tables. * src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c, src/sfnt/ttload.c, src/sfnt/ttmtx.c: all `tt_face_load_xxxx' should load the table and then exit. Error handling or setting face->root is done later in `sfnt_load_face'. Pretty trace messages. * src/sfnt/sfobjs.c (sfnt_load_face): Work harder. Mac bitmap-only fonts are not scalable. Check that `face->header.Units_Per_EM' is not zero. (LOAD_, LOADM_): Pretty trace messages. * src/sfnt/ttsbit0.c (tt_face_load_strike_metrics): Read metrics from `eblc'. * src/sfnt/ttcmap.c (tt_face_build_cmaps), src/sfnt/ttpost.c (load_format_20, load_format_25, tt_face_get_ps_name): Use face->max_profile.numGlyphs, instead of face->root.num_glyphs.
2006-02-15 08:44:31 +01:00
TT_Face ttface = (TT_Face)size->face;
SFNT_Service sfnt = (SFNT_Service)ttface->sfnt;
FT_ULong strike_index;
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
error = sfnt->set_sbit_strike( ttface, req, &strike_index );
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
if ( error )
ttsize->strike_index = 0xFFFFFFFFUL;
else
return tt_size_select( size, strike_index );
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
}
2006-01-26 22:03:58 +01:00
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
{
FT_Error err = FT_Request_Metrics( size->face, req );
if ( err )
{
error = err;
goto Exit;
}
}
* include/freetype/freetype.h (FT_Select_Size): Rename the second argument from `idx' to `strike_index'. (FT_Size_Request_Type): Add FT_SIZE_REQUEST_TYPE_MAX to the end of this enum. * include/freetype/internal/ftobjs.h (FT_REQUEST_WIDTH, FT_REQUEST_HEIGHT): New macros to get the width and height of a request, in fractional pixels. * include/freetype/internal/ftobjs.h (FT_Select_Metrics, FT_Request_Metrics), src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): New base functions to set the font metrics. They were part of FT_Select_Size/FT_Request_Size and are made independent functions so that metrics are not set again and again. * src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): Metrics are set only when driver's size_select/size_request is NULL. That is, drivers should set the metrics themselves. (FT_Match_Size): Round before matching. This was what we did and it does cause some problems without rounding. * src/cff/cffobjs.c (cff_size_select), src/truetype/ttdriver.c (tt_size_select): Set the font metrics. s/index/strike_index/. The scaled metrics are always preferred over strikes' metrics, even when some strike is selected. This is done because the strikes' metrics are not reliable, e.g., the sign of the descender is wrong for some fonts. * src/cff/cffobjs.c (cff_size_request), src/truetype/ttdriver.c (tt_size_request): Set the font metrics. Call cff_size_select/tt_size_select when some strike is matched. * src/bdf/bdfdrivr.c, src/cff/cffobjs.c, src/cid/cidobjs.c, src/pcf/pcfdrivr.c, src/truetype/ttdriver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42objs.c, src/winfonts/winfnt.c: Set the font metrics. s/index/strike_index/. * src/tools/test_afm.c, src/psaux/psconv.c: Older versions of these files were committed. Just a catch-up. (PS_Conv_ToFixed): Remove the `goto'. (PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Speed up a little. * src/sfnt/ttsbit.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics), src/sfnt/ttsbit0.c (tt_face_load_sbit_strikes, tt_face_load_strike_metrics): The advertised metrics in `available_sizes' are different from those actually used.
2006-01-23 15:12:40 +01:00
if ( FT_IS_SCALABLE( size->face ) )
{
error = tt_size_reset( ttsize, 0 );
#ifdef TT_USE_BYTECODE_INTERPRETER
/* for the `MPS' bytecode instruction we need the point size */
if ( !error )
{
FT_UInt resolution =
ttsize->metrics->x_ppem > ttsize->metrics->y_ppem
? req->horiResolution
: req->vertResolution;
/* if we don't have a resolution value, assume 72dpi */
if ( req->type == FT_SIZE_REQUEST_TYPE_SCALES ||
!resolution )
resolution = 72;
ttsize->point_size = FT_MulDiv( ttsize->ttmetrics.ppem,
64 * 72,
resolution );
}
#endif
}
1999-12-17 00:11:37 +01:00
Exit:
* include/freetype/internal/sfnt.h (SFNT_Interface): New method `load_strike_metrics' used to load the strike's metrics. * src/sfnt/sfdriver.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: New function `tt_face_load_strike_metrics'. * src/pfr/pfrobjs.c (pfr_face_init): Set FT_Bitmap_Size correctly. * src/winfonts/winfnt.c (FNT_Face_Init): Use `nominal_point_size' for nominal size unless it is obviously incorrect. * include/freetype/freetype.h (FT_Bitmap_Size): Update the comments on FNT driver. Introduce new size selection interface. * include/freetype/internal/ftdriver.h (struct FT_Driver_ClassRec_): Replace `set_char_sizes' and `set_pixel_sizes' by `request_size' and `select_size'. * include/freetype/freetype.h (FT_Select_Size, FT_Size_Request_Type, FT_Size_Request, FT_Request_Size, FT_Select_Size), src/base/ftobjs.c (FT_Select_Size, FT_Request_Size): API additions to export the new size selection interface. * src/base/ftobjs.c (FT_Set_Char_Size, FT_Set_Pixel_Sizes): Use `FT_Request_Size'. * include/freetype/internal/ftobjs.h (FT_Match_Size), src/base/ftobjs.c (FT_Match_Size): New function to match a size request against `available_sizes'. Drivers supporting bitmap strikes can use this function to implement `request_size'. * src/bdf/bdfdrivr.c, src/cid/cidobjs.c, src/cid/cidobjs.h, src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1objs.h, src/type42/t42drivr.c, src/type42/t42objs.c, src/type42/t42objs.h, src/winfonts/winfnt.c: Update to new size selection interface. * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffobjs.h, src/truetype/ttdriver.c, src/truetype/ttgload.c, src/truetype/ttobjs.c, src/truetype/ttobjs.h: Update to new size selection interface. Make `strike_index' FT_ULong and always defined. Use `load_strike_metrics' provided by SFNT interface.
2006-01-13 13:21:31 +01:00
return error;
1999-12-17 00:11:37 +01:00
}
/**************************************************************************
*
* @Function:
* tt_glyph_load
*
* @Description:
* A driver method used to load a glyph within a given glyph slot.
*
* @Input:
* slot ::
* A handle to the target slot object where the glyph
* will be loaded.
*
* size ::
* A handle to the source face size at which the glyph
* must be scaled, loaded, etc.
*
* glyph_index ::
* The index of the glyph in the font file.
*
* load_flags ::
* A flag indicating what to load for this glyph. The
* FT_LOAD_XXX constants can be used to control the
* glyph loading process (e.g., whether the outline
* should be scaled, whether to load bitmaps or not,
* whether to hint the outline, etc).
*
* @Return:
* FreeType error code. 0 means success.
*/
2001-06-28 09:17:51 +02:00
static FT_Error
tt_glyph_load( FT_GlyphSlot ttslot, /* TT_GlyphSlot */
FT_Size ttsize, /* TT_Size */
FT_UInt glyph_index,
FT_Int32 load_flags )
1999-12-17 00:11:37 +01:00
{
TT_GlyphSlot slot = (TT_GlyphSlot)ttslot;
TT_Size size = (TT_Size)ttsize;
FT_Face face = ttslot->face;
FT_Error error;
1999-12-17 00:11:37 +01:00
if ( !slot )
return FT_THROW( Invalid_Slot_Handle );
1999-12-17 00:11:37 +01:00
if ( !size )
return FT_THROW( Invalid_Size_Handle );
1999-12-17 00:11:37 +01:00
if ( !face )
return FT_THROW( Invalid_Face_Handle );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( glyph_index >= (FT_UInt)face->num_glyphs &&
!face->internal->incremental_interface )
#else
if ( glyph_index >= (FT_UInt)face->num_glyphs )
#endif
return FT_THROW( Invalid_Argument );
if ( load_flags & FT_LOAD_NO_HINTING )
{
/* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT */
2011-11-30 10:46:53 +01:00
/* are necessary to disable hinting for tricky fonts */
if ( FT_IS_TRICKY( face ) )
load_flags &= ~FT_LOAD_NO_HINTING;
if ( load_flags & FT_LOAD_NO_AUTOHINT )
load_flags |= FT_LOAD_NO_HINTING;
}
if ( load_flags & ( FT_LOAD_NO_RECURSE | FT_LOAD_NO_SCALE ) )
1999-12-17 00:11:37 +01:00
{
load_flags |= FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE;
if ( !FT_IS_TRICKY( face ) )
load_flags |= FT_LOAD_NO_HINTING;
1999-12-17 00:11:37 +01:00
}
/* use hinted metrics only if we load a glyph with hinting */
size->metrics = ( load_flags & FT_LOAD_NO_HINTING )
? &ttsize->metrics
: &size->hinted_metrics;
[sfnt] Preliminary support of coloured layer outlines. This commit enables OpenType's COLR/CPAL table handling; a typical application are color emojis that can be scaled to any size. If the color palette does not exist or is invalid, the rendering step rasterizes the outline instead. The current implementation assumes that the foreground is black. Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS. There are still some issues with metrics; additionally, an API to fetch color layers is missing. * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_COLOR_LAYERS): New macro. * include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec, FT_Colr_InternalRec): New structures. (FT_Slot_InternalRec): Add `color_layers' field. * include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func, TT_Blend_Colr_Func): New function types. (SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer', and `colr_blend' fields. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `colr_and_cpal' field. * include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New macros. * src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files. * src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal): Handle glyph color layers. * src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttcolr.c'. * src/sfnt/sfdriver.c: Include `ttcolr.h'. (PUT_COLOR_LAYERS): New macro. Update call to `FT_DEFINE_SFNT_INTERFACE'. * src/sfnt/sfnt.c: Include `ttcolr.c'. * src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables. (sfnt_done_face): Updated. * src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
/* now fill in the glyph slot with outline/bitmap/layered */
1999-12-17 00:11:37 +01:00
error = TT_Load_Glyph( size, slot, glyph_index, load_flags );
/* force drop-out mode to 2 - irrelevant now */
/* slot->outline.dropout_mode = 2; */
1999-12-17 00:11:37 +01:00
return error;
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** D R I V E R I N T E R F A C E ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
2012-07-29 13:15:53 +02:00
FT_DEFINE_SERVICE_MULTIMASTERSREC(
tt_service_gx_multi_masters,
[truetype, snft] Add service methods for `DeltaSetIdxMap` and `VarStore`. This will be needed for 'COLR' v1 variation support. * src/truetype/ttgxvar.h (GX_ItemVarData, GX_AxisCoords, GX_VarRegion, GX_VarItemStore, GX_DeltaSetIdxMap): Move structures to... * include/freetype/internal/ftmmtypes.h: ... this new file. * include/freetype/internal/service/svmm.h (MultiMasters): Include `ftmmtypes.h`. (FT_Var_Load_Delta_Set_Idx_Map_Func, FT_Var_Load_Item_Var_Store_Func, FT_Var_Get_Item_Delta_Func, FT_Var_Done_Item_Var_Store_Func, FT_Var_Done_Delta_Set_Idx_Map_Func): New function typedefs. (MultiMasters): Add them. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/cff/cffdrivr.c (cff_load_item_variation_store, cff_load_delta_set_index_mapping, cff_get_item_delta, cff_done_item_variation_store, cff_done_delta_set_index_map): New wrapper methods calling into mm service. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (ft_var_load_item_variation_store, ft_var_load_delta_set_index_mapping, ft_var_get_item_delta, ft_var_done_item_variation_store, ft_var_done_delta_set_index_map): Renamed to ... (tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping, tt_var_get_item_delta, tt_var_done_item_variation_store, tt_var_done_delta_set_index_map): ... this for consistency. Mark them as non-static. * src/truetype/ttgxvar.h: Add corresponding prototypes. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.
2022-05-19 06:30:47 +02:00
(FT_Get_MM_Func) NULL, /* get_mm */
(FT_Set_MM_Design_Func) NULL, /* set_mm_design */
(FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */
(FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */
(FT_Get_MM_Var_Func) TT_Get_MM_Var, /* get_mm_var */
(FT_Set_Var_Design_Func)TT_Set_Var_Design, /* set_var_design */
(FT_Get_Var_Design_Func)TT_Get_Var_Design, /* get_var_design */
(FT_Set_Instance_Func) TT_Set_Named_Instance, /* set_instance */
(FT_Set_MM_WeightVector_Func)
NULL, /* set_mm_weightvector */
(FT_Get_MM_WeightVector_Func)
NULL, /* get_mm_weightvector */
(FT_Var_Load_Delta_Set_Idx_Map_Func)
tt_var_load_delta_set_index_mapping,
/* load_delta_set_idx_map */
(FT_Var_Load_Item_Var_Store_Func)
tt_var_load_item_variation_store,
/* load_item_variation_store */
(FT_Var_Get_Item_Delta_Func)
tt_var_get_item_delta, /* get_item_delta */
(FT_Var_Done_Item_Var_Store_Func)
tt_var_done_item_variation_store,
/* done_item_variation_store */
(FT_Var_Done_Delta_Set_Idx_Map_Func)
tt_var_done_delta_set_index_map,
/* done_delta_set_index_map */
(FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */
(FT_Done_Blend_Func) tt_done_blend /* done_blend */
)
FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
tt_service_metrics_variations,
(FT_HAdvance_Adjust_Func)tt_hadvance_adjust, /* hadvance_adjust */
(FT_LSB_Adjust_Func) NULL, /* lsb_adjust */
(FT_RSB_Adjust_Func) NULL, /* rsb_adjust */
(FT_VAdvance_Adjust_Func)tt_vadvance_adjust, /* vadvance_adjust */
(FT_TSB_Adjust_Func) NULL, /* tsb_adjust */
(FT_BSB_Adjust_Func) NULL, /* bsb_adjust */
(FT_VOrg_Adjust_Func) NULL, /* vorg_adjust */
(FT_Metrics_Adjust_Func) tt_apply_mvar /* metrics_adjust */
)
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
2015-10-30 08:07:56 +01:00
static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine =
{
#ifdef TT_USE_BYTECODE_INTERPRETER
FT_TRUETYPE_ENGINE_TYPE_PATENTED
#else /* !TT_USE_BYTECODE_INTERPRETER */
FT_TRUETYPE_ENGINE_TYPE_NONE
#endif /* TT_USE_BYTECODE_INTERPRETER */
};
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
2015-10-30 08:07:56 +01:00
2012-07-29 13:15:53 +02:00
FT_DEFINE_SERVICE_TTGLYFREC(
tt_service_truetype_glyf,
(TT_Glyf_GetLocationFunc)tt_face_get_location /* get_location */
)
2015-10-30 08:07:56 +01:00
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_DEFINE_SERVICEDESCREC6(
2012-07-29 13:15:53 +02:00
tt_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE,
FT_SERVICE_ID_MULTI_MASTERS, &tt_service_gx_multi_masters,
FT_SERVICE_ID_METRICS_VARIATIONS, &tt_service_metrics_variations,
FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
FT_SERVICE_ID_TT_GLYF, &tt_service_truetype_glyf,
FT_SERVICE_ID_PROPERTIES, &tt_service_properties )
#else
FT_DEFINE_SERVICEDESCREC4(
2012-07-29 13:15:53 +02:00
tt_services,
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TRUETYPE,
FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
FT_SERVICE_ID_TT_GLYF, &tt_service_truetype_glyf,
FT_SERVICE_ID_PROPERTIES, &tt_service_properties )
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17. * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. Use FT_BEGIN_HEADER and FT_END_HEADER. Use FT_LOCAL. 2004-04-24 George Williams <gww@silcom.com> Add support for Apple's distortable font technology (in GX fonts). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var): New structures. (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New function declarations. * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, FT_Set_Var_Design_Func): New typedefs. Update MultiMasters service. * include/freetype/internal/tttypes.h [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' and `blend'. * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New macros. * include/freetype/internal/fttrace.h: Add `ttgxvar'. * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): New functions. * src/sfnt/sfobjs.c (sfnt_load_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS flag for GX var fonts. * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.c. * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New service. (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_done_blend. * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call tt_face_vary_cvt. * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var and T1_Set_Var_Design. * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. (T1_Get_MM_Var, T1_Set_Var_Design): New functions. * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New function declarations.
2004-04-25 22:15:11 +02:00
#endif
2012-07-29 13:15:53 +02:00
* src/truetype/ttobjs.c (tt_driver_done): Fix typo. * src/bdf/bdfdrivr.c (BDF_Face_Done, BDF_Face_Init, BDF_Set_Pixel_Size): Don't use BDF_XXX but FT_XXX arguments which are typecast to the proper BDF_XXX types within the function. Update code accordingly. Use FT_CALLBACK_DEF throughout. (BDF_Set_Point_Size): New wrapper function. (bdf_driver_class): Remove casts. * src/cff/cffdrivr.c (Get_Kerning, Load_Glyph, cff_get_interface): Don't use CFF_XXX but FT_XXX arguments which are typecast to the proper CFF_XXX types within the function. Update code accordingly. Use FT_CALLBACK_DEF throughout. (cff_driver_class): Remove casts. * src/cff/cffobjs.h, src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset, cff_slot_done, cff_slot_init, cff_face_init, cff_face_done, cff_driver_init, cff_driver_done): Don't use CFF_XXX but FT_XXX arguments which are typecast to the proper CFF_XXX types within the function. Update code accordingly. (cff_point_size_reset): New wrapper function. * src/cid/cidobjs.h, src/cid/cidobjs.c (cid_slot_done, cid_slot_init, cid_size_done, cid_size_init, cid_size_reset, cid_face_done, cid_face_init, cid_driver_init, cid_driver_done): Don't use CID_XXX but FT_XXX arguments which are typecast to the proper CID_XXX types within the function. Update code accordingly. (cid_point_size_reset): New wrapper function. * src/cid/cidgload.c, src/cid/cidgload.h (cid_slot_load_glyph): Don't use CID_XXX but FT_XXX arguments which are typecast to the proper CID_XXX types within the function. Update code accordingly. * src/cid/cidriver.c (cid_get_interface): Don't use CID_XXX but FT_XXX arguments which are typecast to the proper CID_XXX types within the function. Update code accordingly. Use FT_CALLBACK_DEF. (t1cid_driver_class): Remove casts. * src/truetype/ttdriver.c (tt_get_interface): Use FT_CALLBACK_DEF. * src/truetype/ttgxvar.c (ft_var_load_avar): Don't free non-local variables (this is done later). (ft_var_load_avar): Fix call to FT_FRAME_ENTER. (TT_Get_MM_Var): Fix size for `fvar_fields'. (TT_Vary_Get_Glyph_Deltas): Handle deallocation of local variables correctly. * src/base/ftdbgmem.c (ft_mem_debug_realloc): Don't abort if current size is zero.
2004-05-06 13:48:35 +02:00
FT_CALLBACK_DEF( FT_Module_Interface )
tt_get_interface( FT_Module driver, /* TT_Driver */
const char* tt_interface )
{
FT_Library library;
FT_Module_Interface result;
FT_Module sfntd;
SFNT_Service sfnt;
result = ft_service_list_lookup( tt_services, tt_interface );
if ( result )
return result;
2000-06-25 08:47:11 +02:00
if ( !driver )
return NULL;
library = driver->library;
if ( !library )
return NULL;
/* only return the default interface from the SFNT module */
sfntd = FT_Get_Module( library, "sfnt" );
if ( sfntd )
{
sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
if ( sfnt )
return sfnt->get_interface( driver, tt_interface );
}
return 0;
}
1999-12-17 00:11:37 +01:00
/* The FT_DriverInterface structure is defined in ftdriver.h. */
#ifdef TT_USE_BYTECODE_INTERPRETER
2012-07-29 13:15:53 +02:00
#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER
#else
2012-07-29 13:15:53 +02:00
#define TT_HINTER_FLAG 0
2000-10-31 21:42:18 +01:00
#endif
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
2012-07-29 13:15:53 +02:00
#define TT_SIZE_SELECT tt_size_select
#else
2012-07-29 13:15:53 +02:00
#define TT_SIZE_SELECT 0
#endif
FT_DEFINE_DRIVER(
tt_driver_class,
2011-11-30 10:46:53 +01:00
FT_MODULE_FONT_DRIVER |
FT_MODULE_DRIVER_SCALABLE |
TT_HINTER_FLAG,
- MAJOR INTERNAL REDESIGN: A lot of internal modifications have been performed lately on the source in order to provide the following enhancements: - more generic module support: The FT_Module type is now defined to represent a handle to a given module. The file <freetype/ftmodule.h> contains the FT_Module_Class definition, as well as the module-loading public API The FT_Driver type is still defined, and still represents a pointer to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module, FT_Get_Driver by FT_Get_Module, etc.. - support for generic glyph image types: The FT_Renderer type is a pointer to a module used to perform various operations on glyph image. Each renderer is capable of handling images in a single format (e.g. ft_glyph_format_outline). Its functions are used to: - transform an glyph image - render a glyph image into a bitmap - return the control box (dimensions) of a given glyph image The scan converters "ftraster.c" and "ftgrays.c" have been moved to the new directory "src/renderer", and are used to provide two default renderer modules. One corresponds to the "standard" scan-converter, the other to the "smooth" one. The current renderer can be set through the new function FT_Set_Renderer. The old raster-related function FT_Set_Raster, FT_Get_Raster and FT_Set_Raster_Mode have now disappeared, in favor of the new: FT_Get_Renderer FT_Set_Renderer see the file <freetype/ftrender.h> for more details.. These changes were necessary to properly support different scalable formats in the future, like bi-color glyphs, etc.. - glyph loader object: A new internal object, called a 'glyph loader' has been introduced in the base layer. It is used by all scalable format font drivers to load glyphs and composites. This object has been created to reduce the code size of each driver, as each one of them basically re-implemented its functionality. See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for more information.. - FT_GlyphSlot had new fields: In order to support extended features (see below), the FT_GlyphSlot structure has a few new fields: linearHoriAdvance: this field gives the linearly scaled (i.e. scaled but unhinted) advance width for the glyph, expressed as a 16.16 fixed pixel value. This is useful to perform WYSIWYG text. linearVertAdvance: this field gives the linearly scaled advance height for the glyph (relevant in vertical glyph layouts only). This is useful to perform WYSIWYG text. Note that the two above field replace the removed "metrics2" field in the glyph slot. advance: this field is a vector that gives the transformed advance for the glyph. By default, it corresponds to the advance width, unless FT_LOAD_VERTICAL_LAYOUT was specified when calling FT_Load_Glyph or FT_Load_Char bitmap_left: this field gives the distance in integer pixels from the current pen position to the left-most pixel of a glyph image WHEN IT IS A BITMAP. It is only valid when the "format" field is set to "ft_glyph_format_bitmap", for example, after calling the new function FT_Render_Glyph. bitmap_top: this field gives the distance in integer pixels from the current pen position (located on the baseline) to the top-most pixel of the glyph image WHEN IT IS A BITMAP. Positive values correspond to upwards Y. loader: this is a new private field for the glyph slot. Client applications should not touch it.. - support for transforms and direct rendering in FT_Load_Glyph: Most of the functionality found in <freetype/ftglyph.h> has been moved to the core library. Hence, the following: - a transform can be specified for a face through FT_Set_Transform. this transform is applied by FT_Load_Glyph to scalable glyph images (i.e. NOT TO BITMAPS) before the function returns, unless the bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags.. - once a glyph image has been loaded, it can be directly converted to a bitmap by using the new FT_Render_Glyph function. Note that this function takes the glyph image from the glyph slot, and converts it to a bitmap whose properties are returned in "face.glyph.bitmap", "face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original native image might be lost after the conversion. - when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph and FT_Load_Char functions will call FT_Render_Glyph automatically when needed.
2000-06-22 02:17:42 +02:00
sizeof ( TT_DriverRec ),
- MAJOR INTERNAL REDESIGN: A lot of internal modifications have been performed lately on the source in order to provide the following enhancements: - more generic module support: The FT_Module type is now defined to represent a handle to a given module. The file <freetype/ftmodule.h> contains the FT_Module_Class definition, as well as the module-loading public API The FT_Driver type is still defined, and still represents a pointer to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module, FT_Get_Driver by FT_Get_Module, etc.. - support for generic glyph image types: The FT_Renderer type is a pointer to a module used to perform various operations on glyph image. Each renderer is capable of handling images in a single format (e.g. ft_glyph_format_outline). Its functions are used to: - transform an glyph image - render a glyph image into a bitmap - return the control box (dimensions) of a given glyph image The scan converters "ftraster.c" and "ftgrays.c" have been moved to the new directory "src/renderer", and are used to provide two default renderer modules. One corresponds to the "standard" scan-converter, the other to the "smooth" one. The current renderer can be set through the new function FT_Set_Renderer. The old raster-related function FT_Set_Raster, FT_Get_Raster and FT_Set_Raster_Mode have now disappeared, in favor of the new: FT_Get_Renderer FT_Set_Renderer see the file <freetype/ftrender.h> for more details.. These changes were necessary to properly support different scalable formats in the future, like bi-color glyphs, etc.. - glyph loader object: A new internal object, called a 'glyph loader' has been introduced in the base layer. It is used by all scalable format font drivers to load glyphs and composites. This object has been created to reduce the code size of each driver, as each one of them basically re-implemented its functionality. See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for more information.. - FT_GlyphSlot had new fields: In order to support extended features (see below), the FT_GlyphSlot structure has a few new fields: linearHoriAdvance: this field gives the linearly scaled (i.e. scaled but unhinted) advance width for the glyph, expressed as a 16.16 fixed pixel value. This is useful to perform WYSIWYG text. linearVertAdvance: this field gives the linearly scaled advance height for the glyph (relevant in vertical glyph layouts only). This is useful to perform WYSIWYG text. Note that the two above field replace the removed "metrics2" field in the glyph slot. advance: this field is a vector that gives the transformed advance for the glyph. By default, it corresponds to the advance width, unless FT_LOAD_VERTICAL_LAYOUT was specified when calling FT_Load_Glyph or FT_Load_Char bitmap_left: this field gives the distance in integer pixels from the current pen position to the left-most pixel of a glyph image WHEN IT IS A BITMAP. It is only valid when the "format" field is set to "ft_glyph_format_bitmap", for example, after calling the new function FT_Render_Glyph. bitmap_top: this field gives the distance in integer pixels from the current pen position (located on the baseline) to the top-most pixel of the glyph image WHEN IT IS A BITMAP. Positive values correspond to upwards Y. loader: this is a new private field for the glyph slot. Client applications should not touch it.. - support for transforms and direct rendering in FT_Load_Glyph: Most of the functionality found in <freetype/ftglyph.h> has been moved to the core library. Hence, the following: - a transform can be specified for a face through FT_Set_Transform. this transform is applied by FT_Load_Glyph to scalable glyph images (i.e. NOT TO BITMAPS) before the function returns, unless the bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags.. - once a glyph image has been loaded, it can be directly converted to a bitmap by using the new FT_Render_Glyph function. Note that this function takes the glyph image from the glyph slot, and converts it to a bitmap whose properties are returned in "face.glyph.bitmap", "face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original native image might be lost after the conversion. - when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph and FT_Load_Char functions will call FT_Render_Glyph automatically when needed.
2000-06-22 02:17:42 +02:00
"truetype", /* driver name */
2000-06-25 08:47:11 +02:00
0x10000L, /* driver version == 1.0 */
0x20000L, /* driver requires FreeType 2.0 or above */
NULL, /* module-specific interface */
2015-10-19 08:49:25 +02:00
tt_driver_init, /* FT_Module_Constructor module_init */
tt_driver_done, /* FT_Module_Destructor module_done */
tt_get_interface, /* FT_Module_Requester get_interface */
1999-12-17 00:11:37 +01:00
sizeof ( TT_FaceRec ),
sizeof ( TT_SizeRec ),
sizeof ( FT_GlyphSlotRec ),
2015-10-19 08:49:25 +02:00
tt_face_init, /* FT_Face_InitFunc init_face */
tt_face_done, /* FT_Face_DoneFunc done_face */
tt_size_init, /* FT_Size_InitFunc init_size */
tt_size_done, /* FT_Size_DoneFunc done_size */
tt_slot_init, /* FT_Slot_InitFunc init_slot */
NULL, /* FT_Slot_DoneFunc done_slot */
1999-12-17 00:11:37 +01:00
2015-10-19 08:49:25 +02:00
tt_glyph_load, /* FT_Slot_LoadFunc load_glyph */
2003-10-23 06:54:14 +02:00
2015-10-19 08:49:25 +02:00
tt_get_kerning, /* FT_Face_GetKerningFunc get_kerning */
NULL, /* FT_Face_AttachFunc attach_file */
2015-10-19 08:49:25 +02:00
tt_get_advances, /* FT_Face_GetAdvancesFunc get_advances */
2015-10-19 08:49:25 +02:00
tt_size_request, /* FT_Size_RequestFunc request_size */
TT_SIZE_SELECT /* FT_Size_SelectFunc select_size */
)
1999-12-17 00:11:37 +01:00
/* END */