1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ttgload.c */
|
|
|
|
/* */
|
|
|
|
/* TrueType Glyph Loader (body). */
|
|
|
|
/* */
|
2016-01-13 11:54:10 +01:00
|
|
|
/* Copyright 1996-2016 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* 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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_INTERNAL_CALC_H
|
|
|
|
#include FT_INTERNAL_STREAM_H
|
|
|
|
#include FT_INTERNAL_SFNT_H
|
|
|
|
#include FT_TRUETYPE_TAGS_H
|
|
|
|
#include FT_OUTLINE_H
|
2013-05-17 13:51:07 +02:00
|
|
|
#include FT_TRUETYPE_DRIVER_H
|
2015-11-04 11:44:47 +01:00
|
|
|
#include FT_LIST_H
|
2000-12-08 03:42:29 +01:00
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttgload.h"
|
2005-03-03 18:09:08 +01:00
|
|
|
#include "ttpload.h"
|
2000-06-12 21:36: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 "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"
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
#include "ttsubpix.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
|
|
|
|
2000-07-08 02:41:13 +02:00
|
|
|
|
2000-06-12 21:36:41 +02: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 trace_ttgload
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2011-03-21 09:28:52 +01:00
|
|
|
/* Composite glyph flags. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-08-16 14:46:52 +02:00
|
|
|
#define ARGS_ARE_WORDS 0x0001
|
|
|
|
#define ARGS_ARE_XY_VALUES 0x0002
|
|
|
|
#define ROUND_XY_TO_GRID 0x0004
|
|
|
|
#define WE_HAVE_A_SCALE 0x0008
|
|
|
|
/* reserved 0x0010 */
|
|
|
|
#define MORE_COMPONENTS 0x0020
|
|
|
|
#define WE_HAVE_AN_XY_SCALE 0x0040
|
|
|
|
#define WE_HAVE_A_2X2 0x0080
|
|
|
|
#define WE_HAVE_INSTR 0x0100
|
|
|
|
#define USE_MY_METRICS 0x0200
|
|
|
|
#define OVERLAP_COMPOUND 0x0400
|
|
|
|
#define SCALED_COMPONENT_OFFSET 0x0800
|
|
|
|
#define UNSCALED_COMPONENT_OFFSET 0x1000
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
2011-04-21 08:21:37 +02:00
|
|
|
/* Return the horizontal metrics in font units for a given glyph. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2009-11-02 08:35:24 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* include/freetype/ftadvanc.h, src/base/ftadvanc.c,
include/freetype/config/ftheader.h, include/freetype/freetype.h,
src/base/Jamfile, src/base/rules.mk, src/cff/cffdrivr.c,
src/cff/cffgload.c, src/cff/cffgload.h, src/truetype/ttdriver.c,
src/truetype/ttgload.h, src/truetype/ttgload.c, src/type1/t1driver.c,
src/type1/t1gload.h, src/type1/t1gload.c:
Add a new header named FT_ADVANCES_H declaring some new APIs
to extract the advances of one or more glyphs without necessarily
loading their outlines. Also provide 'fast loaders' for the
TrueType, Type1 and CFF font drivers (more to come later)
* autogen.sh: add checks for minimum version of the 'autotools'
stuff.
2008-09-01 23:35:21 +02:00
|
|
|
TT_Get_HMetrics( TT_Face face,
|
|
|
|
FT_UInt idx,
|
|
|
|
FT_Short* lsb,
|
|
|
|
FT_UShort* aw )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
Clean up the SFNT_Interface. Table loading functions are now named
after the tables' tags; `hdmx' is TrueType-specific and thus the code
is moved to the truetype module; `get_metrics' is moved here from the
truetype module so that the code can be shared with the cff module.
This pass involves no real changes. That is, the code is moved
verbatim mostly. The only exception is the return value of
`tt_face_get_metrics'.
* include/freetype/internal/sfnt.h, src/sfnt/rules.mk,
src/sfnt/sfdriver.c, src/sfnt/sfnt.c, src/sfnt/sfobjs.c,
src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttsbit.c,
src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: Clean up the SFNT_Interface.
* src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Metrics-related tables' loading
and parsing code is moved here.
Move `tt_face_get_metrics' here from the truetype module. The return
value is changed from `void' to `FT_Error'.
* include/freetype/internal/fttrace.h: New trace: ttmtx.
* src/truetype/ttpload.c, src/truetype/ttpload.h: `hdmx' loading and
parsing code is moved here.
New function `tt_face_load_prep' splitted from `tt_face_load_fpgm'.
`tt_face_load_fpgm' returns `FT_Err_Ok' if `fpgm' doesn't exist.
* src/cff/cffgload.c, src/cff/cffobjs.c: Update.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Update.
2006-02-14 07:40:10 +01:00
|
|
|
( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2009-11-15 10:10:00 +01:00
|
|
|
FT_TRACE5(( " advance width (font units): %d\n", *aw ));
|
|
|
|
FT_TRACE5(( " left side bearing (font units): %d\n", *lsb ));
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2011-04-21 08:21:37 +02:00
|
|
|
/* Return the vertical metrics in font units for a given glyph. */
|
2013-11-06 07:14:49 +01:00
|
|
|
/* See macro `TT_LOADER_SET_PP' below for explanations. */
|
2004-03-27 09:43:17 +01:00
|
|
|
/* */
|
2009-11-02 08:35:24 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* include/freetype/ftadvanc.h, src/base/ftadvanc.c,
include/freetype/config/ftheader.h, include/freetype/freetype.h,
src/base/Jamfile, src/base/rules.mk, src/cff/cffdrivr.c,
src/cff/cffgload.c, src/cff/cffgload.h, src/truetype/ttdriver.c,
src/truetype/ttgload.h, src/truetype/ttgload.c, src/type1/t1driver.c,
src/type1/t1gload.h, src/type1/t1gload.c:
Add a new header named FT_ADVANCES_H declaring some new APIs
to extract the advances of one or more glyphs without necessarily
loading their outlines. Also provide 'fast loaders' for the
TrueType, Type1 and CFF font drivers (more to come later)
* autogen.sh: add checks for minimum version of the 'autotools'
stuff.
2008-09-01 23:35:21 +02:00
|
|
|
TT_Get_VMetrics( TT_Face face,
|
|
|
|
FT_UInt idx,
|
2013-11-06 07:14:49 +01:00
|
|
|
FT_Pos yMax,
|
* include/freetype/ftadvanc.h, src/base/ftadvanc.c,
include/freetype/config/ftheader.h, include/freetype/freetype.h,
src/base/Jamfile, src/base/rules.mk, src/cff/cffdrivr.c,
src/cff/cffgload.c, src/cff/cffgload.h, src/truetype/ttdriver.c,
src/truetype/ttgload.h, src/truetype/ttgload.c, src/type1/t1driver.c,
src/type1/t1gload.h, src/type1/t1gload.c:
Add a new header named FT_ADVANCES_H declaring some new APIs
to extract the advances of one or more glyphs without necessarily
loading their outlines. Also provide 'fast loaders' for the
TrueType, Type1 and CFF font drivers (more to come later)
* autogen.sh: add checks for minimum version of the 'autotools'
stuff.
2008-09-01 23:35:21 +02:00
|
|
|
FT_Short* tsb,
|
|
|
|
FT_UShort* ah )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
|
|
|
if ( face->vertical_info )
|
Clean up the SFNT_Interface. Table loading functions are now named
after the tables' tags; `hdmx' is TrueType-specific and thus the code
is moved to the truetype module; `get_metrics' is moved here from the
truetype module so that the code can be shared with the cff module.
This pass involves no real changes. That is, the code is moved
verbatim mostly. The only exception is the return value of
`tt_face_get_metrics'.
* include/freetype/internal/sfnt.h, src/sfnt/rules.mk,
src/sfnt/sfdriver.c, src/sfnt/sfnt.c, src/sfnt/sfobjs.c,
src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttsbit.c,
src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: Clean up the SFNT_Interface.
* src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: Metrics-related tables' loading
and parsing code is moved here.
Move `tt_face_get_metrics' here from the truetype module. The return
value is changed from `void' to `FT_Error'.
* include/freetype/internal/fttrace.h: New trace: ttmtx.
* src/truetype/ttpload.c, src/truetype/ttpload.h: `hdmx' loading and
parsing code is moved here.
New function `tt_face_load_prep' splitted from `tt_face_load_fpgm'.
`tt_face_load_fpgm' returns `FT_Err_Ok' if `fpgm' doesn't exist.
* src/cff/cffgload.c, src/cff/cffobjs.c: Update.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Update.
2006-02-14 07:40:10 +01:00
|
|
|
( (SFNT_Service)face->sfnt )->get_metrics( face, 1, idx, tsb, ah );
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
else if ( face->os2.version != 0xFFFFU )
|
|
|
|
{
|
2014-06-13 09:28:00 +02:00
|
|
|
*tsb = (FT_Short)( face->os2.sTypoAscender - yMax );
|
2015-02-17 08:03:05 +01:00
|
|
|
*ah = (FT_UShort)FT_ABS( face->os2.sTypoAscender -
|
|
|
|
face->os2.sTypoDescender );
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
2013-11-06 07:14:49 +01:00
|
|
|
|
2004-06-21 23:16:56 +02:00
|
|
|
else
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
2014-06-13 09:28:00 +02:00
|
|
|
*tsb = (FT_Short)( face->horizontal.Ascender - yMax );
|
2015-02-17 08:03:05 +01:00
|
|
|
*ah = (FT_UShort)FT_ABS( face->horizontal.Ascender -
|
|
|
|
face->horizontal.Descender );
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
|
2009-11-15 10:10:00 +01:00
|
|
|
FT_TRACE5(( " advance height (font units): %d\n", *ah ));
|
|
|
|
FT_TRACE5(( " top side bearing (font units): %d\n", *tsb ));
|
2004-03-27 09:43:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-12 08:55:26 +01:00
|
|
|
static FT_Error
|
2009-11-03 08:11:02 +01:00
|
|
|
tt_get_metrics( TT_Loader loader,
|
|
|
|
FT_UInt glyph_index )
|
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
TT_Face face = loader->face;
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2013-05-17 13:51:07 +02:00
|
|
|
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
|
|
|
#endif
|
2009-11-03 08:11:02 +01:00
|
|
|
|
2013-11-12 08:55:26 +01:00
|
|
|
FT_Error error;
|
|
|
|
FT_Stream stream = loader->stream;
|
|
|
|
|
2009-11-03 08:11:02 +01:00
|
|
|
FT_Short left_bearing = 0, top_bearing = 0;
|
|
|
|
FT_UShort advance_width = 0, advance_height = 0;
|
|
|
|
|
2013-11-12 08:55:26 +01:00
|
|
|
/* we must preserve the stream position */
|
|
|
|
/* (which gets altered by the metrics functions) */
|
|
|
|
FT_ULong pos = FT_STREAM_POS();
|
|
|
|
|
2009-11-03 08:11:02 +01:00
|
|
|
|
|
|
|
TT_Get_HMetrics( face, glyph_index,
|
|
|
|
&left_bearing,
|
|
|
|
&advance_width );
|
|
|
|
TT_Get_VMetrics( face, glyph_index,
|
2013-11-06 07:14:49 +01:00
|
|
|
loader->bbox.yMax,
|
2009-11-03 08:11:02 +01:00
|
|
|
&top_bearing,
|
|
|
|
&advance_height );
|
|
|
|
|
2013-11-12 08:55:26 +01:00
|
|
|
if ( FT_STREAM_SEEK( pos ) )
|
|
|
|
return error;
|
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
loader->left_bearing = left_bearing;
|
|
|
|
loader->advance = advance_width;
|
|
|
|
loader->top_bearing = top_bearing;
|
|
|
|
loader->vadvance = advance_height;
|
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2015-05-22 22:02:15 +02:00
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
|
|
|
loader->exec )
|
2013-05-17 13:51:07 +02:00
|
|
|
{
|
2015-05-22 22:02:15 +02:00
|
|
|
loader->exec->sph_tweak_flags = 0;
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2015-05-22 22:02:15 +02:00
|
|
|
/* This may not be the right place for this, but it works... */
|
|
|
|
/* Note that we have to unconditionally load the tweaks since */
|
|
|
|
/* it is possible that glyphs individually switch ClearType's */
|
|
|
|
/* backwards compatibility mode on and off. */
|
|
|
|
sph_set_tweaks( loader, glyph_index );
|
2013-05-17 13:51:07 +02:00
|
|
|
}
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
if ( !loader->linear_def )
|
|
|
|
{
|
|
|
|
loader->linear_def = 1;
|
|
|
|
loader->linear = advance_width;
|
|
|
|
}
|
2013-11-12 08:55:26 +01:00
|
|
|
|
|
|
|
return FT_Err_Ok;
|
2010-02-18 17:09:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-03 08:11:02 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
static void
|
|
|
|
tt_get_metrics_incr_overrides( TT_Loader loader,
|
|
|
|
FT_UInt glyph_index )
|
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
TT_Face face = loader->face;
|
2010-02-18 17:09:30 +01:00
|
|
|
|
|
|
|
FT_Short left_bearing = 0, top_bearing = 0;
|
|
|
|
FT_UShort advance_width = 0, advance_height = 0;
|
|
|
|
|
|
|
|
|
2010-02-10 07:02:43 +01:00
|
|
|
/* If this is an incrementally loaded font check whether there are */
|
|
|
|
/* overriding metrics for this glyph. */
|
|
|
|
if ( face->root.internal->incremental_interface &&
|
2009-11-03 08:11:02 +01:00
|
|
|
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
|
|
|
|
{
|
|
|
|
FT_Incremental_MetricsRec metrics;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
metrics.bearing_x = loader->left_bearing;
|
2009-11-03 08:11:02 +01:00
|
|
|
metrics.bearing_y = 0;
|
2010-02-18 17:09:30 +01:00
|
|
|
metrics.advance = loader->advance;
|
2010-02-10 07:02:43 +01:00
|
|
|
metrics.advance_v = 0;
|
2009-11-03 08:11:02 +01:00
|
|
|
|
|
|
|
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
glyph_index, FALSE, &metrics );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
left_bearing = (FT_Short)metrics.bearing_x;
|
|
|
|
advance_width = (FT_UShort)metrics.advance;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
/* GWW: Do I do the same for vertical metrics? */
|
|
|
|
metrics.bearing_x = 0;
|
2010-02-18 17:09:30 +01:00
|
|
|
metrics.bearing_y = loader->top_bearing;
|
|
|
|
metrics.advance = loader->vadvance;
|
2009-11-03 08:11:02 +01:00
|
|
|
|
|
|
|
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
glyph_index, TRUE, &metrics );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
top_bearing = (FT_Short)metrics.bearing_y;
|
|
|
|
advance_height = (FT_UShort)metrics.advance;
|
|
|
|
|
|
|
|
#endif /* 0 */
|
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
loader->left_bearing = left_bearing;
|
|
|
|
loader->advance = advance_width;
|
|
|
|
loader->top_bearing = top_bearing;
|
|
|
|
loader->vadvance = advance_height;
|
|
|
|
|
|
|
|
if ( !loader->linear_def )
|
|
|
|
{
|
|
|
|
loader->linear_def = 1;
|
|
|
|
loader->linear = advance_width;
|
|
|
|
}
|
2009-11-03 08:11:02 +01:00
|
|
|
}
|
|
|
|
|
2009-12-03 05:57:30 +01:00
|
|
|
Exit:
|
2010-02-18 17:09:30 +01:00
|
|
|
return;
|
|
|
|
}
|
2009-12-03 05:57:30 +01:00
|
|
|
|
2009-11-03 08:11:02 +01:00
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
|
|
|
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2002-04-01 16:25:28 +02:00
|
|
|
/* The following functions are used by default with TrueType fonts. */
|
|
|
|
/* However, they can be replaced by alternatives if we need to support */
|
|
|
|
/* TrueType-compressed formats (like MicroType) in the future. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2000-06-25 08:47:11 +02:00
|
|
|
/*************************************************************************/
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Access_Glyph_Frame( TT_Loader loader,
|
|
|
|
FT_UInt glyph_index,
|
|
|
|
FT_ULong offset,
|
|
|
|
FT_UInt byte_count )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Stream stream = loader->stream;
|
|
|
|
|
2000-08-29 20:58:41 +02:00
|
|
|
/* for non-debug mode */
|
|
|
|
FT_UNUSED( glyph_index );
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2010-06-29 12:31:08 +02:00
|
|
|
FT_TRACE4(( "Glyph %ld\n", glyph_index ));
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
/* the following line sets the `error' variable through macros! */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( byte_count ) )
|
2000-07-31 20:59:02 +02:00
|
|
|
return error;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
loader->cursor = stream->cursor;
|
|
|
|
loader->limit = stream->limit;
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-07-05 06:32:02 +02:00
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( void )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Forget_Glyph_Frame( TT_Loader loader )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
|
|
|
FT_Stream stream = loader->stream;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
2000-07-05 06:32:02 +02:00
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Load_Glyph_Header( TT_Loader loader )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2006-05-18 00:55:04 +02:00
|
|
|
FT_Byte* p = loader->cursor;
|
|
|
|
FT_Byte* limit = loader->limit;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-01-06 17:42:44 +01:00
|
|
|
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
if ( p + 10 > limit )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Outline );
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
loader->n_contours = FT_NEXT_SHORT( p );
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
loader->bbox.xMin = FT_NEXT_SHORT( p );
|
|
|
|
loader->bbox.yMin = FT_NEXT_SHORT( p );
|
|
|
|
loader->bbox.xMax = FT_NEXT_SHORT( p );
|
|
|
|
loader->bbox.yMax = FT_NEXT_SHORT( p );
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
FT_TRACE5(( " # of contours: %d\n", loader->n_contours ));
|
|
|
|
FT_TRACE5(( " xMin: %4d xMax: %4d\n", loader->bbox.xMin,
|
|
|
|
loader->bbox.xMax ));
|
|
|
|
FT_TRACE5(( " yMin: %4d yMax: %4d\n", loader->bbox.yMin,
|
|
|
|
loader->bbox.yMax ));
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
loader->cursor = p;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-07-05 06:32:02 +02:00
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Load_Simple_Glyph( TT_Loader load )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Error error;
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
FT_Byte* p = load->cursor;
|
|
|
|
FT_Byte* limit = load->limit;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_GlyphLoader gloader = load->gloader;
|
|
|
|
FT_Int n_contours = load->n_contours;
|
|
|
|
FT_Outline* outline;
|
2013-12-02 07:51:17 +01:00
|
|
|
FT_UShort n_ins;
|
2007-06-11 02:55:23 +02:00
|
|
|
FT_Int n_points;
|
2013-11-20 21:06:18 +01:00
|
|
|
FT_ULong tmp;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_Byte *flag, *flag_limit;
|
|
|
|
FT_Byte c, count;
|
|
|
|
FT_Vector *vec, *vec_limit;
|
|
|
|
FT_Pos x;
|
2007-06-16 19:07:20 +02:00
|
|
|
FT_Short *cont, *cont_limit, prev_cont;
|
2007-06-11 02:18:00 +02:00
|
|
|
FT_Int xy_size = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* check that we can add the contours to the glyph */
|
2005-10-28 18:14:14 +02:00
|
|
|
error = FT_GLYPHLOADER_CHECK_POINTS( gloader, 0, n_contours );
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
|
|
|
|
* 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
|
|
|
/* reading the contours' endpoints & number of points */
|
2003-06-09 17:54:18 +02:00
|
|
|
cont = gloader->current.outline.contours;
|
|
|
|
cont_limit = cont + n_contours;
|
2002-01-06 17:42:44 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
/* check space for contours array + instructions count */
|
2007-06-17 07:31:23 +02:00
|
|
|
if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )
|
2003-06-09 17:54:18 +02:00
|
|
|
goto Invalid_Outline;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2012-03-02 16:09:51 +01:00
|
|
|
prev_cont = FT_NEXT_SHORT( p );
|
2008-05-17 22:06:13 +02:00
|
|
|
|
|
|
|
if ( n_contours > 0 )
|
|
|
|
cont[0] = prev_cont;
|
|
|
|
|
2012-03-02 16:09:51 +01:00
|
|
|
if ( prev_cont < 0 )
|
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2007-06-16 19:07:20 +02:00
|
|
|
for ( cont++; cont < cont_limit; cont++ )
|
|
|
|
{
|
2012-03-02 16:09:51 +01:00
|
|
|
cont[0] = FT_NEXT_SHORT( p );
|
2007-06-23 00:22:38 +02:00
|
|
|
if ( cont[0] <= prev_cont )
|
2007-06-16 19:07:20 +02:00
|
|
|
{
|
2007-06-17 07:31:23 +02:00
|
|
|
/* unordered contours: this is invalid */
|
2012-02-29 17:29:07 +01:00
|
|
|
goto Invalid_Outline;
|
2007-06-16 19:07:20 +02:00
|
|
|
}
|
|
|
|
prev_cont = cont[0];
|
|
|
|
}
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
n_points = 0;
|
|
|
|
if ( n_contours > 0 )
|
2007-05-16 17:48:02 +02:00
|
|
|
{
|
2003-06-09 17:54:18 +02:00
|
|
|
n_points = cont[-1] + 1;
|
2007-05-16 17:48:02 +02:00
|
|
|
if ( n_points < 0 )
|
|
|
|
goto Invalid_Outline;
|
|
|
|
}
|
- 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
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* note that we will add four phantom points later */
|
2005-10-28 18:14:14 +02:00
|
|
|
error = FT_GLYPHLOADER_CHECK_POINTS( gloader, n_points + 4, 0 );
|
2003-06-09 17:54:18 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the bytecode instructions */
|
2005-08-16 03:54:59 +02:00
|
|
|
load->glyph->control_len = 0;
|
2015-04-12 05:54:19 +02:00
|
|
|
load->glyph->control_data = NULL;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
if ( p + 2 > limit )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
n_ins = FT_NEXT_USHORT( p );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_TRACE5(( " Instructions size: %u\n", n_ins ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2013-11-20 21:06:18 +01:00
|
|
|
/* check it */
|
2006-05-18 00:55:04 +02:00
|
|
|
if ( ( limit - p ) < n_ins )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "TT_Load_Simple_Glyph: instruction count mismatch\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Too_Many_Hints );
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( IS_HINTED( load->load_flags ) )
|
2000-02-21 17:01:33 +01:00
|
|
|
{
|
2013-12-02 07:51:17 +01:00
|
|
|
/* we don't trust `maxSizeOfInstructions' in the `maxp' table */
|
|
|
|
/* and thus update the bytecode array size by ourselves */
|
|
|
|
|
|
|
|
tmp = load->exec->glyphSize;
|
|
|
|
error = Update_Max( load->exec->memory,
|
|
|
|
&tmp,
|
|
|
|
sizeof ( FT_Byte ),
|
|
|
|
(void*)&load->exec->glyphIns,
|
|
|
|
n_ins );
|
|
|
|
|
|
|
|
load->exec->glyphSize = (FT_UShort)tmp;
|
|
|
|
if ( error )
|
|
|
|
return error;
|
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
load->glyph->control_len = n_ins;
|
|
|
|
load->glyph->control_data = load->exec->glyphIns;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2016-03-22 08:26:55 +01:00
|
|
|
if ( n_ins )
|
|
|
|
FT_MEM_COPY( load->exec->glyphIns, p, (FT_Long)n_ins );
|
2000-02-21 17:01:33 +01:00
|
|
|
}
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
p += n_ins;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2012-02-29 17:29:07 +01:00
|
|
|
outline = &gloader->current.outline;
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the point tags */
|
2003-06-09 17:54:18 +02:00
|
|
|
flag = (FT_Byte*)outline->tags;
|
|
|
|
flag_limit = flag + n_points;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-10-13 07:15:44 +02:00
|
|
|
FT_ASSERT( flag != NULL );
|
|
|
|
|
2003-12-31 09:48:21 +01:00
|
|
|
while ( flag < flag_limit )
|
2003-06-09 17:54:18 +02:00
|
|
|
{
|
2006-05-18 00:55:04 +02:00
|
|
|
if ( p + 1 > limit )
|
2003-06-09 17:54:18 +02:00
|
|
|
goto Invalid_Outline;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
*flag++ = c = FT_NEXT_BYTE( p );
|
2003-06-09 17:54:18 +02:00
|
|
|
if ( c & 8 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2006-05-18 00:55:04 +02:00
|
|
|
if ( p + 1 > limit )
|
2002-01-06 11:13:40 +01:00
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
count = FT_NEXT_BYTE( p );
|
2003-06-09 17:54:18 +02:00
|
|
|
if ( flag + (FT_Int)count > flag_limit )
|
|
|
|
goto Invalid_Outline;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
for ( ; count > 0; count-- )
|
|
|
|
*flag++ = c;
|
2002-01-06 11:13:40 +01:00
|
|
|
}
|
2003-06-09 17:54:18 +02:00
|
|
|
}
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the X coordinates */
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
vec = outline->points;
|
|
|
|
vec_limit = vec + n_points;
|
|
|
|
flag = (FT_Byte*)outline->tags;
|
|
|
|
x = 0;
|
|
|
|
|
2007-06-11 02:18:00 +02:00
|
|
|
if ( p + xy_size > limit )
|
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
for ( ; vec < vec_limit; vec++, flag++ )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2008-10-02 12:40:52 +02:00
|
|
|
FT_Pos y = 0;
|
|
|
|
FT_Byte f = *flag;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2007-06-11 02:18:00 +02:00
|
|
|
if ( f & 2 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2007-06-11 06:55:58 +02:00
|
|
|
if ( p + 1 > limit )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
y = (FT_Pos)FT_NEXT_BYTE( p );
|
2007-06-11 02:18:00 +02:00
|
|
|
if ( ( f & 16 ) == 0 )
|
2003-06-09 17:54:18 +02:00
|
|
|
y = -y;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2007-06-11 02:18:00 +02:00
|
|
|
else if ( ( f & 16 ) == 0 )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
{
|
2007-06-11 06:55:58 +02:00
|
|
|
if ( p + 2 > limit )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
y = (FT_Pos)FT_NEXT_SHORT( p );
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
}
|
2003-06-09 17:54:18 +02:00
|
|
|
|
|
|
|
x += y;
|
|
|
|
vec->x = x;
|
2008-10-02 12:40:52 +02:00
|
|
|
/* the cast is for stupid compilers */
|
|
|
|
*flag = (FT_Byte)( f & ~( 2 | 16 ) );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the Y coordinates */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
vec = gloader->current.outline.points;
|
|
|
|
vec_limit = vec + n_points;
|
|
|
|
flag = (FT_Byte*)outline->tags;
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
for ( ; vec < vec_limit; vec++, flag++ )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2008-10-02 12:40:52 +02:00
|
|
|
FT_Pos y = 0;
|
|
|
|
FT_Byte f = *flag;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2007-06-11 02:18:00 +02:00
|
|
|
if ( f & 4 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2007-06-11 06:55:58 +02:00
|
|
|
if ( p + 1 > limit )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
y = (FT_Pos)FT_NEXT_BYTE( p );
|
2007-06-11 02:18:00 +02:00
|
|
|
if ( ( f & 32 ) == 0 )
|
2003-06-09 17:54:18 +02:00
|
|
|
y = -y;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2007-06-11 02:18:00 +02:00
|
|
|
else if ( ( f & 32 ) == 0 )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
{
|
2007-06-11 06:55:58 +02:00
|
|
|
if ( p + 2 > limit )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
y = (FT_Pos)FT_NEXT_SHORT( p );
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
}
|
2003-06-09 17:54:18 +02:00
|
|
|
|
|
|
|
x += y;
|
|
|
|
vec->y = x;
|
2008-10-02 12:40:52 +02:00
|
|
|
/* the cast is for stupid compilers */
|
|
|
|
*flag = (FT_Byte)( f & FT_CURVE_TAG_ON );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2015-02-17 08:03:05 +01:00
|
|
|
outline->n_points = (FT_Short)n_points;
|
|
|
|
outline->n_contours = (FT_Short)n_contours;
|
2000-06-23 14:26:14 +02:00
|
|
|
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
load->cursor = p;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
Fail:
|
2000-06-23 07:02:13 +02:00
|
|
|
return error;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
|
|
|
Invalid_Outline:
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Outline );
|
2002-01-06 11:13:40 +01:00
|
|
|
goto Fail;
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Load_Composite_Glyph( TT_Loader loader )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Error error;
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
FT_Byte* p = loader->cursor;
|
|
|
|
FT_Byte* limit = loader->limit;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_GlyphLoader gloader = loader->gloader;
|
2002-03-14 13:56:35 +01:00
|
|
|
FT_SubGlyph subglyph;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt num_subglyphs;
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
num_subglyphs = 0;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
FT_Fixed xx, xy, yy, yx;
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
FT_UInt count;
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
/* check that we can load a new subglyph */
|
2002-03-14 13:56:35 +01:00
|
|
|
error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs + 1 );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-01-06 17:42:44 +01:00
|
|
|
/* check space */
|
2006-05-18 00:55:04 +02:00
|
|
|
if ( p + 4 > limit )
|
2002-01-06 11:13:40 +01:00
|
|
|
goto Invalid_Composite;
|
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
subglyph = gloader->current.subglyphs + num_subglyphs;
|
|
|
|
|
|
|
|
subglyph->arg1 = subglyph->arg2 = 0;
|
|
|
|
|
2006-05-18 00:55:04 +02:00
|
|
|
subglyph->flags = FT_NEXT_USHORT( p );
|
|
|
|
subglyph->index = FT_NEXT_USHORT( p );
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2002-01-06 17:42:44 +01:00
|
|
|
/* check space */
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
count = 2;
|
2002-01-06 11:13:40 +01:00
|
|
|
if ( subglyph->flags & ARGS_ARE_WORDS )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
count += 2;
|
2002-01-06 11:13:40 +01:00
|
|
|
if ( subglyph->flags & WE_HAVE_A_SCALE )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
count += 2;
|
2002-01-06 11:13:40 +01:00
|
|
|
else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
count += 4;
|
2002-01-06 11:13:40 +01:00
|
|
|
else if ( subglyph->flags & WE_HAVE_A_2X2 )
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
count += 8;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
if ( p + count > limit )
|
2002-01-06 11:13:40 +01:00
|
|
|
goto Invalid_Composite;
|
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
/* read arguments */
|
2015-05-17 22:54:48 +02:00
|
|
|
if ( subglyph->flags & ARGS_ARE_XY_VALUES )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2015-05-17 22:54:48 +02:00
|
|
|
if ( subglyph->flags & ARGS_ARE_WORDS )
|
|
|
|
{
|
|
|
|
subglyph->arg1 = FT_NEXT_SHORT( p );
|
|
|
|
subglyph->arg2 = FT_NEXT_SHORT( p );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
subglyph->arg1 = FT_NEXT_CHAR( p );
|
|
|
|
subglyph->arg2 = FT_NEXT_CHAR( p );
|
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-05-17 22:54:48 +02:00
|
|
|
if ( subglyph->flags & ARGS_ARE_WORDS )
|
|
|
|
{
|
|
|
|
subglyph->arg1 = (FT_Int)FT_NEXT_USHORT( p );
|
|
|
|
subglyph->arg2 = (FT_Int)FT_NEXT_USHORT( p );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
subglyph->arg1 = (FT_Int)FT_NEXT_BYTE( p );
|
|
|
|
subglyph->arg2 = (FT_Int)FT_NEXT_BYTE( p );
|
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* read transform */
|
|
|
|
xx = yy = 0x10000L;
|
|
|
|
xy = yx = 0;
|
|
|
|
|
|
|
|
if ( subglyph->flags & WE_HAVE_A_SCALE )
|
|
|
|
{
|
2015-08-01 07:53:48 +02:00
|
|
|
xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
|
2000-06-23 14:26:14 +02:00
|
|
|
yy = xx;
|
|
|
|
}
|
|
|
|
else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
|
|
|
|
{
|
2015-08-01 07:53:48 +02:00
|
|
|
xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
|
|
|
|
yy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
else if ( subglyph->flags & WE_HAVE_A_2X2 )
|
|
|
|
{
|
2015-08-01 07:53:48 +02:00
|
|
|
xx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
|
|
|
|
yx = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
|
|
|
|
xy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
|
|
|
|
yy = (FT_Fixed)FT_NEXT_SHORT( p ) * 4;
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
subglyph->transform.xx = xx;
|
|
|
|
subglyph->transform.xy = xy;
|
|
|
|
subglyph->transform.yx = yx;
|
|
|
|
subglyph->transform.yy = yy;
|
|
|
|
|
|
|
|
num_subglyphs++;
|
2000-07-02 15:53:16 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
} while ( subglyph->flags & MORE_COMPONENTS );
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
gloader->current.num_subglyphs = num_subglyphs;
|
2015-11-04 07:35:51 +01:00
|
|
|
FT_TRACE5(( " %d components\n", num_subglyphs ));
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2006-05-18 00:55:04 +02:00
|
|
|
FT_Stream stream = loader->stream;
|
|
|
|
|
|
|
|
|
2008-06-22 15:40:08 +02:00
|
|
|
/* we must undo the FT_FRAME_ENTER in order to point */
|
|
|
|
/* to the composite instructions, if we find some. */
|
|
|
|
/* We will process them later. */
|
|
|
|
/* */
|
2002-03-20 11:49:31 +01:00
|
|
|
loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
p - limit );
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
#endif
|
2000-06-23 07:02:13 +02:00
|
|
|
|
* include/freetype/internal/tttypes.h, src/autofit/afangles.c,
src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c,
src/autofit/aftypes.h, src/base/ftcalc.c, src/base/ftoutln.c,
src/gzip/ftgzip.c, src/psaux/psconv.c, src/truetype/ttgload.c,
src/type1/t1gload.c:
this is a major patch used to drastically improve the performance
of loading glyphs. This both speeds up loading the glypn vector
themselves and the auto-fitter.
note that we've started using inline assembler with GCC to
implement FT_MulFix, given that this function is so damn
important for the engine's performance.
the resulting speed-up is about 25%.
2006-05-17 15:34:21 +02:00
|
|
|
loader->cursor = p;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
Fail:
|
|
|
|
return error;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
|
|
|
Invalid_Composite:
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Composite );
|
2002-01-06 11:13:40 +01:00
|
|
|
goto Fail;
|
2000-06-23 07:02:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Init_Glyph_Loading( TT_Face face )
|
2000-06-25 06:49:19 +02:00
|
|
|
{
|
|
|
|
face->access_glyph_frame = TT_Access_Glyph_Frame;
|
|
|
|
face->read_glyph_header = TT_Load_Glyph_Header;
|
|
|
|
face->read_simple_glyph = TT_Load_Simple_Glyph;
|
|
|
|
face->read_composite_glyph = TT_Load_Composite_Glyph;
|
|
|
|
face->forget_glyph_frame = TT_Forget_Glyph_Frame;
|
|
|
|
}
|
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
static void
|
|
|
|
tt_prepare_zone( TT_GlyphZone zone,
|
|
|
|
FT_GlyphLoad load,
|
|
|
|
FT_UInt start_point,
|
|
|
|
FT_UInt start_contour )
|
|
|
|
{
|
2015-02-17 08:03:05 +01:00
|
|
|
zone->n_points = (FT_UShort)load->outline.n_points -
|
|
|
|
(FT_UShort)start_point;
|
|
|
|
zone->n_contours = load->outline.n_contours -
|
|
|
|
(FT_Short)start_contour;
|
2007-06-17 07:31:23 +02:00
|
|
|
zone->org = load->extra_points + start_point;
|
|
|
|
zone->cur = load->outline.points + start_point;
|
|
|
|
zone->orus = load->extra_points2 + start_point;
|
|
|
|
zone->tags = (FT_Byte*)load->outline.tags + start_point;
|
|
|
|
zone->contours = (FT_UShort*)load->outline.contours + start_contour;
|
2006-08-16 11:11:31 +02:00
|
|
|
zone->first_point = (FT_UShort)start_point;
|
2005-08-16 03:54:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2005-08-16 03:54:59 +02:00
|
|
|
/* TT_Hint_Glyph */
|
2000-06-23 07:02:13 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2005-08-16 03:54:59 +02:00
|
|
|
/* Hint the glyph using the zone prepared by the caller. Note that */
|
|
|
|
/* the zone is supposed to include four phantom points. */
|
2000-06-23 07:02:13 +02:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
2005-09-28 09:34:45 +02:00
|
|
|
TT_Hint_Glyph( TT_Loader loader,
|
|
|
|
FT_Bool is_composite )
|
2000-06-23 07:02:13 +02:00
|
|
|
{
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
|
|
|
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
2015-08-06 06:06:14 +02:00
|
|
|
TT_Face face = loader->face;
|
2013-05-17 13:51:07 +02:00
|
|
|
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
|
|
|
#endif
|
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
TT_GlyphZone zone = &loader->zone;
|
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2015-02-17 08:03:05 +01:00
|
|
|
FT_Long n_ins;
|
2005-09-28 09:34:45 +02:00
|
|
|
#else
|
|
|
|
FT_UNUSED( is_composite );
|
|
|
|
#endif
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2009-07-31 17:32:16 +02:00
|
|
|
if ( loader->glyph->control_len > 0xFFFFL )
|
|
|
|
{
|
2013-11-20 21:06:18 +01:00
|
|
|
FT_TRACE1(( "TT_Hint_Glyph: too long instructions" ));
|
|
|
|
FT_TRACE1(( " (0x%lx byte) is truncated\n",
|
2009-07-31 17:32:16 +02:00
|
|
|
loader->glyph->control_len ));
|
|
|
|
}
|
2015-02-17 08:03:05 +01:00
|
|
|
n_ins = loader->glyph->control_len;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2007-01-26 23:18:56 +01:00
|
|
|
/* save original point position in org */
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( n_ins > 0 )
|
2006-08-19 13:18:09 +02:00
|
|
|
FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
|
2008-05-25 14:43:57 +02:00
|
|
|
|
|
|
|
/* Reset graphics state. */
|
2015-08-06 06:06:14 +02:00
|
|
|
loader->exec->GS = loader->size->GS;
|
2008-05-25 14:43:57 +02:00
|
|
|
|
|
|
|
/* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */
|
|
|
|
/* completely refer to the (already) hinted subglyphs. */
|
|
|
|
if ( is_composite )
|
|
|
|
{
|
|
|
|
loader->exec->metrics.x_scale = 1 << 16;
|
|
|
|
loader->exec->metrics.y_scale = 1 << 16;
|
|
|
|
|
|
|
|
FT_ARRAY_COPY( zone->orus, zone->cur, zone->n_points );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
loader->exec->metrics.x_scale = loader->size->metrics.x_scale;
|
|
|
|
loader->exec->metrics.y_scale = loader->size->metrics.y_scale;
|
2008-05-25 14:43:57 +02:00
|
|
|
}
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2000-06-23 07:02:13 +02:00
|
|
|
|
2013-12-03 06:57:02 +01:00
|
|
|
/* round phantom points */
|
|
|
|
zone->cur[zone->n_points - 4].x =
|
|
|
|
FT_PIX_ROUND( zone->cur[zone->n_points - 4].x );
|
2005-09-28 09:34:45 +02:00
|
|
|
zone->cur[zone->n_points - 3].x =
|
|
|
|
FT_PIX_ROUND( zone->cur[zone->n_points - 3].x );
|
2013-12-03 06:57:02 +01:00
|
|
|
zone->cur[zone->n_points - 2].y =
|
|
|
|
FT_PIX_ROUND( zone->cur[zone->n_points - 2].y );
|
2005-09-28 09:34:45 +02:00
|
|
|
zone->cur[zone->n_points - 1].y =
|
|
|
|
FT_PIX_ROUND( zone->cur[zone->n_points - 1].y );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
if ( n_ins > 0 )
|
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
|
Fix B/W rasterization of subglyphs with different drop-out modes.
Normally, the SCANMODE instruction (if present) to set the drop-out
mode in a TrueType font is located in the `prep' table only and thus
valid for all glyphs. However, there are fonts like `pala.ttf'
which additionally contain this instruction in the hinting code of
some glyphs (but not all). As a result it can happen that a
composite glyph needs multiple drop-out modes for its subglyphs
since the rendering state gets reset for each subglyph.
FreeType collects the hinted outlines from all subglyphs, then it
sends the data to the rasterizer. It also sends the drop-out mode
-- after hinting has been applied -- and here is the error: It sends
the drop-out mode of the last subglyph only; drop-out modes of all
other subglyphs are lost.
This patch fixes the problem; it adds a second, alternative
mechanism to pass the drop-out mode: For each contour, the
rasterizer now checks the first `tags' array element. If bit 2 is
set, bits 5-7 contain the contour's drop-out mode, overriding the
global drop-out mode.
* include/freetype/ftimage.h (FT_CURVE_TAG_HAS_SCANMODE): New macro.
* src/truetype/ttgload.c (TT_Hint_Glyph): Store drop-out mode in
`tags[0]'.
* src/raster/ftraster.c (Flow_Up, Overshoot_Top, Overshoot_Bottom):
Use bits 3-5 instead of 0-2.
(New_Profile): Set the drop-out mode in the profile's `flags' field.
(Decompose_Curve): Check `tags[0]' and set `dropOutControl' if
necessary.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop, Draw_Sweep): Use the profile's drop-out
mode.
2009-06-18 15:42:52 +02:00
|
|
|
FT_GlyphLoader gloader = loader->gloader;
|
|
|
|
FT_Outline current_outline = gloader->current.outline;
|
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
|
[Savannah bug #43682] Change some signatures to `void' return type.
* include/internal/pshints.h (PSH_Globals_SetScaleFunc),
include/internal/sfnt.h (TT_Get_Metrics_Func),
src/pshinter/pshglob.c (psh_globals_set_scale),
src/pshinter/pshrec.c (ps_hints_init), src/sfnt/ttmtx.c
(tt_face_get_metrics), src/truetype/ttinterp.c (TT_Goto_CodeRange,
TT_Set_CodeRange, TT_Clear_CodeRange, TT_Done_Context,
TT_Save_Context): Do it.
* src/pshinter/pshglob.h, src/pshinter/pshrec.h, src/sfnt/ttmtx.h,
src/truetype/ttgload.c (TT_Hint_Glyph), src/truetype/ttinterp.c
(TT_Run_Context), src/truetype/ttinterp.h, src/truetype/ttobjs.c
(tt_size_run_fpgm, tt_size_run_prep): Updated.
2014-11-25 08:14:15 +01:00
|
|
|
TT_Set_CodeRange( loader->exec, tt_coderange_glyph,
|
|
|
|
loader->exec->glyphIns, n_ins );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2005-09-28 09:34:45 +02:00
|
|
|
loader->exec->is_composite = is_composite;
|
|
|
|
loader->exec->pts = *zone;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2015-01-14 17:46:55 +01:00
|
|
|
error = TT_Run_Context( loader->exec );
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( error && loader->exec->pedantic_hinting )
|
|
|
|
return error;
|
Fix B/W rasterization of subglyphs with different drop-out modes.
Normally, the SCANMODE instruction (if present) to set the drop-out
mode in a TrueType font is located in the `prep' table only and thus
valid for all glyphs. However, there are fonts like `pala.ttf'
which additionally contain this instruction in the hinting code of
some glyphs (but not all). As a result it can happen that a
composite glyph needs multiple drop-out modes for its subglyphs
since the rendering state gets reset for each subglyph.
FreeType collects the hinted outlines from all subglyphs, then it
sends the data to the rasterizer. It also sends the drop-out mode
-- after hinting has been applied -- and here is the error: It sends
the drop-out mode of the last subglyph only; drop-out modes of all
other subglyphs are lost.
This patch fixes the problem; it adds a second, alternative
mechanism to pass the drop-out mode: For each contour, the
rasterizer now checks the first `tags' array element. If bit 2 is
set, bits 5-7 contain the contour's drop-out mode, overriding the
global drop-out mode.
* include/freetype/ftimage.h (FT_CURVE_TAG_HAS_SCANMODE): New macro.
* src/truetype/ttgload.c (TT_Hint_Glyph): Store drop-out mode in
`tags[0]'.
* src/raster/ftraster.c (Flow_Up, Overshoot_Top, Overshoot_Bottom):
Use bits 3-5 instead of 0-2.
(New_Profile): Set the drop-out mode in the profile's `flags' field.
(Decompose_Curve): Check `tags[0]' and set `dropOutControl' if
necessary.
(Vertical_Sweep_Drop, Horizontal_Sweep_Drop,
Horizontal_Gray_Sweep_Drop, Draw_Sweep): Use the profile's drop-out
mode.
2009-06-18 15:42:52 +02:00
|
|
|
|
|
|
|
/* store drop-out mode in bits 5-7; set bit 2 also as a marker */
|
|
|
|
current_outline.tags[0] |=
|
|
|
|
( loader->exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE;
|
2005-08-16 03:54:59 +02:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
#endif
|
1999-12-17 00:11:37 +01:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
/* Save possibly modified glyph phantom points unless in v40 backwards */
|
|
|
|
/* compatibility mode, where no movement on the x axis means no reason */
|
|
|
|
/* to change bearings or advance widths. */
|
|
|
|
if ( !( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
|
|
|
!loader->exec->backwards_compatibility ) )
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
loader->pp1 = zone->cur[zone->n_points - 4];
|
|
|
|
loader->pp2 = zone->cur[zone->n_points - 3];
|
|
|
|
loader->pp3 = zone->cur[zone->n_points - 2];
|
|
|
|
loader->pp4 = zone->cur[zone->n_points - 1];
|
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
}
|
|
|
|
#endif
|
2000-06-12 21:36:41 +02:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2013-05-17 13:51:07 +02:00
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
|
|
|
{
|
|
|
|
if ( loader->exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )
|
|
|
|
FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 );
|
|
|
|
|
|
|
|
else if ( loader->exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN )
|
|
|
|
FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 );
|
|
|
|
}
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2005-08-16 03:54:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_Process_Simple_Glyph */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Once a simple glyph has been loaded, it needs to be processed. */
|
|
|
|
/* Usually, this means scaling and hinting through bytecode */
|
|
|
|
/* interpretation. */
|
|
|
|
/* */
|
|
|
|
static FT_Error
|
|
|
|
TT_Process_Simple_Glyph( TT_Loader loader )
|
|
|
|
{
|
2005-09-28 09:34:45 +02:00
|
|
|
FT_GlyphLoader gloader = loader->gloader;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_Outline* outline;
|
2007-07-11 01:10:39 +02:00
|
|
|
FT_Int n_points;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
|
2005-09-28 09:34:45 +02:00
|
|
|
outline = &gloader->current.outline;
|
2005-08-16 03:54:59 +02:00
|
|
|
n_points = outline->n_points;
|
|
|
|
|
|
|
|
/* set phantom points */
|
|
|
|
|
|
|
|
outline->points[n_points ] = loader->pp1;
|
|
|
|
outline->points[n_points + 1] = loader->pp2;
|
|
|
|
outline->points[n_points + 2] = loader->pp3;
|
|
|
|
outline->points[n_points + 3] = loader->pp4;
|
|
|
|
|
|
|
|
outline->tags[n_points ] = 0;
|
|
|
|
outline->tags[n_points + 1] = 0;
|
|
|
|
outline->tags[n_points + 2] = 0;
|
|
|
|
outline->tags[n_points + 3] = 0;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
n_points += 4;
|
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
|
|
|
|
|
2016-09-29 19:49:07 +02:00
|
|
|
if ( loader->face->doblend && !loader->face->is_default_instance )
|
* 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
|
|
|
{
|
|
|
|
/* Deltas apply to the unscaled data. */
|
2015-08-06 06:06:14 +02:00
|
|
|
error = TT_Vary_Apply_Glyph_Deltas( loader->face,
|
|
|
|
loader->glyph_index,
|
|
|
|
outline,
|
|
|
|
(FT_UInt)n_points );
|
* 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): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.
* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-07 09:08:14 +02:00
|
|
|
if ( error )
|
2005-08-16 03:54:59 +02:00
|
|
|
return error;
|
* 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 /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
|
|
|
|
2006-08-16 18:50:55 +02:00
|
|
|
if ( IS_HINTED( loader->load_flags ) )
|
|
|
|
{
|
|
|
|
tt_prepare_zone( &loader->zone, &gloader->current, 0, 0 );
|
|
|
|
|
|
|
|
FT_ARRAY_COPY( loader->zone.orus, loader->zone.cur,
|
|
|
|
loader->zone.n_points + 4 );
|
|
|
|
}
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2015-08-06 06:06:14 +02:00
|
|
|
TT_Face face = loader->face;
|
2013-05-17 13:51:07 +02:00
|
|
|
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
|
|
|
|
|
|
|
FT_String* family = face->root.family_name;
|
2015-02-17 08:03:05 +01:00
|
|
|
FT_UInt ppem = loader->size->metrics.x_ppem;
|
2013-05-17 13:51:07 +02:00
|
|
|
FT_String* style = face->root.style_name;
|
2015-02-17 08:03:05 +01:00
|
|
|
FT_UInt x_scale_factor = 1000;
|
2013-05-17 13:51:07 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
FT_Vector* vec = outline->points;
|
|
|
|
FT_Vector* limit = outline->points + n_points;
|
|
|
|
|
2013-06-05 13:43:20 +02:00
|
|
|
FT_Fixed x_scale = 0; /* pacify compiler */
|
|
|
|
FT_Fixed y_scale = 0;
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
FT_Bool do_scale = FALSE;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2013-05-17 13:51:07 +02:00
|
|
|
/* scale, but only if enabled and only if TT hinting is being used */
|
|
|
|
if ( IS_HINTED( loader->load_flags ) )
|
|
|
|
x_scale_factor = sph_test_tweak_x_scaling( face,
|
|
|
|
family,
|
|
|
|
ppem,
|
|
|
|
style,
|
|
|
|
loader->glyph_index );
|
|
|
|
/* scale the glyph */
|
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ||
|
|
|
|
x_scale_factor != 1000 )
|
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
x_scale = FT_MulDiv( loader->size->metrics.x_scale,
|
2015-02-17 08:03:05 +01:00
|
|
|
(FT_Long)x_scale_factor, 1000 );
|
2015-08-06 06:06:14 +02:00
|
|
|
y_scale = loader->size->metrics.y_scale;
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
/* compensate for any scaling by de/emboldening; */
|
|
|
|
/* the amount was determined via experimentation */
|
|
|
|
if ( x_scale_factor != 1000 && ppem > 11 )
|
|
|
|
FT_Outline_EmboldenXY( outline,
|
|
|
|
FT_MulFix( 1280 * ppem,
|
|
|
|
1000 - x_scale_factor ),
|
|
|
|
0 );
|
|
|
|
do_scale = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
/* scale the glyph */
|
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
x_scale = loader->size->metrics.x_scale;
|
|
|
|
y_scale = loader->size->metrics.y_scale;
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
do_scale = TRUE;
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
if ( do_scale )
|
|
|
|
{
|
|
|
|
for ( ; vec < limit; vec++ )
|
|
|
|
{
|
|
|
|
vec->x = FT_MulFix( vec->x, x_scale );
|
|
|
|
vec->y = FT_MulFix( vec->y, y_scale );
|
|
|
|
}
|
|
|
|
|
|
|
|
loader->pp1 = outline->points[n_points - 4];
|
|
|
|
loader->pp2 = outline->points[n_points - 3];
|
|
|
|
loader->pp3 = outline->points[n_points - 2];
|
|
|
|
loader->pp4 = outline->points[n_points - 1];
|
|
|
|
}
|
- 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
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( IS_HINTED( loader->load_flags ) )
|
|
|
|
{
|
|
|
|
loader->zone.n_points += 4;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
error = TT_Hint_Glyph( loader, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_Process_Composite_Component */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Once a composite component has been loaded, it needs to be */
|
|
|
|
/* processed. Usually, this means transforming and translating. */
|
|
|
|
/* */
|
|
|
|
static FT_Error
|
|
|
|
TT_Process_Composite_Component( TT_Loader loader,
|
|
|
|
FT_SubGlyph subglyph,
|
|
|
|
FT_UInt start_point,
|
|
|
|
FT_UInt num_base_points )
|
|
|
|
{
|
2015-09-16 18:05:43 +02:00
|
|
|
FT_GlyphLoader gloader = loader->gloader;
|
2015-08-15 05:23:18 +02:00
|
|
|
FT_Outline current;
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_Bool have_scale;
|
|
|
|
FT_Pos x, y;
|
|
|
|
|
* src/base/Jamfile: adding src/base/ftgxval.c
* src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c,
src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c,
src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c,
src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c,
src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c:
removing _many_ compiler warnings when compiling with Visual C++
at maximum level (/W4)
2005-09-23 15:22:10 +02:00
|
|
|
|
2015-09-16 18:05:43 +02:00
|
|
|
current.points = gloader->base.outline.points +
|
|
|
|
num_base_points;
|
|
|
|
current.n_points = gloader->base.outline.n_points -
|
|
|
|
(short)num_base_points;
|
2015-08-15 05:23:18 +02:00
|
|
|
|
* src/base/Jamfile: adding src/base/ftgxval.c
* src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c,
src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c,
src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c,
src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c,
src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c:
removing _many_ compiler warnings when compiling with Visual C++
at maximum level (/W4)
2005-09-23 15:22:10 +02:00
|
|
|
have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE |
|
|
|
|
WE_HAVE_AN_XY_SCALE |
|
|
|
|
WE_HAVE_A_2X2 ) );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
/* perform the transform required for this subglyph */
|
|
|
|
if ( have_scale )
|
2015-08-15 05:23:18 +02:00
|
|
|
FT_Outline_Transform( ¤t, &subglyph->transform );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* get offset */
|
|
|
|
if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )
|
|
|
|
{
|
2015-08-15 05:23:18 +02:00
|
|
|
FT_UInt num_points = (FT_UInt)gloader->base.outline.n_points;
|
2015-02-17 08:03:05 +01:00
|
|
|
FT_UInt k = (FT_UInt)subglyph->arg1;
|
|
|
|
FT_UInt l = (FT_UInt)subglyph->arg2;
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_Vector* p1;
|
|
|
|
FT_Vector* p2;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2005-08-19 10:56:29 +02:00
|
|
|
/* match l-th point of the newly loaded component to the k-th point */
|
|
|
|
/* of the previously loaded components. */
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* change to the point numbers used by our outline */
|
|
|
|
k += start_point;
|
|
|
|
l += num_base_points;
|
2005-08-19 10:56:29 +02:00
|
|
|
if ( k >= num_base_points ||
|
|
|
|
l >= num_points )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Composite );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
p1 = gloader->base.outline.points + k;
|
|
|
|
p2 = gloader->base.outline.points + l;
|
- 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
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
x = p1->x - p2->x;
|
|
|
|
y = p1->y - p2->y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = subglyph->arg1;
|
|
|
|
y = subglyph->arg2;
|
|
|
|
|
|
|
|
if ( !x && !y )
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2013-12-10 09:40:36 +01:00
|
|
|
/* Use a default value dependent on */
|
|
|
|
/* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old */
|
|
|
|
/* TT fonts which don't set the xxx_COMPONENT_OFFSET bit. */
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
if ( have_scale &&
|
|
|
|
#ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
|
|
|
|
!( subglyph->flags & UNSCALED_COMPONENT_OFFSET ) )
|
|
|
|
#else
|
|
|
|
( subglyph->flags & SCALED_COMPONENT_OFFSET ) )
|
|
|
|
#endif
|
|
|
|
{
|
2005-09-28 09:34:45 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
#if 0
|
|
|
|
|
2013-12-10 09:40:36 +01:00
|
|
|
/*******************************************************************/
|
|
|
|
/* */
|
|
|
|
/* This algorithm is what Apple documents. But it doesn't work. */
|
|
|
|
/* */
|
2005-08-16 03:54:59 +02:00
|
|
|
int a = subglyph->transform.xx > 0 ? subglyph->transform.xx
|
|
|
|
: -subglyph->transform.xx;
|
|
|
|
int b = subglyph->transform.yx > 0 ? subglyph->transform.yx
|
|
|
|
: -subglyph->transform.yx;
|
|
|
|
int c = subglyph->transform.xy > 0 ? subglyph->transform.xy
|
|
|
|
: -subglyph->transform.xy;
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
int d = subglyph->transform.yy > 0 ? subglyph->transform.yy
|
2005-08-16 03:54:59 +02:00
|
|
|
: -subglyph->transform.yy;
|
|
|
|
int m = a > b ? a : b;
|
|
|
|
int n = c > d ? c : d;
|
|
|
|
|
|
|
|
|
|
|
|
if ( a - b <= 33 && a - b >= -33 )
|
|
|
|
m *= 2;
|
|
|
|
if ( c - d <= 33 && c - d >= -33 )
|
|
|
|
n *= 2;
|
|
|
|
x = FT_MulFix( x, m );
|
|
|
|
y = FT_MulFix( y, n );
|
|
|
|
|
2013-12-10 09:40:36 +01:00
|
|
|
#else /* 1 */
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2013-12-10 09:40:36 +01:00
|
|
|
/*******************************************************************/
|
|
|
|
/* */
|
|
|
|
/* This algorithm is a guess and works much better than the above. */
|
|
|
|
/* */
|
2013-01-24 05:31:41 +01:00
|
|
|
FT_Fixed mac_xscale = FT_Hypot( subglyph->transform.xx,
|
|
|
|
subglyph->transform.xy );
|
|
|
|
FT_Fixed mac_yscale = FT_Hypot( subglyph->transform.yy,
|
|
|
|
subglyph->transform.yx );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
x = FT_MulFix( x, mac_xscale );
|
|
|
|
y = FT_MulFix( y, mac_yscale );
|
|
|
|
|
2013-12-10 09:40:36 +01:00
|
|
|
#endif /* 1 */
|
2000-07-05 06:32:02 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
|
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
FT_Fixed x_scale = loader->size->metrics.x_scale;
|
|
|
|
FT_Fixed y_scale = loader->size->metrics.y_scale;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
x = FT_MulFix( x, x_scale );
|
|
|
|
y = FT_MulFix( y, y_scale );
|
|
|
|
|
|
|
|
if ( subglyph->flags & ROUND_XY_TO_GRID )
|
|
|
|
{
|
|
|
|
x = FT_PIX_ROUND( x );
|
|
|
|
y = FT_PIX_ROUND( y );
|
|
|
|
}
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( x || y )
|
2015-08-15 05:23:18 +02:00
|
|
|
FT_Outline_Translate( ¤t, x, y );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2005-08-16 03:54:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_Process_Composite_Glyph */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* This is slightly different from TT_Process_Simple_Glyph, in that */
|
2007-02-01 08:58:02 +01:00
|
|
|
/* its sole purpose is to hint the glyph. Thus this function is */
|
2005-08-16 03:54:59 +02:00
|
|
|
/* only available when bytecode interpreter is enabled. */
|
|
|
|
/* */
|
|
|
|
static FT_Error
|
|
|
|
TT_Process_Composite_Glyph( TT_Loader loader,
|
|
|
|
FT_UInt start_point,
|
|
|
|
FT_UInt start_contour )
|
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_Outline* outline;
|
2006-06-25 08:27:27 +02:00
|
|
|
FT_UInt i;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
outline = &loader->gloader->base.outline;
|
|
|
|
|
|
|
|
/* make room for phantom points */
|
2005-10-28 18:14:14 +02:00
|
|
|
error = FT_GLYPHLOADER_CHECK_POINTS( loader->gloader,
|
|
|
|
outline->n_points + 4,
|
|
|
|
0 );
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( error )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
outline->points[outline->n_points ] = loader->pp1;
|
|
|
|
outline->points[outline->n_points + 1] = loader->pp2;
|
|
|
|
outline->points[outline->n_points + 2] = loader->pp3;
|
|
|
|
outline->points[outline->n_points + 3] = loader->pp4;
|
|
|
|
|
|
|
|
outline->tags[outline->n_points ] = 0;
|
|
|
|
outline->tags[outline->n_points + 1] = 0;
|
|
|
|
outline->tags[outline->n_points + 2] = 0;
|
|
|
|
outline->tags[outline->n_points + 3] = 0;
|
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2005-08-16 03:54:59 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_Stream stream = loader->stream;
|
2010-05-20 15:38:00 +02:00
|
|
|
FT_UShort n_ins, max_ins;
|
|
|
|
FT_ULong tmp;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* TT_Load_Composite_Glyph only gives us the offset of instructions */
|
2005-09-28 09:34:45 +02:00
|
|
|
/* so we read them here */
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( FT_STREAM_SEEK( loader->ins_pos ) ||
|
2005-08-19 10:56:29 +02:00
|
|
|
FT_READ_USHORT( n_ins ) )
|
2005-08-16 03:54:59 +02:00
|
|
|
return error;
|
|
|
|
|
|
|
|
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
|
|
|
|
|
|
|
|
/* check it */
|
2015-08-06 06:06:14 +02:00
|
|
|
max_ins = loader->face->max_profile.maxSizeOfInstructions;
|
2010-05-20 15:38:00 +02:00
|
|
|
if ( n_ins > max_ins )
|
2005-08-16 03:54:59 +02:00
|
|
|
{
|
2013-11-20 21:06:18 +01:00
|
|
|
/* don't trust `maxSizeOfInstructions'; */
|
|
|
|
/* only do a rough safety check */
|
2010-05-20 15:38:00 +02:00
|
|
|
if ( (FT_Int)n_ins > loader->byte_len )
|
|
|
|
{
|
2013-11-20 21:06:18 +01:00
|
|
|
FT_TRACE1(( "TT_Process_Composite_Glyph:"
|
|
|
|
" too many instructions (%d) for glyph with length %d\n",
|
2010-05-20 15:38:00 +02:00
|
|
|
n_ins, loader->byte_len ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Too_Many_Hints );
|
2010-05-20 15:38:00 +02:00
|
|
|
}
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2013-12-02 07:51:17 +01:00
|
|
|
tmp = loader->exec->glyphSize;
|
2010-05-20 15:38:00 +02:00
|
|
|
error = Update_Max( loader->exec->memory,
|
|
|
|
&tmp,
|
|
|
|
sizeof ( FT_Byte ),
|
|
|
|
(void*)&loader->exec->glyphIns,
|
|
|
|
n_ins );
|
2013-12-02 07:51:17 +01:00
|
|
|
|
2010-05-20 15:38:00 +02:00
|
|
|
loader->exec->glyphSize = (FT_UShort)tmp;
|
|
|
|
if ( error )
|
|
|
|
return error;
|
2005-08-16 03:54:59 +02:00
|
|
|
}
|
|
|
|
else if ( n_ins == 0 )
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
if ( FT_STREAM_READ( loader->exec->glyphIns, n_ins ) )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
loader->glyph->control_data = loader->exec->glyphIns;
|
|
|
|
loader->glyph->control_len = n_ins;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2000-10-31 21:42:18 +01:00
|
|
|
#endif
|
* 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
|
|
|
|
2005-08-19 10:56:29 +02:00
|
|
|
tt_prepare_zone( &loader->zone, &loader->gloader->base,
|
|
|
|
start_point, start_contour );
|
2006-06-25 08:27:27 +02:00
|
|
|
|
|
|
|
/* Some points are likely touched during execution of */
|
|
|
|
/* instructions on components. So let's untouch them. */
|
2013-11-05 13:29:15 +01:00
|
|
|
for ( i = 0; i < loader->zone.n_points; i++ )
|
2009-06-17 06:45:20 +02:00
|
|
|
loader->zone.tags[i] &= ~FT_CURVE_TAG_TOUCH_BOTH;
|
2006-06-25 08:27:27 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
loader->zone.n_points += 4;
|
|
|
|
|
|
|
|
return TT_Hint_Glyph( loader, 1 );
|
2000-06-23 07:02:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-06 07:14:49 +01:00
|
|
|
/*
|
|
|
|
* Calculate the phantom points
|
|
|
|
*
|
|
|
|
* Defining the right side bearing (rsb) as
|
|
|
|
*
|
|
|
|
* rsb = aw - (lsb + xmax - xmin)
|
|
|
|
*
|
|
|
|
* (with `aw' the advance width, `lsb' the left side bearing, and `xmin'
|
|
|
|
* and `xmax' the glyph's minimum and maximum x value), the OpenType
|
|
|
|
* specification defines the initial position of horizontal phantom points
|
|
|
|
* as
|
|
|
|
*
|
2013-12-03 06:57:02 +01:00
|
|
|
* pp1 = (round(xmin - lsb), 0) ,
|
|
|
|
* pp2 = (round(pp1 + aw), 0) .
|
|
|
|
*
|
2013-12-10 08:38:57 +01:00
|
|
|
* Note that the rounding to the grid (in the device space) is not
|
|
|
|
* documented currently in the specification.
|
2013-11-06 07:14:49 +01:00
|
|
|
*
|
|
|
|
* However, the specification lacks the precise definition of vertical
|
|
|
|
* phantom points. Greg Hitchcock provided the following explanation.
|
|
|
|
*
|
|
|
|
* - a `vmtx' table is present
|
|
|
|
*
|
|
|
|
* For any glyph, the minimum and maximum y values (`ymin' and `ymax')
|
|
|
|
* are given in the `glyf' table, the top side bearing (tsb) and advance
|
|
|
|
* height (ah) are given in the `vmtx' table. The bottom side bearing
|
|
|
|
* (bsb) is then calculated as
|
|
|
|
*
|
|
|
|
* bsb = ah - (tsb + ymax - ymin) ,
|
|
|
|
*
|
|
|
|
* and the initial position of vertical phantom points is
|
|
|
|
*
|
2013-12-03 06:57:02 +01:00
|
|
|
* pp3 = (x, round(ymax + tsb)) ,
|
|
|
|
* pp4 = (x, round(pp3 - ah)) .
|
2013-11-06 07:14:49 +01:00
|
|
|
*
|
|
|
|
* See below for value `x'.
|
|
|
|
*
|
|
|
|
* - no `vmtx' table in the font
|
|
|
|
*
|
|
|
|
* If there is an `OS/2' table, we set
|
|
|
|
*
|
|
|
|
* DefaultAscender = sTypoAscender ,
|
|
|
|
* DefaultDescender = sTypoDescender ,
|
|
|
|
*
|
|
|
|
* otherwise we use data from the `hhea' table:
|
|
|
|
*
|
|
|
|
* DefaultAscender = Ascender ,
|
|
|
|
* DefaultDescender = Descender .
|
|
|
|
*
|
|
|
|
* With these two variables we can now set
|
|
|
|
*
|
|
|
|
* ah = DefaultAscender - sDefaultDescender ,
|
|
|
|
* tsb = DefaultAscender - yMax ,
|
|
|
|
*
|
|
|
|
* and proceed as if a `vmtx' table was present.
|
|
|
|
*
|
|
|
|
* Usually we have
|
|
|
|
*
|
2013-12-07 09:26:55 +01:00
|
|
|
* x = aw / 2 , (1)
|
2013-11-06 07:14:49 +01:00
|
|
|
*
|
2013-12-07 09:26:55 +01:00
|
|
|
* but there is one compatibility case where it can be set to
|
2013-11-06 07:14:49 +01:00
|
|
|
*
|
|
|
|
* x = -DefaultDescender -
|
2013-12-07 09:26:55 +01:00
|
|
|
* ((DefaultAscender - DefaultDescender - aw) / 2) . (2)
|
2013-11-06 07:14:49 +01:00
|
|
|
*
|
2013-12-07 09:26:55 +01:00
|
|
|
* and another one with
|
|
|
|
*
|
|
|
|
* x = 0 . (3)
|
|
|
|
*
|
|
|
|
* In Windows, the history of those values is quite complicated,
|
|
|
|
* depending on the hinting engine (that is, the graphics framework).
|
|
|
|
*
|
|
|
|
* framework from to formula
|
|
|
|
* ----------------------------------------------------------
|
|
|
|
* GDI Windows 98 current (1)
|
|
|
|
* (Windows 2000 for NT)
|
|
|
|
* GDI+ Windows XP Windows 7 (2)
|
|
|
|
* GDI+ Windows 8 current (3)
|
|
|
|
* DWrite Windows 7 current (3)
|
|
|
|
*
|
|
|
|
* For simplicity, FreeType uses (1) for grayscale subpixel hinting and
|
|
|
|
* (3) for everything else.
|
2013-12-03 06:57:02 +01:00
|
|
|
*
|
2013-11-06 07:14:49 +01:00
|
|
|
*/
|
2016-05-18 07:07:44 +02:00
|
|
|
static void
|
|
|
|
tt_loader_set_pp( TT_Loader loader )
|
|
|
|
{
|
|
|
|
FT_Bool subpixel_hinting = 0;
|
|
|
|
FT_Bool grayscale = 0;
|
|
|
|
FT_Bool use_aw_2 = 0;
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
|
|
|
|
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
|
|
|
|
#endif
|
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2016-05-18 07:07:44 +02:00
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
|
|
|
{
|
|
|
|
subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting
|
|
|
|
: 0;
|
|
|
|
grayscale = loader->exec ? loader->exec->grayscale
|
|
|
|
: 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
|
|
|
{
|
|
|
|
subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting_lean
|
|
|
|
: 0;
|
|
|
|
grayscale = loader->exec ? loader->exec->grayscale_cleartype
|
|
|
|
: 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
use_aw_2 = (FT_Bool)( subpixel_hinting && grayscale );
|
2013-12-03 06:57:02 +01:00
|
|
|
|
2016-05-18 07:07:44 +02:00
|
|
|
loader->pp1.x = loader->bbox.xMin - loader->left_bearing;
|
|
|
|
loader->pp1.y = 0;
|
|
|
|
loader->pp2.x = loader->pp1.x + loader->advance;
|
|
|
|
loader->pp2.y = 0;
|
|
|
|
|
|
|
|
loader->pp3.x = use_aw_2 ? loader->advance / 2 : 0;
|
|
|
|
loader->pp3.y = loader->bbox.yMax + loader->top_bearing;
|
|
|
|
loader->pp4.x = use_aw_2 ? loader->advance / 2 : 0;
|
|
|
|
loader->pp4.y = loader->pp3.y - loader->vadvance;
|
|
|
|
}
|
2013-12-03 06:57:02 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2016-05-16 14:54:32 +02:00
|
|
|
/* a utility function to retrieve i-th node from given FT_List */
|
|
|
|
static FT_ListNode
|
|
|
|
ft_list_get_node_at( FT_List list,
|
|
|
|
FT_UInt index )
|
|
|
|
{
|
|
|
|
FT_ListNode cur;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !list )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for ( cur = list->head; cur; cur = cur->next )
|
|
|
|
{
|
|
|
|
if ( !index )
|
|
|
|
return cur;
|
|
|
|
|
2016-05-16 20:38:41 +02:00
|
|
|
index--;
|
2016-05-16 14:54:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2000-02-02 13:16:19 +01:00
|
|
|
/* load_truetype_glyph */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* Loads a given truetype glyph. Handles composites and uses a */
|
|
|
|
/* TT_Loader object. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
2002-04-01 16:25:28 +02:00
|
|
|
load_truetype_glyph( TT_Loader loader,
|
2003-01-08 10:59:17 +01:00
|
|
|
FT_UInt glyph_index,
|
2009-11-03 15:46:35 +01:00
|
|
|
FT_UInt recurse_count,
|
|
|
|
FT_Bool header_only )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Fixed x_scale, y_scale;
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_ULong offset;
|
2015-08-06 06:06:14 +02:00
|
|
|
TT_Face face = loader->face;
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_GlyphLoader gloader = loader->gloader;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Bool opened_frame = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
* 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): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.
* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-07 09:08:14 +02:00
|
|
|
FT_StreamRec inc_stream;
|
|
|
|
FT_Data glyph_data;
|
|
|
|
FT_Bool glyph_data_loaded = 0;
|
* 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
|
|
|
|
|
2003-06-04 09:59:58 +02:00
|
|
|
|
2015-11-04 07:35:51 +01:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
if ( recurse_count )
|
|
|
|
FT_TRACE5(( " nesting level: %d\n", recurse_count ));
|
|
|
|
#endif
|
|
|
|
|
2016-07-29 06:43:32 +02:00
|
|
|
/* some fonts have an incorrect value of `maxComponentDepth' */
|
|
|
|
if ( recurse_count > face->max_profile.maxComponentDepth )
|
2003-01-08 10:59:17 +01:00
|
|
|
{
|
2016-07-29 06:43:32 +02:00
|
|
|
FT_TRACE1(( "load_truetype_glyph: maxComponentDepth set to %d\n",
|
|
|
|
recurse_count ));
|
2016-08-16 06:44:23 +02:00
|
|
|
face->max_profile.maxComponentDepth = (FT_UShort)recurse_count;
|
2003-01-08 10:59:17 +01:00
|
|
|
}
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2015-02-06 10:16:45 +01:00
|
|
|
#ifndef FT_CONFIG_OPTION_INCREMENTAL
|
2000-02-02 13:16:19 +01:00
|
|
|
/* check glyph index */
|
2002-07-18 17:59:23 +02:00
|
|
|
if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Glyph_Index );
|
2000-06-23 14:26:14 +02:00
|
|
|
goto Exit;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2015-02-06 10:16:45 +01:00
|
|
|
#endif
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-15 13:54:51 +01:00
|
|
|
loader->glyph_index = glyph_index;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
x_scale = loader->size->metrics.x_scale;
|
|
|
|
y_scale = loader->size->metrics.y_scale;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2005-08-16 03:54:59 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
x_scale = 0x10000L;
|
|
|
|
y_scale = 0x10000L;
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* Set `offset' to the start of the glyph relative to the start of */
|
2005-08-19 10:56:29 +02:00
|
|
|
/* the `glyf' table, and `byte_len' to the length of the glyph in */
|
2005-08-16 03:54:59 +02:00
|
|
|
/* bytes. */
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
|
|
/* If we are loading glyph data via the incremental interface, set */
|
|
|
|
/* the loader stream to a memory stream reading the data returned */
|
|
|
|
/* by the interface. */
|
2002-08-01 17:29:17 +02:00
|
|
|
if ( face->root.internal->incremental_interface )
|
2002-07-18 17:59:23 +02:00
|
|
|
{
|
2002-08-01 17:29:17 +02:00
|
|
|
error = face->root.internal->incremental_interface->funcs->get_glyph_data(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
glyph_index, &glyph_data );
|
2002-07-26 11:09:10 +02:00
|
|
|
if ( error )
|
2002-07-18 17:59:23 +02:00
|
|
|
goto Exit;
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2002-08-01 17:29:17 +02:00
|
|
|
glyph_data_loaded = 1;
|
2002-08-06 23:47:40 +02:00
|
|
|
offset = 0;
|
2006-02-14 09:37:03 +01:00
|
|
|
loader->byte_len = glyph_data.length;
|
2002-08-06 23:47:40 +02:00
|
|
|
|
2016-09-28 19:06:21 +02:00
|
|
|
FT_ZERO( &inc_stream );
|
2002-08-06 23:47:40 +02:00
|
|
|
FT_Stream_OpenMemory( &inc_stream,
|
2015-02-17 08:03:05 +01:00
|
|
|
glyph_data.pointer,
|
|
|
|
(FT_ULong)glyph_data.length );
|
2002-08-06 23:47:40 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
loader->stream = &inc_stream;
|
|
|
|
}
|
|
|
|
else
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
2002-07-18 17:59:23 +02:00
|
|
|
|
2005-08-19 10:56:29 +02:00
|
|
|
offset = tt_face_get_location( face, glyph_index,
|
|
|
|
(FT_UInt*)&loader->byte_len );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2008-01-10 09:47:08 +01:00
|
|
|
if ( loader->byte_len > 0 )
|
|
|
|
{
|
2010-01-05 10:10:15 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2010-01-04 15:53:27 +01:00
|
|
|
/* for the incremental interface, `glyf_offset' is always zero */
|
2016-09-27 21:21:01 +02:00
|
|
|
if ( !face->glyf_offset &&
|
2010-01-04 15:53:27 +01:00
|
|
|
!face->root.internal->incremental_interface )
|
2010-01-05 10:10:15 +01:00
|
|
|
#else
|
2016-09-27 21:21:01 +02:00
|
|
|
if ( !face->glyf_offset )
|
2010-01-05 10:10:15 +01:00
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
2008-12-09 07:51:56 +01:00
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Table );
|
2008-12-09 07:51:56 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2008-01-10 09:47:08 +01:00
|
|
|
error = face->access_glyph_frame( loader, glyph_index,
|
2016-09-27 21:21:01 +02:00
|
|
|
face->glyf_offset + offset,
|
2015-02-17 08:03:05 +01:00
|
|
|
(FT_UInt)loader->byte_len );
|
2008-01-10 09:47:08 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
opened_frame = 1;
|
|
|
|
|
2009-11-03 15:46:35 +01:00
|
|
|
/* read glyph header first */
|
2008-01-10 09:47:08 +01:00
|
|
|
error = face->read_glyph_header( loader );
|
2013-11-06 08:41:59 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* the metrics must be computed after loading the glyph header */
|
|
|
|
/* since we need the glyph's `yMax' value in case the vertical */
|
|
|
|
/* metrics must be emulated */
|
2013-11-12 08:55:26 +01:00
|
|
|
error = tt_get_metrics( loader, glyph_index );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2013-11-06 08:41:59 +01:00
|
|
|
|
|
|
|
if ( header_only )
|
2008-01-10 09:47:08 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( loader->byte_len == 0 || loader->n_contours == 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
loader->bbox.xMin = 0;
|
|
|
|
loader->bbox.xMax = 0;
|
|
|
|
loader->bbox.yMin = 0;
|
|
|
|
loader->bbox.yMax = 0;
|
|
|
|
|
2013-11-12 08:55:26 +01:00
|
|
|
error = tt_get_metrics( loader, glyph_index );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2013-11-06 08:41:59 +01:00
|
|
|
|
2009-11-03 15:46:35 +01:00
|
|
|
if ( header_only )
|
|
|
|
goto Exit;
|
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
/* must initialize points before (possibly) overriding */
|
|
|
|
/* glyph metrics from the incremental interface */
|
2016-05-18 07:07:44 +02:00
|
|
|
tt_loader_set_pp( loader );
|
2000-02-02 13:16:19 +01:00
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
|
|
|
tt_get_metrics_incr_overrides( loader, glyph_index );
|
|
|
|
#endif
|
|
|
|
|
* 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
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2016-09-29 19:49:07 +02:00
|
|
|
if ( loader->face->doblend && !loader->face->is_default_instance )
|
* 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-05-31 12:21:34 +02:00
|
|
|
/* a small outline structure with four elements for */
|
|
|
|
/* communication with `TT_Vary_Apply_Glyph_Deltas' */
|
|
|
|
FT_Vector points[4];
|
|
|
|
char tags[4] = { 1, 1, 1, 1 };
|
|
|
|
short contours[4] = { 0, 1, 2, 3 };
|
|
|
|
FT_Outline outline;
|
|
|
|
|
|
|
|
|
|
|
|
points[0].x = loader->pp1.x;
|
|
|
|
points[0].y = loader->pp1.y;
|
|
|
|
points[1].x = loader->pp2.x;
|
|
|
|
points[1].y = loader->pp2.y;
|
|
|
|
|
|
|
|
points[2].x = loader->pp3.x;
|
|
|
|
points[2].y = loader->pp3.y;
|
|
|
|
points[3].x = loader->pp4.x;
|
|
|
|
points[3].y = loader->pp4.y;
|
|
|
|
|
|
|
|
outline.n_points = 4;
|
|
|
|
outline.n_contours = 4;
|
|
|
|
outline.points = points;
|
|
|
|
outline.tags = tags;
|
|
|
|
outline.contours = contours;
|
* 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-05-31 12:21:34 +02:00
|
|
|
/* this must be done before scaling */
|
2015-08-06 06:06:14 +02:00
|
|
|
error = TT_Vary_Apply_Glyph_Deltas( loader->face,
|
|
|
|
glyph_index,
|
|
|
|
&outline,
|
|
|
|
(FT_UInt)outline.n_points );
|
2004-06-24 22:18:24 +02:00
|
|
|
if ( error )
|
* 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
|
|
|
goto Exit;
|
|
|
|
|
2015-05-31 12:21:34 +02:00
|
|
|
loader->pp1.x = points[0].x;
|
|
|
|
loader->pp1.y = points[0].y;
|
|
|
|
loader->pp2.x = points[1].x;
|
|
|
|
loader->pp2.y = points[1].y;
|
* 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-05-31 12:21:34 +02:00
|
|
|
loader->pp3.x = points[2].x;
|
|
|
|
loader->pp3.y = points[2].y;
|
|
|
|
loader->pp4.x = points[3].x;
|
|
|
|
loader->pp4.y = points[3].y;
|
* 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
|
|
|
}
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2013-12-10 10:12:27 +01:00
|
|
|
#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
|
|
|
|
2013-12-10 10:12:27 +01:00
|
|
|
/* scale phantom points, if necessary; */
|
|
|
|
/* they get rounded in `TT_Hint_Glyph' */
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
2005-08-16 03:54:59 +02:00
|
|
|
loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
|
2000-02-02 13:16:19 +01:00
|
|
|
loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
|
2013-12-10 10:12:27 +01:00
|
|
|
/* pp1.y and pp2.y are always zero */
|
|
|
|
|
|
|
|
loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale );
|
2005-08-16 03:54:59 +02:00
|
|
|
loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );
|
2013-12-10 10:12:27 +01:00
|
|
|
loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale );
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
|
|
|
|
}
|
2000-02-02 13:16:19 +01:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
error = FT_Err_Ok;
|
2000-06-23 14:26:14 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2013-12-10 09:40:36 +01:00
|
|
|
/* must initialize phantom points before (possibly) overriding */
|
|
|
|
/* glyph metrics from the incremental interface */
|
2016-05-18 07:07:44 +02:00
|
|
|
tt_loader_set_pp( loader );
|
2004-03-27 09:43:17 +01:00
|
|
|
|
2010-02-18 17:09:30 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
|
|
|
tt_get_metrics_incr_overrides( loader, glyph_index );
|
|
|
|
#endif
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* if it is a simple glyph, load it */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2008-01-10 09:47:08 +01:00
|
|
|
if ( loader->n_contours > 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-25 06:49:19 +02:00
|
|
|
error = face->read_simple_glyph( loader );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
2005-08-16 03:54:59 +02:00
|
|
|
goto Exit;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* all data have been read */
|
|
|
|
face->forget_glyph_frame( loader );
|
|
|
|
opened_frame = 0;
|
2000-07-02 15:53:16 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
error = TT_Process_Simple_Glyph( loader );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_GlyphLoader_Add( gloader );
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* otherwise, load a composite! */
|
2005-08-16 03:54:59 +02:00
|
|
|
else if ( loader->n_contours == -1 )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2015-11-04 11:44:47 +01:00
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
|
2007-05-19 09:01:49 +02:00
|
|
|
FT_UInt start_point;
|
|
|
|
FT_UInt start_contour;
|
|
|
|
FT_ULong ins_pos; /* position of composite instructions, if any */
|
2016-05-16 20:38:41 +02:00
|
|
|
|
2016-05-16 14:54:32 +02:00
|
|
|
FT_ListNode node, node2;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2015-11-09 09:20:08 +01:00
|
|
|
/*
|
|
|
|
* We store the glyph index directly in the `node->data' pointer,
|
|
|
|
* following the glib solution (cf. macro `GUINT_TO_POINTER') with a
|
|
|
|
* double cast to make this portable. Note, however, that this needs
|
|
|
|
* pointers with a width of at least 32 bits.
|
|
|
|
*/
|
|
|
|
|
2016-05-16 14:54:32 +02:00
|
|
|
|
|
|
|
/* clear the nodes filled by sibling chains */
|
|
|
|
node = ft_list_get_node_at( &loader->composites, recurse_count );
|
2016-05-16 20:38:41 +02:00
|
|
|
for ( node2 = node; node2; node2 = node2->next )
|
2016-05-16 14:54:32 +02:00
|
|
|
node2->data = (void*)ULONG_MAX;
|
|
|
|
|
2015-11-04 11:44:47 +01:00
|
|
|
/* check whether we already have a composite glyph with this index */
|
2015-11-09 09:20:08 +01:00
|
|
|
if ( FT_List_Find( &loader->composites,
|
|
|
|
(void*)(unsigned long)glyph_index ) )
|
2015-11-04 11:44:47 +01:00
|
|
|
{
|
|
|
|
FT_TRACE1(( "TT_Load_Composite_Glyph:"
|
|
|
|
" infinite recursion detected\n" ));
|
|
|
|
error = FT_THROW( Invalid_Composite );
|
|
|
|
goto Exit;
|
|
|
|
}
|
2016-05-16 20:38:41 +02:00
|
|
|
|
2016-05-16 14:54:32 +02:00
|
|
|
else if ( node )
|
|
|
|
node->data = (void*)(unsigned long)glyph_index;
|
2016-05-16 20:38:41 +02:00
|
|
|
|
2015-11-04 11:44:47 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( FT_NEW( node ) )
|
|
|
|
goto Exit;
|
2015-11-09 09:20:08 +01:00
|
|
|
node->data = (void*)(unsigned long)glyph_index;
|
2015-11-04 11:44:47 +01:00
|
|
|
FT_List_Add( &loader->composites, node );
|
|
|
|
}
|
|
|
|
|
2015-02-17 08:03:05 +01:00
|
|
|
start_point = (FT_UInt)gloader->base.outline.n_points;
|
|
|
|
start_contour = (FT_UInt)gloader->base.outline.n_contours;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* for each subglyph, read composite header */
|
2000-06-25 06:49:19 +02:00
|
|
|
error = face->read_composite_glyph( loader );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
2005-08-16 03:54:59 +02:00
|
|
|
goto Exit;
|
2000-03-28 13:19:28 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* store the offset of instructions */
|
2000-07-04 20:12:13 +02:00
|
|
|
ins_pos = loader->ins_pos;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
/* all data we need are read */
|
2000-06-25 06:49:19 +02:00
|
|
|
face->forget_glyph_frame( loader );
|
2000-06-23 14:26:14 +02:00
|
|
|
opened_frame = 0;
|
|
|
|
|
* 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
|
|
|
|
|
2016-09-29 19:49:07 +02:00
|
|
|
if ( face->doblend && !face->is_default_instance )
|
* 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-06-30 09:46:39 +02:00
|
|
|
short i, limit;
|
* 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
|
|
|
FT_SubGlyph subglyph;
|
|
|
|
|
2015-05-31 12:21:34 +02:00
|
|
|
FT_Outline outline;
|
|
|
|
FT_Vector* points = NULL;
|
|
|
|
char* tags = NULL;
|
|
|
|
short* contours = NULL;
|
* 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-05-31 12:21:34 +02:00
|
|
|
|
2015-06-30 09:46:39 +02:00
|
|
|
limit = (short)gloader->current.num_subglyphs;
|
2015-05-31 12:21:34 +02:00
|
|
|
|
|
|
|
/* construct an outline structure for */
|
|
|
|
/* communication with `TT_Vary_Apply_Glyph_Deltas' */
|
2015-06-30 09:46:39 +02:00
|
|
|
outline.n_points = (short)( gloader->current.num_subglyphs + 4 );
|
2015-05-31 12:21:34 +02:00
|
|
|
outline.n_contours = outline.n_points;
|
|
|
|
|
2016-06-25 18:09:22 +02:00
|
|
|
outline.points = NULL;
|
2016-04-24 08:14:07 +02:00
|
|
|
outline.tags = NULL;
|
|
|
|
outline.contours = NULL;
|
|
|
|
|
2015-05-31 12:21:34 +02:00
|
|
|
if ( FT_NEW_ARRAY( points, outline.n_points ) ||
|
|
|
|
FT_NEW_ARRAY( tags, outline.n_points ) ||
|
|
|
|
FT_NEW_ARRAY( contours, outline.n_points ) )
|
|
|
|
goto Exit1;
|
|
|
|
|
2015-08-03 12:23:30 +02:00
|
|
|
subglyph = gloader->current.subglyphs;
|
2015-05-31 12:21:34 +02:00
|
|
|
|
|
|
|
for ( i = 0; i < limit; i++, subglyph++ )
|
|
|
|
{
|
|
|
|
/* applying deltas for anchor points doesn't make sense, */
|
|
|
|
/* but we don't have to specially check this since */
|
|
|
|
/* unused delta values are zero anyways */
|
|
|
|
points[i].x = subglyph->arg1;
|
|
|
|
points[i].y = subglyph->arg2;
|
|
|
|
tags[i] = 1;
|
|
|
|
contours[i] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
points[i].x = loader->pp1.x;
|
|
|
|
points[i].y = loader->pp1.y;
|
|
|
|
tags[i] = 1;
|
|
|
|
contours[i] = i;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
points[i].x = loader->pp2.x;
|
|
|
|
points[i].y = loader->pp2.y;
|
|
|
|
tags[i] = 1;
|
|
|
|
contours[i] = i;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
points[i].x = loader->pp3.x;
|
|
|
|
points[i].y = loader->pp3.y;
|
|
|
|
tags[i] = 1;
|
|
|
|
contours[i] = i;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
points[i].x = loader->pp4.x;
|
|
|
|
points[i].y = loader->pp4.y;
|
|
|
|
tags[i] = 1;
|
|
|
|
contours[i] = i;
|
|
|
|
|
|
|
|
outline.points = points;
|
|
|
|
outline.tags = tags;
|
|
|
|
outline.contours = contours;
|
|
|
|
|
|
|
|
/* this call provides additional offsets */
|
|
|
|
/* for each component's translation */
|
|
|
|
if ( ( error = TT_Vary_Apply_Glyph_Deltas(
|
2007-06-17 07:31:23 +02:00
|
|
|
face,
|
|
|
|
glyph_index,
|
2015-05-31 12:21:34 +02:00
|
|
|
&outline,
|
2015-06-30 09:46:39 +02:00
|
|
|
(FT_UInt)outline.n_points ) ) != 0 )
|
2015-05-31 12:21:34 +02:00
|
|
|
goto Exit1;
|
* 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-08-03 12:23:30 +02:00
|
|
|
subglyph = gloader->current.subglyphs;
|
* 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-05-31 12:21:34 +02:00
|
|
|
for ( i = 0; i < limit; i++, subglyph++ )
|
* 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
|
|
|
{
|
2016-08-06 23:12:55 +02:00
|
|
|
if ( subglyph->flags & ARGS_ARE_XY_VALUES )
|
|
|
|
{
|
|
|
|
subglyph->arg1 = (FT_Int16)points[i].x;
|
|
|
|
subglyph->arg2 = (FT_Int16)points[i].y;
|
|
|
|
}
|
* 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-05-31 12:21:34 +02:00
|
|
|
loader->pp1.x = points[i + 0].x;
|
|
|
|
loader->pp1.y = points[i + 0].y;
|
|
|
|
loader->pp2.x = points[i + 1].x;
|
|
|
|
loader->pp2.y = points[i + 1].y;
|
2013-12-10 09:40:36 +01:00
|
|
|
|
2015-05-31 12:21:34 +02:00
|
|
|
loader->pp3.x = points[i + 2].x;
|
|
|
|
loader->pp3.y = points[i + 2].y;
|
|
|
|
loader->pp4.x = points[i + 3].x;
|
|
|
|
loader->pp4.y = points[i + 3].y;
|
* 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-05-31 12:21:34 +02:00
|
|
|
Exit1:
|
|
|
|
FT_FREE( outline.points );
|
|
|
|
FT_FREE( outline.tags );
|
|
|
|
FT_FREE( outline.contours );
|
|
|
|
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
* 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 /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
|
|
|
|
2013-12-10 10:12:27 +01:00
|
|
|
/* scale phantom points, if necessary; */
|
|
|
|
/* they get rounded in `TT_Hint_Glyph' */
|
* 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
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
|
|
|
{
|
|
|
|
loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
|
|
|
|
loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
|
2013-12-10 10:12:27 +01:00
|
|
|
/* pp1.y and pp2.y are always zero */
|
|
|
|
|
|
|
|
loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale );
|
* 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
|
|
|
loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );
|
2013-12-10 10:12:27 +01:00
|
|
|
loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale );
|
* 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
|
|
|
loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
|
|
|
|
}
|
|
|
|
|
2000-03-28 13:19:28 +02:00
|
|
|
/* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* `as is' in the glyph slot (the client application will be */
|
2002-08-16 14:46:52 +02:00
|
|
|
/* responsible for interpreting these data)... */
|
2000-03-28 13:19:28 +02:00
|
|
|
if ( loader->load_flags & FT_LOAD_NO_RECURSE )
|
|
|
|
{
|
- 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
|
|
|
FT_GlyphLoader_Add( gloader );
|
2005-08-16 03:54:59 +02:00
|
|
|
loader->glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
goto Exit;
|
2000-03-28 13:19:28 +02:00
|
|
|
}
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/*********************************************************************/
|
2000-06-25 09:43:15 +02:00
|
|
|
/*********************************************************************/
|
|
|
|
/*********************************************************************/
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2008-05-25 18:49:29 +02:00
|
|
|
FT_UInt n, num_base_points;
|
2015-04-12 05:54:19 +02:00
|
|
|
FT_SubGlyph subglyph = NULL;
|
2007-05-19 09:01:49 +02:00
|
|
|
|
2008-05-25 18:49:29 +02:00
|
|
|
FT_UInt num_points = start_point;
|
|
|
|
FT_UInt num_subglyphs = gloader->current.num_subglyphs;
|
|
|
|
FT_UInt num_base_subgs = gloader->base.num_subglyphs;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2008-05-25 18:49:29 +02:00
|
|
|
FT_Stream old_stream = loader->stream;
|
2010-05-20 15:38:00 +02:00
|
|
|
FT_Int old_byte_len = loader->byte_len;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
|
- 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
|
|
|
FT_GlyphLoader_Add( gloader );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* read each subglyph independently */
|
2005-08-19 10:56:29 +02:00
|
|
|
for ( n = 0; n < num_subglyphs; n++ )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_Vector pp[4];
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
/* Each time we call load_truetype_glyph in this loop, the */
|
|
|
|
/* value of `gloader.base.subglyphs' can change due to table */
|
|
|
|
/* reallocations. We thus need to recompute the subglyph */
|
|
|
|
/* pointer on each iteration. */
|
- 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
|
|
|
subglyph = gloader->base.subglyphs + num_base_subgs + n;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
pp[0] = loader->pp1;
|
|
|
|
pp[1] = loader->pp2;
|
|
|
|
pp[2] = loader->pp3;
|
|
|
|
pp[3] = loader->pp4;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2015-02-17 08:03:05 +01:00
|
|
|
num_base_points = (FT_UInt)gloader->base.outline.n_points;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2015-02-17 08:03:05 +01:00
|
|
|
error = load_truetype_glyph( loader,
|
|
|
|
(FT_UInt)subglyph->index,
|
|
|
|
recurse_count + 1,
|
|
|
|
FALSE );
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( error )
|
2005-08-16 03:54:59 +02:00
|
|
|
goto Exit;
|
2000-05-17 22:56:01 +02:00
|
|
|
|
2001-05-16 19:49:07 +02:00
|
|
|
/* restore subglyph pointer */
|
- 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
|
|
|
subglyph = gloader->base.subglyphs + num_base_subgs + n;
|
|
|
|
|
2013-12-10 09:40:36 +01:00
|
|
|
/* restore phantom points if necessary */
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( !( subglyph->flags & USE_MY_METRICS ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-08-16 03:54:59 +02:00
|
|
|
loader->pp1 = pp[0];
|
|
|
|
loader->pp2 = pp[1];
|
|
|
|
loader->pp3 = pp[2];
|
|
|
|
loader->pp4 = pp[3];
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2015-02-17 08:03:05 +01:00
|
|
|
num_points = (FT_UInt)gloader->base.outline.n_points;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( num_points == num_base_points )
|
|
|
|
continue;
|
|
|
|
|
2007-05-19 09:01:49 +02:00
|
|
|
/* gloader->base.outline consists of three parts: */
|
|
|
|
/* 0 -(1)-> start_point -(2)-> num_base_points -(3)-> n_points. */
|
|
|
|
/* */
|
|
|
|
/* (1): exists from the beginning */
|
|
|
|
/* (2): components that have been loaded so far */
|
|
|
|
/* (3): the newly loaded component */
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
error = TT_Process_Composite_Component( loader,
|
|
|
|
subglyph,
|
|
|
|
start_point,
|
|
|
|
num_base_points );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2010-05-20 15:38:00 +02:00
|
|
|
loader->stream = old_stream;
|
|
|
|
loader->byte_len = old_byte_len;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* process the glyph */
|
|
|
|
loader->ins_pos = ins_pos;
|
|
|
|
if ( IS_HINTED( loader->load_flags ) &&
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2005-08-16 03:54:59 +02:00
|
|
|
subglyph->flags & WE_HAVE_INSTR &&
|
|
|
|
#endif
|
|
|
|
num_points > start_point )
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
{
|
|
|
|
error = TT_Process_Composite_Glyph( loader,
|
|
|
|
start_point,
|
|
|
|
start_contour );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
2003-01-08 10:59:17 +01:00
|
|
|
else
|
|
|
|
{
|
2007-05-19 09:01:49 +02:00
|
|
|
/* invalid composite count (negative but not -1) */
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Outline );
|
2005-08-16 03:54:59 +02:00
|
|
|
goto Exit;
|
2003-01-08 10:59:17 +01:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
2000-02-02 13:16:19 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
Exit:
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( opened_frame )
|
2000-06-25 06:49:19 +02:00
|
|
|
face->forget_glyph_frame( loader );
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2002-08-01 17:29:17 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2002-08-06 23:47:40 +02:00
|
|
|
if ( glyph_data_loaded )
|
|
|
|
face->root.internal->incremental_interface->funcs->free_glyph_data(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
&glyph_data );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2002-08-01 17:29:17 +02:00
|
|
|
#endif
|
|
|
|
|
2000-05-17 01:44:38 +02:00
|
|
|
return error;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
static FT_Error
|
2007-05-19 09:01:49 +02:00
|
|
|
compute_glyph_metrics( TT_Loader loader,
|
|
|
|
FT_UInt glyph_index )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2015-08-06 06:06:14 +02:00
|
|
|
TT_Face face = loader->face;
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
|
|
|
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
2013-05-17 13:51:07 +02:00
|
|
|
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
|
|
|
#endif
|
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_BBox bbox;
|
2001-06-18 16:23:45 +02:00
|
|
|
FT_Fixed y_scale;
|
2000-02-02 13:16:19 +01:00
|
|
|
TT_GlyphSlot glyph = loader->glyph;
|
2015-08-06 06:06:14 +02:00
|
|
|
TT_Size size = loader->size;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
y_scale = 0x10000L;
|
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
2000-02-02 13:16:19 +01:00
|
|
|
y_scale = size->root.metrics.y_scale;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE )
|
2000-03-28 13:19:28 +02:00
|
|
|
FT_Outline_Get_CBox( &glyph->outline, &bbox );
|
|
|
|
else
|
|
|
|
bbox = loader->bbox;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2007-05-19 09:01:49 +02:00
|
|
|
/* get the device-independent horizontal advance; it is scaled later */
|
|
|
|
/* by the base layer. */
|
2011-04-21 08:21:37 +02:00
|
|
|
glyph->linearHoriAdvance = loader->linear;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
glyph->metrics.horiBearingX = bbox.xMin;
|
|
|
|
glyph->metrics.horiBearingY = bbox.yMax;
|
2000-02-02 13:16:19 +01:00
|
|
|
glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
/* Adjust advance width to the value contained in the hdmx table */
|
|
|
|
/* unless FT_LOAD_COMPUTE_METRICS is set or backwards compatibility */
|
|
|
|
/* mode of the v40 interpreter is active. See `ttinterp.h' for */
|
|
|
|
/* details on backwards compatibility mode. */
|
|
|
|
if (
|
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
!( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
|
|
|
|
( loader->exec && loader->exec->backwards_compatibility ) ) &&
|
|
|
|
#endif
|
|
|
|
!face->postscript.isFixedPitch &&
|
|
|
|
IS_HINTED( loader->load_flags ) &&
|
|
|
|
!( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) )
|
2009-09-02 13:06:33 +02:00
|
|
|
{
|
|
|
|
FT_Byte* widthp;
|
|
|
|
|
|
|
|
|
|
|
|
widthp = tt_face_get_device_metrics( face,
|
|
|
|
size->root.metrics.x_ppem,
|
|
|
|
glyph_index );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
|
|
|
{
|
|
|
|
FT_Bool ignore_x_mode;
|
|
|
|
|
|
|
|
|
|
|
|
ignore_x_mode = FT_BOOL( FT_LOAD_TARGET_MODE( loader->load_flags ) !=
|
|
|
|
FT_RENDER_MODE_MONO );
|
|
|
|
|
|
|
|
if ( widthp &&
|
|
|
|
( ( ignore_x_mode && loader->exec->compatible_widths ) ||
|
|
|
|
!ignore_x_mode ||
|
|
|
|
SPH_OPTION_BITMAP_WIDTHS ) )
|
2015-08-01 07:53:48 +02:00
|
|
|
glyph->metrics.horiAdvance = *widthp * 64;
|
2013-05-17 13:51:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
if ( widthp )
|
2015-08-01 07:53:48 +02:00
|
|
|
glyph->metrics.horiAdvance = *widthp * 64;
|
2013-05-17 13:51:07 +02:00
|
|
|
}
|
2009-09-02 13:06:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set glyph dimensions */
|
|
|
|
glyph->metrics.width = bbox.xMax - bbox.xMin;
|
|
|
|
glyph->metrics.height = bbox.yMax - bbox.yMin;
|
|
|
|
|
|
|
|
/* Now take care of vertical metrics. In the case where there is */
|
|
|
|
/* no vertical information within the font (relatively common), */
|
|
|
|
/* create some metrics manually */
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2006-01-15 08:30:32 +01:00
|
|
|
FT_Pos top; /* scaled vertical top side bearing */
|
|
|
|
FT_Pos advance; /* scaled vertical advance height */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-06-03 09:56:21 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
/* Get the unscaled top bearing and advance height. */
|
2009-09-08 07:06:54 +02:00
|
|
|
if ( face->vertical_info &&
|
1999-12-17 00:11:37 +01:00
|
|
|
face->vertical.number_Of_VMetrics > 0 )
|
|
|
|
{
|
2006-01-15 07:24:53 +01:00
|
|
|
top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,
|
|
|
|
y_scale );
|
* src/base/ftoutln.c (FT_Outline_Embolden): Strength should be
halved.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Change the default
strength.
Don't increase slot->advance.y.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 2.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.ac (version_info): Set to 9:9:3.
Currently, we are still binary compatible.
* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/219/2110/, s/2.1.9/2.1.10/.
* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.9/2.1.10/.
* docs/CHANGES, docs/VERSION.DLL: Updated.
* ChangeLog: Split off older entries into...
* ChangeLog.20, ChangeLog.21: These new files.
The next release will be 2.2.0, so don't worry about source code
backwards compatibility.
* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineToFunc, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc, FT_SpanFunc, FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_RenderFunc, FT_Renderer_TransformFunc): Decorate
parameters with `const' where appropriate.
* src/sfnt/ttsbit.c (tt_face_load_sbit_image): Compute vertBearingY
to make glyphs centered vertically.
* src/truetype/ttgload.c (compute_glyph_metrics): Compute
vertBearingY to make glyphs centered vertically.
Fix some bugs in vertical metrics:
. loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
units.
. As we use the glyph's cbox to calculate the top bearing now
there iss no need to adjust `top'.
* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE): Use FT_UShort to be
in sync with OTV_OPTIONAL_OFFSET. Reported by YAMATO Masatake.
* docs/release: Update.
2005-06-16 21:07:08 +02:00
|
|
|
|
|
|
|
if ( loader->pp3.y <= loader->pp4.y )
|
2006-01-15 07:24:53 +01:00
|
|
|
advance = 0;
|
* src/base/ftoutln.c (FT_Outline_Embolden): Strength should be
halved.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Change the default
strength.
Don't increase slot->advance.y.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 2.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.ac (version_info): Set to 9:9:3.
Currently, we are still binary compatible.
* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/219/2110/, s/2.1.9/2.1.10/.
* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.9/2.1.10/.
* docs/CHANGES, docs/VERSION.DLL: Updated.
* ChangeLog: Split off older entries into...
* ChangeLog.20, ChangeLog.21: These new files.
The next release will be 2.2.0, so don't worry about source code
backwards compatibility.
* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineToFunc, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc, FT_SpanFunc, FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_RenderFunc, FT_Renderer_TransformFunc): Decorate
parameters with `const' where appropriate.
* src/sfnt/ttsbit.c (tt_face_load_sbit_image): Compute vertBearingY
to make glyphs centered vertically.
* src/truetype/ttgload.c (compute_glyph_metrics): Compute
vertBearingY to make glyphs centered vertically.
Fix some bugs in vertical metrics:
. loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
units.
. As we use the glyph's cbox to calculate the top bearing now
there iss no need to adjust `top'.
* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE): Use FT_UShort to be
in sync with OTV_OPTIONAL_OFFSET. Reported by YAMATO Masatake.
* docs/release: Update.
2005-06-16 21:07:08 +02:00
|
|
|
else
|
2006-01-15 07:24:53 +01:00
|
|
|
advance = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y,
|
|
|
|
y_scale );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-01-15 07:24:53 +01:00
|
|
|
FT_Pos height;
|
* src/base/ftoutln.c (FT_Outline_Embolden): Strength should be
halved.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Change the default
strength.
Don't increase slot->advance.y.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 2.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.ac (version_info): Set to 9:9:3.
Currently, we are still binary compatible.
* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/219/2110/, s/2.1.9/2.1.10/.
* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.9/2.1.10/.
* docs/CHANGES, docs/VERSION.DLL: Updated.
* ChangeLog: Split off older entries into...
* ChangeLog.20, ChangeLog.21: These new files.
The next release will be 2.2.0, so don't worry about source code
backwards compatibility.
* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineToFunc, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc, FT_SpanFunc, FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_RenderFunc, FT_Renderer_TransformFunc): Decorate
parameters with `const' where appropriate.
* src/sfnt/ttsbit.c (tt_face_load_sbit_image): Compute vertBearingY
to make glyphs centered vertically.
* src/truetype/ttgload.c (compute_glyph_metrics): Compute
vertBearingY to make glyphs centered vertically.
Fix some bugs in vertical metrics:
. loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
units.
. As we use the glyph's cbox to calculate the top bearing now
there iss no need to adjust `top'.
* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE): Use FT_UShort to be
in sync with OTV_OPTIONAL_OFFSET. Reported by YAMATO Masatake.
* docs/release: Update.
2005-06-16 21:07:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* XXX Compute top side bearing and advance height in */
|
|
|
|
/* Get_VMetrics instead of here. */
|
2000-06-12 21:36:41 +02:00
|
|
|
|
|
|
|
/* NOTE: The OS/2 values are the only `portable' ones, */
|
|
|
|
/* which is why we use them, if there is an OS/2 */
|
|
|
|
/* table in the font. Otherwise, we use the */
|
|
|
|
/* values defined in the horizontal header. */
|
* src/base/ftoutln.c (FT_Outline_Embolden): Strength should be
halved.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Change the default
strength.
Don't increase slot->advance.y.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 2.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.ac (version_info): Set to 9:9:3.
Currently, we are still binary compatible.
* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/219/2110/, s/2.1.9/2.1.10/.
* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.9/2.1.10/.
* docs/CHANGES, docs/VERSION.DLL: Updated.
* ChangeLog: Split off older entries into...
* ChangeLog.20, ChangeLog.21: These new files.
The next release will be 2.2.0, so don't worry about source code
backwards compatibility.
* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineToFunc, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc, FT_SpanFunc, FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_RenderFunc, FT_Renderer_TransformFunc): Decorate
parameters with `const' where appropriate.
* src/sfnt/ttsbit.c (tt_face_load_sbit_image): Compute vertBearingY
to make glyphs centered vertically.
* src/truetype/ttgload.c (compute_glyph_metrics): Compute
vertBearingY to make glyphs centered vertically.
Fix some bugs in vertical metrics:
. loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
units.
. As we use the glyph's cbox to calculate the top bearing now
there iss no need to adjust `top'.
* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE): Use FT_UShort to be
in sync with OTV_OPTIONAL_OFFSET. Reported by YAMATO Masatake.
* docs/release: Update.
2005-06-16 21:07:08 +02:00
|
|
|
|
2006-01-15 07:24:53 +01:00
|
|
|
height = (FT_Short)FT_DivFix( bbox.yMax - bbox.yMin,
|
|
|
|
y_scale );
|
2002-04-01 16:25:28 +02:00
|
|
|
if ( face->os2.version != 0xFFFFU )
|
2006-01-15 07:24:53 +01:00
|
|
|
advance = (FT_Pos)( face->os2.sTypoAscender -
|
|
|
|
face->os2.sTypoDescender );
|
1999-12-17 00:11:37 +01:00
|
|
|
else
|
2006-01-15 07:24:53 +01:00
|
|
|
advance = (FT_Pos)( face->horizontal.Ascender -
|
|
|
|
face->horizontal.Descender );
|
* src/base/ftoutln.c (FT_Outline_Embolden): Strength should be
halved.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Change the default
strength.
Don't increase slot->advance.y.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 2.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.ac (version_info): Set to 9:9:3.
Currently, we are still binary compatible.
* builds/win32/visualc/index.html,
builds/win32/visualc/freetype.dsp,
builds/win32/visualc/freetype.vcproj: s/219/2110/, s/2.1.9/2.1.10/.
* builds/freetype.mk (refdoc), README, Jamfile (RefDoc):
s/2.1.9/2.1.10/.
* docs/CHANGES, docs/VERSION.DLL: Updated.
* ChangeLog: Split off older entries into...
* ChangeLog.20, ChangeLog.21: These new files.
The next release will be 2.2.0, so don't worry about source code
backwards compatibility.
* include/freetype/ftimage.h (FT_Outline_MoveToFunc,
FT_Outline_LineToFunc, FT_Outline_ConicToFunc,
FT_Outline_CubicToFunc, FT_SpanFunc, FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_RenderFunc, FT_Renderer_TransformFunc): Decorate
parameters with `const' where appropriate.
* src/sfnt/ttsbit.c (tt_face_load_sbit_image): Compute vertBearingY
to make glyphs centered vertically.
* src/truetype/ttgload.c (compute_glyph_metrics): Compute
vertBearingY to make glyphs centered vertically.
Fix some bugs in vertical metrics:
. loader->pp3.y and loader->pp4.y are in 26.6 format, not in font
units.
. As we use the glyph's cbox to calculate the top bearing now
there iss no need to adjust `top'.
* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE): Use FT_UShort to be
in sync with OTV_OPTIONAL_OFFSET. Reported by YAMATO Masatake.
* docs/release: Update.
2005-06-16 21:07:08 +02:00
|
|
|
|
2006-01-15 07:24:53 +01:00
|
|
|
top = ( advance - height ) / 2;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2003-02-13 18:49:27 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
|
|
|
{
|
2006-01-15 07:24:53 +01:00
|
|
|
FT_Incremental_InterfaceRec* incr;
|
|
|
|
FT_Incremental_MetricsRec metrics;
|
|
|
|
FT_Error error;
|
2003-02-13 18:49:27 +01:00
|
|
|
|
2003-04-23 17:50:27 +02:00
|
|
|
|
2006-01-15 07:24:53 +01:00
|
|
|
incr = face->root.internal->incremental_interface;
|
2003-02-13 18:49:27 +01:00
|
|
|
|
2006-01-15 07:24:53 +01:00
|
|
|
/* If this is an incrementally loaded font see if there are */
|
|
|
|
/* overriding metrics for this glyph. */
|
|
|
|
if ( incr && incr->funcs->get_glyph_metrics )
|
|
|
|
{
|
|
|
|
metrics.bearing_x = 0;
|
|
|
|
metrics.bearing_y = top;
|
|
|
|
metrics.advance = advance;
|
2006-01-15 08:30:32 +01:00
|
|
|
|
2006-01-15 07:24:53 +01:00
|
|
|
error = incr->funcs->get_glyph_metrics( incr->object,
|
|
|
|
glyph_index,
|
|
|
|
TRUE,
|
|
|
|
&metrics );
|
|
|
|
if ( error )
|
|
|
|
return error;
|
2003-02-13 18:49:27 +01:00
|
|
|
|
2006-01-15 07:24:53 +01:00
|
|
|
top = metrics.bearing_y;
|
|
|
|
advance = metrics.advance;
|
|
|
|
}
|
2003-02-13 18:49:27 +01:00
|
|
|
}
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/* GWW: Do vertical metrics get loaded incrementally too? */
|
|
|
|
|
2003-02-13 18:49:27 +01:00
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
|
|
|
|
2006-01-15 07:24:53 +01:00
|
|
|
glyph->linearVertAdvance = advance;
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* scale the metrics */
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2009-11-03 15:46:35 +01:00
|
|
|
top = FT_MulFix( top, y_scale );
|
2006-01-15 07:24:53 +01:00
|
|
|
advance = FT_MulFix( advance, y_scale );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
/* XXX: for now, we have no better algorithm for the lsb, but it */
|
|
|
|
/* should work fine. */
|
|
|
|
/* */
|
2009-09-02 13:06:33 +02:00
|
|
|
glyph->metrics.vertBearingX = glyph->metrics.horiBearingX -
|
|
|
|
glyph->metrics.horiAdvance / 2;
|
1999-12-17 00:11:37 +01:00
|
|
|
glyph->metrics.vertBearingY = top;
|
|
|
|
glyph->metrics.vertAdvance = advance;
|
|
|
|
}
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
return 0;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2005-08-19 10:56:29 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
static FT_Error
|
|
|
|
load_sbit_image( TT_Size size,
|
|
|
|
TT_GlyphSlot glyph,
|
|
|
|
FT_UInt glyph_index,
|
|
|
|
FT_Int32 load_flags )
|
|
|
|
{
|
|
|
|
TT_Face face;
|
|
|
|
SFNT_Service sfnt;
|
|
|
|
FT_Stream stream;
|
|
|
|
FT_Error error;
|
|
|
|
TT_SBit_MetricsRec metrics;
|
|
|
|
|
2005-08-19 10:56:29 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
face = (TT_Face)glyph->face;
|
|
|
|
sfnt = (SFNT_Service)face->sfnt;
|
|
|
|
stream = face->root.stream;
|
|
|
|
|
|
|
|
error = sfnt->load_sbit_image( face,
|
* 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
|
|
|
size->strike_index,
|
2005-08-16 03:54:59 +02:00
|
|
|
glyph_index,
|
2015-02-17 08:03:05 +01:00
|
|
|
(FT_UInt)load_flags,
|
2005-08-16 03:54:59 +02:00
|
|
|
stream,
|
|
|
|
&glyph->bitmap,
|
|
|
|
&metrics );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
glyph->outline.n_points = 0;
|
|
|
|
glyph->outline.n_contours = 0;
|
|
|
|
|
2015-08-01 07:53:48 +02:00
|
|
|
glyph->metrics.width = (FT_Pos)metrics.width * 64;
|
|
|
|
glyph->metrics.height = (FT_Pos)metrics.height * 64;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2015-08-01 07:53:48 +02:00
|
|
|
glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX * 64;
|
|
|
|
glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY * 64;
|
|
|
|
glyph->metrics.horiAdvance = (FT_Pos)metrics.horiAdvance * 64;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2015-08-01 07:53:48 +02:00
|
|
|
glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX * 64;
|
|
|
|
glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY * 64;
|
|
|
|
glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance * 64;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
glyph->format = FT_GLYPH_FORMAT_BITMAP;
|
2009-11-03 15:46:35 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
|
|
|
|
{
|
|
|
|
glyph->bitmap_left = metrics.vertBearingX;
|
|
|
|
glyph->bitmap_top = metrics.vertBearingY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
glyph->bitmap_left = metrics.horiBearingX;
|
|
|
|
glyph->bitmap_top = metrics.horiBearingY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
2005-08-19 10:56:29 +02:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
static FT_Error
|
|
|
|
tt_loader_init( TT_Loader loader,
|
|
|
|
TT_Size size,
|
|
|
|
TT_GlyphSlot glyph,
|
2009-11-03 15:46:35 +01:00
|
|
|
FT_Int32 load_flags,
|
|
|
|
FT_Bool glyf_table_only )
|
2005-08-16 03:54:59 +02:00
|
|
|
{
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
FT_Error error;
|
|
|
|
|
2005-08-19 10:56:29 +02:00
|
|
|
TT_Face face;
|
|
|
|
FT_Stream stream;
|
2012-06-27 08:16:06 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2011-02-01 07:08:43 +01:00
|
|
|
FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
|
2012-06-27 08:16:06 +02:00
|
|
|
#endif
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
|
|
|
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( (TT_Face)glyph->face );
|
|
|
|
#endif
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
|
2005-08-19 10:56:29 +02:00
|
|
|
face = (TT_Face)glyph->face;
|
2005-08-16 03:54:59 +02:00
|
|
|
stream = face->root.stream;
|
|
|
|
|
2016-09-28 19:06:21 +02:00
|
|
|
FT_ZERO( loader );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
/* load execution context */
|
2009-11-03 15:46:35 +01:00
|
|
|
if ( IS_HINTED( load_flags ) && !glyf_table_only )
|
2005-08-16 03:54:59 +02:00
|
|
|
{
|
|
|
|
TT_ExecContext exec;
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
FT_Bool grayscale = TRUE;
|
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
FT_Bool subpixel_hinting_lean;
|
|
|
|
FT_Bool grayscale_cleartype;
|
|
|
|
#endif
|
2013-05-17 13:51:07 +02:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2015-05-23 07:21:25 +02:00
|
|
|
FT_Bool subpixel_hinting = FALSE;
|
2013-05-17 13:51:07 +02:00
|
|
|
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
#if 0
|
2013-05-17 13:51:07 +02:00
|
|
|
/* not used yet */
|
|
|
|
FT_Bool compatible_widths;
|
|
|
|
FT_Bool symmetrical_smoothing;
|
|
|
|
FT_Bool bgr;
|
2015-05-24 09:50:24 +02:00
|
|
|
FT_Bool vertical_lcd;
|
2013-05-17 13:51:07 +02:00
|
|
|
FT_Bool subpixel_positioned;
|
2015-05-24 09:50:24 +02:00
|
|
|
FT_Bool gray_cleartype;
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
#endif
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
FT_Bool reexecute = FALSE;
|
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2014-07-12 19:28:14 +02:00
|
|
|
if ( size->bytecode_ready < 0 || size->cvt_ready < 0 )
|
2007-01-05 16:32:01 +01:00
|
|
|
{
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
error = tt_size_ready_bytecode( size, pedantic );
|
2007-01-05 16:32:01 +01:00
|
|
|
if ( error )
|
|
|
|
return error;
|
|
|
|
}
|
2014-07-12 19:28:14 +02:00
|
|
|
else if ( size->bytecode_ready )
|
|
|
|
return size->bytecode_ready;
|
|
|
|
else if ( size->cvt_ready )
|
|
|
|
return size->cvt_ready;
|
2007-01-05 16:32:01 +01:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
/* query new execution context */
|
2015-01-14 17:46:55 +01:00
|
|
|
exec = size->context;
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( !exec )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Could_Not_Find_Context );
|
2005-08-16 03:54:59 +02:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
|
|
|
{
|
|
|
|
subpixel_hinting_lean = TRUE;
|
|
|
|
grayscale_cleartype = !FT_BOOL( load_flags &
|
|
|
|
FT_LOAD_TARGET_LCD ||
|
|
|
|
load_flags &
|
|
|
|
FT_LOAD_TARGET_LCD_V );
|
|
|
|
exec->vertical_lcd_lean = FT_BOOL( load_flags &
|
|
|
|
FT_LOAD_TARGET_LCD_V );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
subpixel_hinting_lean = FALSE;
|
|
|
|
grayscale_cleartype = FALSE;
|
|
|
|
exec->vertical_lcd_lean = FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
{
|
2015-05-23 07:21:25 +02:00
|
|
|
subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
FT_RENDER_MODE_MONO ) &&
|
|
|
|
SPH_OPTION_SET_SUBPIXEL );
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2015-05-23 07:21:25 +02:00
|
|
|
if ( subpixel_hinting )
|
2013-12-11 09:01:13 +01:00
|
|
|
grayscale = FALSE;
|
2013-05-17 13:51:07 +02:00
|
|
|
else if ( SPH_OPTION_SET_GRAYSCALE )
|
|
|
|
{
|
2015-05-23 07:21:25 +02:00
|
|
|
grayscale = TRUE;
|
|
|
|
subpixel_hinting = FALSE;
|
2013-05-17 13:51:07 +02:00
|
|
|
}
|
|
|
|
else
|
2013-12-11 09:01:13 +01:00
|
|
|
grayscale = FALSE;
|
2013-05-17 13:51:07 +02:00
|
|
|
|
|
|
|
if ( FT_IS_TRICKY( glyph->face ) )
|
2015-05-23 07:21:25 +02:00
|
|
|
subpixel_hinting = FALSE;
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2015-05-23 07:21:25 +02:00
|
|
|
exec->ignore_x_mode = subpixel_hinting || grayscale;
|
2013-05-17 13:51:07 +02:00
|
|
|
exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
|
|
|
|
if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
|
|
|
|
exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
|
|
|
#if 1
|
2013-05-17 13:51:07 +02:00
|
|
|
exec->compatible_widths = SPH_OPTION_SET_COMPATIBLE_WIDTHS;
|
2015-05-24 09:50:24 +02:00
|
|
|
exec->symmetrical_smoothing = TRUE;
|
2013-05-17 13:51:07 +02:00
|
|
|
exec->bgr = FALSE;
|
2015-05-24 09:50:24 +02:00
|
|
|
exec->vertical_lcd = FALSE;
|
2013-05-17 13:51:07 +02:00
|
|
|
exec->subpixel_positioned = TRUE;
|
2015-05-24 09:50:24 +02:00
|
|
|
exec->gray_cleartype = FALSE;
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
#else /* 0 */
|
2013-05-17 13:51:07 +02:00
|
|
|
exec->compatible_widths =
|
|
|
|
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
TT_LOAD_COMPATIBLE_WIDTHS );
|
|
|
|
exec->symmetrical_smoothing =
|
|
|
|
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
TT_LOAD_SYMMETRICAL_SMOOTHING );
|
|
|
|
exec->bgr =
|
|
|
|
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
TT_LOAD_BGR );
|
2015-05-24 09:50:24 +02:00
|
|
|
exec->vertical_lcd =
|
|
|
|
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
TT_LOAD_VERTICAL_LCD );
|
2013-05-17 13:51:07 +02:00
|
|
|
exec->subpixel_positioned =
|
|
|
|
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
TT_LOAD_SUBPIXEL_POSITIONED );
|
2015-05-24 09:50:24 +02:00
|
|
|
exec->gray_cleartype =
|
|
|
|
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
TT_LOAD_GRAY_CLEARTYPE );
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
#endif /* 0 */
|
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
}
|
|
|
|
else
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
2006-11-22 11:36:55 +01:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
|
|
|
grayscale = FT_BOOL( !subpixel_hinting_lean &&
|
|
|
|
FT_LOAD_TARGET_MODE( load_flags ) !=
|
|
|
|
FT_RENDER_MODE_MONO );
|
|
|
|
else
|
|
|
|
#endif
|
2013-05-17 13:51:07 +02:00
|
|
|
grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
FT_RENDER_MODE_MONO );
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
error = TT_Load_Context( exec, face, size );
|
|
|
|
if ( error )
|
|
|
|
return error;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
{
|
2013-05-17 13:51:07 +02:00
|
|
|
/* a change from mono to subpixel rendering (and vice versa) */
|
|
|
|
/* requires a re-execution of the CVT program */
|
2015-05-23 07:21:25 +02:00
|
|
|
if ( subpixel_hinting != exec->subpixel_hinting )
|
2013-05-17 13:51:07 +02:00
|
|
|
{
|
|
|
|
FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
|
|
|
|
" re-executing `prep' table\n" ));
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2015-05-23 07:21:25 +02:00
|
|
|
exec->subpixel_hinting = subpixel_hinting;
|
|
|
|
reexecute = TRUE;
|
2013-05-17 13:51:07 +02:00
|
|
|
}
|
2012-12-27 01:08:24 +01:00
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
/* a change from mono to grayscale rendering (and vice versa) */
|
|
|
|
/* requires a re-execution of the CVT program */
|
2013-12-11 09:01:13 +01:00
|
|
|
if ( grayscale != exec->grayscale )
|
2013-05-17 13:51:07 +02:00
|
|
|
{
|
|
|
|
FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
|
|
|
|
" re-executing `prep' table\n" ));
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2013-12-11 09:01:13 +01:00
|
|
|
exec->grayscale = grayscale;
|
|
|
|
reexecute = TRUE;
|
2013-05-17 13:51:07 +02:00
|
|
|
}
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
}
|
2013-05-17 13:51:07 +02:00
|
|
|
else
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
2012-12-27 01:08:24 +01:00
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
{
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
|
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
|
|
|
|
{
|
|
|
|
/* a change from mono to subpixel rendering (and vice versa) */
|
|
|
|
/* requires a re-execution of the CVT program */
|
|
|
|
if ( subpixel_hinting_lean != exec->subpixel_hinting_lean )
|
|
|
|
{
|
|
|
|
FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
|
|
|
|
" re-executing `prep' table\n" ));
|
|
|
|
|
|
|
|
exec->subpixel_hinting_lean = subpixel_hinting_lean;
|
|
|
|
reexecute = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* a change from colored to grayscale subpixel rendering (and */
|
|
|
|
/* vice versa) requires a re-execution of the CVT program */
|
|
|
|
if ( grayscale_cleartype != exec->grayscale_cleartype )
|
|
|
|
{
|
|
|
|
FT_TRACE4(( "tt_loader_init: grayscale subpixel hinting change,"
|
|
|
|
" re-executing `prep' table\n" ));
|
|
|
|
|
|
|
|
exec->grayscale_cleartype = grayscale_cleartype;
|
|
|
|
reexecute = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
/* a change from mono to grayscale rendering (and vice versa) */
|
|
|
|
/* requires a re-execution of the CVT program */
|
|
|
|
if ( grayscale != exec->grayscale )
|
|
|
|
{
|
2015-05-22 22:02:15 +02:00
|
|
|
FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
|
2013-05-17 13:51:07 +02:00
|
|
|
" re-executing `prep' table\n" ));
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
exec->grayscale = grayscale;
|
|
|
|
reexecute = TRUE;
|
|
|
|
}
|
[truetype] Support subpixel hinting.
This is the large, famous `Infinality' patch to support ClearType
bytecode which has been available from
http://www.infinality.net/blog/ for some time, and which has been
refined over the last years. While still experimental, it is now
mature enough to be included directly into FreeType.
Most of the code is based on the ClearType whitepaper written by
Greg Hitchcock
http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
which gives a detailed overview of the necessary changes to the
Microsoft rasterizer so that older fonts are supported. However, a
lot of details are still missing, and this patches provides a
framework to easily handle rendering issues down to the glyph level
of certain fonts.
Note that ClearType support is not completely implemented! In
particular, full support for the options `compatible_widths',
`symmetrical_smoothing, and `bgr' (via the GETINFO bytecode
instruction) is missing.
* src/truetype/ttsubpix.c: New file, providing code to handle
`tweaks', this is, rules for certain glyphs in certain fonts
(including wildcards) which need a special treatment.
* src/truetype/ttsubpix.h: New file, holding the tweaking rules.
* include/freetype/config/ftoption.h, src/devel/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro.
* include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID,
FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros.
* src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include
`ttsubpix.c'.
* src/truetype/ttgload.c: Include `ttsubpix.h'.
[All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(tt_get_metrics): Set tweak flags.
(TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary.
(TT_Process_Simple_Glyph): Compensate emboldening if necessary.
(compute_glyph_metrics): Handle `compatible widths' option.
(tt_loader_init): Handle ClearType GETINFO information bits.
* src/truetype/rules.mk (TT_DRC_SRC): Updated.
* src/truetype/ttinterp.c: Include `ttsubpix.h'.
[Where necessary, changes below are guarded by
TT_CONFIG_OPTION_SUBPIXEL_HINTING.]
(Direct_Move, Direct_Move_X): Extended.
(Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid,
Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45,
SetSuperRound): Add parameter to handle the number of grid lines per
pixel.
(SET_SuperRound, ROUND_None, CUR_Func_round): Updated.
(DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated.
(DO_ROUND, DO_NROUND): Updated.
(DO_RS): Take care of `Typeman' bytecode patterns.
(Ins_FDEF): Add some debugging code. Commented out.
(Ins_ENDF): Restore state.
(Ins_CALL, Ins_LOOPCALL): Handle inline delta functions.
(Ins_MD): Handle `Vacuform' rounds.
(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
Ins_MDRP, Ins_MIRP): Handle tweaks.
(Ins_ALIGNRP): Add tweak guard.
(Ins_IUP, Ins_DELTAP): Handle tweaks.
(Ins_GETINFO): Handle new ClearType bits.
(TT_RunIns): Handle tweaks.
* src/truetype/ttinterp.h: Updated.
(SPH_TweakRule, SPH_ScaleRule): New structures for tweaks.
(TT_ExecContextRec): Add members for subpixel hinting support.
* src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member.
2012-06-18 10:36:06 +02:00
|
|
|
}
|
|
|
|
|
2013-05-17 13:51:07 +02:00
|
|
|
if ( reexecute )
|
2006-11-22 11:36:55 +01:00
|
|
|
{
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
FT_UInt i;
|
2006-11-22 11:36:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
for ( i = 0; i < size->cvt_size; i++ )
|
|
|
|
size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
|
2014-07-12 19:28:14 +02:00
|
|
|
error = tt_size_run_prep( size, pedantic );
|
|
|
|
if ( error )
|
|
|
|
return error;
|
2006-11-22 11:36:55 +01:00
|
|
|
}
|
|
|
|
|
2015-05-22 22:02:15 +02:00
|
|
|
/* check whether the cvt program has disabled hinting */
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( exec->GS.instruct_control & 1 )
|
|
|
|
load_flags |= FT_LOAD_NO_HINTING;
|
|
|
|
|
2007-05-19 09:01:49 +02:00
|
|
|
/* load default graphics state -- if needed */
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( exec->GS.instruct_control & 2 )
|
|
|
|
exec->GS = tt_default_graphics_state;
|
|
|
|
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
|
2015-05-22 22:02:15 +02:00
|
|
|
/* check whether we have a font hinted for ClearType -- */
|
|
|
|
/* note that this flag can also be modified in a glyph's bytecode */
|
[truetype] New implementation of v38 bytecode interpreter [1/3].
This patch prepares data structures and the like.
See added comments in `ttinterp.h' for more information on this and
the following commits in the series.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_SUBPIXEL_HINTING): Assign values to differentiate
between subpixel versions.
(TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL): New macros.
* include/freetype/ftttdrv.h (TT_INTERPRETER_VERSION_40): New macro.
* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
* src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields
`subpixel_hinting_lean', `vertical_lcd_lean',
`backwards_compatibility', `iupx_called', iupy_called', and
`grayscale_cleartype' for new hinting mode.
* src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40
interpreters conditionally.
* src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless
in v38 backwards compatibility mode.
Updated.
(compute_glyph_metrics): Add v38 backwards compatibility mode
constraint for adjusting advance widths.
Updated.
(tt_loader_init): Handle new flags `subpixel_hinting_lean',
`grayscale_cleartype', and `vertical_lcd_lean'.
Updated.
(tt_get_metrics, TT_Process_Simple_Glyph, TT_LOADER_SET_PP):
Updated.
* src/truetype/ttobjs.c (tt_driver_init): Conditionally set
default interpreter version number.
* src/truetype/ttsubpix.c, src/truetype/ttsubpix.h: Updated.
2016-05-18 06:57:59 +02:00
|
|
|
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
|
|
|
|
exec->GS.instruct_control & 4 )
|
2015-05-22 22:02:15 +02:00
|
|
|
exec->ignore_x_mode = 0;
|
2015-05-24 23:29:23 +02:00
|
|
|
#endif
|
2015-05-22 22:02:15 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
|
|
|
|
loader->exec = exec;
|
|
|
|
loader->instructions = exec->glyphIns;
|
|
|
|
}
|
|
|
|
|
2006-08-26 00:45:13 +02:00
|
|
|
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
2005-08-16 03:54:59 +02:00
|
|
|
|
|
|
|
/* get face's glyph loader */
|
2009-11-03 15:46:35 +01:00
|
|
|
if ( !glyf_table_only )
|
2005-08-16 03:54:59 +02:00
|
|
|
{
|
|
|
|
FT_GlyphLoader gloader = glyph->internal->loader;
|
|
|
|
|
2005-08-19 10:56:29 +02:00
|
|
|
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_GlyphLoader_Rewind( gloader );
|
|
|
|
loader->gloader = gloader;
|
|
|
|
}
|
|
|
|
|
2015-02-17 08:03:05 +01:00
|
|
|
loader->load_flags = (FT_ULong)load_flags;
|
2005-08-16 03:54:59 +02:00
|
|
|
|
2015-08-06 06:06:14 +02:00
|
|
|
loader->face = face;
|
|
|
|
loader->size = size;
|
2005-08-16 03:54:59 +02:00
|
|
|
loader->glyph = (FT_GlyphSlot)glyph;
|
|
|
|
loader->stream = stream;
|
|
|
|
|
2015-11-04 11:44:47 +01:00
|
|
|
loader->composites.head = NULL;
|
|
|
|
loader->composites.tail = NULL;
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2005-08-16 03:54:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-04 11:44:47 +01:00
|
|
|
static void
|
|
|
|
tt_loader_done( TT_Loader loader )
|
|
|
|
{
|
|
|
|
FT_List_Finalize( &loader->composites,
|
|
|
|
NULL,
|
|
|
|
loader->face->root.memory,
|
|
|
|
NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_Load_Glyph */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A function used to load a single glyph within a given glyph slot, */
|
|
|
|
/* for a given size. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* glyph :: A handle to a 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. */
|
|
|
|
/* */
|
|
|
|
/* 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> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Load_Glyph( TT_Size size,
|
|
|
|
TT_GlyphSlot glyph,
|
2004-04-19 08:13:50 +02:00
|
|
|
FT_UInt glyph_index,
|
2002-09-21 20:43:10 +02:00
|
|
|
FT_Int32 load_flags )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Error error;
|
|
|
|
TT_LoaderRec loader;
|
2016-09-29 19:49:07 +02:00
|
|
|
TT_Face face = (TT_Face)glyph->face;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2013-08-26 12:55:48 +02:00
|
|
|
FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index ));
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-11-07 07:30:29 +01:00
|
|
|
|
2016-09-29 19:49:07 +02:00
|
|
|
/* try to load embedded bitmap (if any) */
|
2006-01-13 15:53:28 +01:00
|
|
|
if ( size->strike_index != 0xFFFFFFFFUL &&
|
2016-09-29 19:49:07 +02:00
|
|
|
( load_flags & FT_LOAD_NO_BITMAP ) == 0 &&
|
|
|
|
face->is_default_instance )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2005-08-16 03:54:59 +02:00
|
|
|
error = load_sbit_image( size, glyph, glyph_index, load_flags );
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( !error )
|
2009-11-03 15:46:35 +01:00
|
|
|
{
|
2012-04-07 06:39:25 +02:00
|
|
|
if ( FT_IS_SCALABLE( glyph->face ) )
|
2009-11-03 15:46:35 +01:00
|
|
|
{
|
|
|
|
/* for the bbox we need the header only */
|
|
|
|
(void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
|
|
|
|
(void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
|
2015-11-04 11:44:47 +01:00
|
|
|
tt_loader_done( &loader );
|
2009-11-03 15:46:35 +01:00
|
|
|
glyph->linearHoriAdvance = loader.linear;
|
2014-10-16 07:19:46 +02:00
|
|
|
glyph->linearVertAdvance = loader.vadvance;
|
2013-06-10 14:59:21 +02:00
|
|
|
|
2014-10-16 07:19:46 +02:00
|
|
|
/* sanity checks: if `xxxAdvance' in the sbit metric */
|
|
|
|
/* structure isn't set, use `linearXXXAdvance' */
|
2013-06-10 14:59:21 +02:00
|
|
|
if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance )
|
|
|
|
glyph->metrics.horiAdvance =
|
|
|
|
FT_MulFix( glyph->linearHoriAdvance,
|
|
|
|
size->root.metrics.x_scale );
|
2014-10-16 07:19:46 +02:00
|
|
|
if ( !glyph->metrics.vertAdvance && glyph->linearVertAdvance )
|
|
|
|
glyph->metrics.vertAdvance =
|
|
|
|
FT_MulFix( glyph->linearVertAdvance,
|
|
|
|
size->root.metrics.y_scale );
|
2009-11-03 15:46:35 +01:00
|
|
|
}
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2009-11-03 15:46:35 +01:00
|
|
|
}
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
|
|
|
|
2005-10-21 11:08:28 +02:00
|
|
|
/* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */
|
2005-10-19 10:07:38 +02:00
|
|
|
if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Size_Handle );
|
2005-08-20 10:17:44 +02:00
|
|
|
|
2001-12-19 22:09:16 +01:00
|
|
|
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
2001-12-19 22:09:16 +01:00
|
|
|
|
2009-11-03 15:46:35 +01:00
|
|
|
error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );
|
2005-08-16 03:54:59 +02:00
|
|
|
if ( error )
|
|
|
|
return error;
|
2000-02-02 13:16:19 +01:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
2000-06-12 21:36:41 +02:00
|
|
|
glyph->num_subglyphs = 0;
|
2005-08-16 03:54:59 +02:00
|
|
|
glyph->outline.flags = 0;
|
2002-04-01 16:25:28 +02:00
|
|
|
|
2007-05-19 09:01:49 +02:00
|
|
|
/* main loading loop */
|
2009-11-03 15:46:35 +01:00
|
|
|
error = load_truetype_glyph( &loader, glyph_index, 0, FALSE );
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( !error )
|
2005-08-16 03:54:59 +02:00
|
|
|
{
|
|
|
|
if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE )
|
|
|
|
{
|
|
|
|
glyph->num_subglyphs = loader.gloader->base.num_subglyphs;
|
|
|
|
glyph->subglyphs = loader.gloader->base.subglyphs;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-19 10:56:29 +02:00
|
|
|
glyph->outline = loader.gloader->base.outline;
|
2005-08-16 03:54:59 +02:00
|
|
|
glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS;
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2010-04-05 08:22:22 +02:00
|
|
|
/* Translate array so that (0,0) is the glyph's origin. Note */
|
|
|
|
/* that this behaviour is independent on the value of bit 1 of */
|
|
|
|
/* the `flags' field in the `head' table -- at least major */
|
|
|
|
/* applications like Acroread indicate that. */
|
|
|
|
if ( loader.pp1.x )
|
2005-08-16 03:54:59 +02:00
|
|
|
FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
|
|
|
|
}
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2008-06-22 15:40:08 +02:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
|
|
|
|
2008-06-23 00:41:24 +02:00
|
|
|
if ( IS_HINTED( load_flags ) )
|
2008-06-22 15:40:08 +02:00
|
|
|
{
|
2008-06-23 00:41:24 +02:00
|
|
|
if ( loader.exec->GS.scan_control )
|
2008-06-22 15:40:08 +02:00
|
|
|
{
|
2008-06-23 00:41:24 +02:00
|
|
|
/* convert scan conversion mode to FT_OUTLINE_XXX flags */
|
|
|
|
switch ( loader.exec->GS.scan_type )
|
|
|
|
{
|
|
|
|
case 0: /* simple drop-outs including stubs */
|
|
|
|
glyph->outline.flags |= FT_OUTLINE_INCLUDE_STUBS;
|
|
|
|
break;
|
|
|
|
case 1: /* simple drop-outs excluding stubs */
|
|
|
|
/* nothing; it's the default rendering mode */
|
|
|
|
break;
|
|
|
|
case 4: /* smart drop-outs including stubs */
|
|
|
|
glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS |
|
|
|
|
FT_OUTLINE_INCLUDE_STUBS;
|
|
|
|
break;
|
|
|
|
case 5: /* smart drop-outs excluding stubs */
|
|
|
|
glyph->outline.flags |= FT_OUTLINE_SMART_DROPOUTS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: /* no drop-out control */
|
|
|
|
glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
|
|
|
|
break;
|
|
|
|
}
|
2008-06-22 15:40:08 +02:00
|
|
|
}
|
2009-09-02 13:06:33 +02:00
|
|
|
else
|
2008-06-23 00:41:24 +02:00
|
|
|
glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
|
2008-06-22 15:40:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
|
|
|
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
error = compute_glyph_metrics( &loader, glyph_index );
|
2005-08-16 03:54:59 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2015-11-04 11:44:47 +01:00
|
|
|
tt_loader_done( &loader );
|
|
|
|
|
2002-05-05 09:40:16 +02:00
|
|
|
/* Set the `high precision' bit flag. */
|
|
|
|
/* This is _critical_ to get correct output for monochrome */
|
|
|
|
/* TrueType glyphs at all sizes using the bytecode interpreter. */
|
|
|
|
/* */
|
2005-10-21 11:08:28 +02:00
|
|
|
if ( !( load_flags & FT_LOAD_NO_SCALE ) &&
|
|
|
|
size->root.metrics.y_ppem < 24 )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
|
* src/truetype/ttgload.c (TT_Load_Glyph): finally fixing the last
bug that prevented FreeType 2.x and FreeType 1.x to produce
bit-by-bit identical monochrome glyph bitmaps with native TrueType
hinting. The culprit was a single-bit flag that wasn't set
correctly by the TrueType glyph loader !!
* src/otlayout/otlayout.h,
src/otlayout/otlbase.c,
src/otlayout/otlbase.h,
src/otlayout/otlconf.h,
src/otlayout/otlgdef.c,
src/otlayout/otlgdef.h,
src/otlayout/otlgpos.c,
src/otlayout/otlgpos.h,
src/otlayout/otlgsub.c,
src/otlayout/otlgsub.h,
src/otlayout/otljstf.c,
src/otlayout/otljstf.h,
src/otlayout/otltable.c,
src/otlayout/otltable.h,
src/otlayout/otltags.h:
adding OpenType Layout source files. Module is still incomplete
2002-05-04 20:02:59 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|