1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ttinterp.h */
|
|
|
|
/* */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* TrueType bytecode interpreter (specification). */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#ifndef TTINTERP_H_
|
|
|
|
#define TTINTERP_H_
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttobjs.h"
|
2000-07-08 21:51:42 +02:00
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
FT_BEGIN_HEADER
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Rounding mode constants. */
|
|
|
|
/* */
|
|
|
|
#define TT_Round_Off 5
|
|
|
|
#define TT_Round_To_Half_Grid 0
|
|
|
|
#define TT_Round_To_Grid 1
|
|
|
|
#define TT_Round_To_Double_Grid 2
|
|
|
|
#define TT_Round_Up_To_Grid 4
|
|
|
|
#define TT_Round_Down_To_Grid 3
|
|
|
|
#define TT_Round_Super 6
|
|
|
|
#define TT_Round_Super_45 7
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Function types used by the interpreter, depending on various modes */
|
|
|
|
/* (e.g. the rounding mode, whether to render a vertical or horizontal */
|
|
|
|
/* line etc). */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
/* Rounding function */
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef FT_F26Dot6
|
2015-01-10 20:23:10 +01:00
|
|
|
(*TT_Round_Func)( TT_ExecContext exc,
|
|
|
|
FT_F26Dot6 distance,
|
|
|
|
FT_F26Dot6 compensation );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* Point displacement along the freedom vector routine */
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef void
|
2015-01-10 20:23:10 +01:00
|
|
|
(*TT_Move_Func)( TT_ExecContext exc,
|
|
|
|
TT_GlyphZone zone,
|
|
|
|
FT_UShort point,
|
|
|
|
FT_F26Dot6 distance );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* Distance projection along one of the projection vectors */
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef FT_F26Dot6
|
2015-01-10 20:23:10 +01:00
|
|
|
(*TT_Project_Func)( TT_ExecContext exc,
|
|
|
|
FT_Pos dx,
|
|
|
|
FT_Pos dy );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2014-09-03 04:38:59 +02:00
|
|
|
/* getting current ppem. Take care of non-square pixels if necessary */
|
|
|
|
typedef FT_Long
|
2015-01-10 20:23:10 +01:00
|
|
|
(*TT_Cur_Ppem_Func)( TT_ExecContext exc );
|
2014-09-03 04:38:59 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* reading a cvt value. Take care of non-square pixels if necessary */
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef FT_F26Dot6
|
2015-01-10 20:23:10 +01:00
|
|
|
(*TT_Get_CVT_Func)( TT_ExecContext exc,
|
|
|
|
FT_ULong idx );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* setting or moving a cvt value. Take care of non-square pixels */
|
|
|
|
/* if necessary */
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef void
|
2015-01-10 20:23:10 +01:00
|
|
|
(*TT_Set_CVT_Func)( TT_ExecContext exc,
|
|
|
|
FT_ULong idx,
|
|
|
|
FT_F26Dot6 value );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* This structure defines a call record, used to manage function calls. */
|
|
|
|
/* */
|
|
|
|
typedef struct TT_CallRec_
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int Caller_Range;
|
|
|
|
FT_Long Caller_IP;
|
|
|
|
FT_Long Cur_Count;
|
[truetype] Minor code refactoring.
Two benefits: The allocated FDEF (and IDEF) array gets slightly
smaller, and the `ttdebug' demo program has access to function
numbers without additional costs.
Fortunately, no changes to FontForge are necessary – this is the
only external TrueType debugger I know of, but others may exist and
should check the code accordingly.
* src/truetype/ttinterp.h (TT_CallRec): Replace `Cur_Restart' and
`Cur_End' with a pointer to the corresponding `TT_DefRecord'
structure.
* src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF, Ins_ENDF,
Ins_CALL, Ins_LOOPCALL, Ins_UNKNOWN, TT_RunIns <Invalid_Opcode>):
Updated.
2013-11-01 13:26:28 +01:00
|
|
|
|
|
|
|
TT_DefRecord *Def; /* either FDEF or IDEF */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
} TT_CallRec, *TT_CallStack;
|
|
|
|
|
|
|
|
|
[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
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* These structures define rules used to tweak subpixel hinting for */
|
|
|
|
/* various fonts. "", 0, "", NULL value indicates to match any value. */
|
|
|
|
/* */
|
|
|
|
|
[truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
#define SPH_MAX_NAME_SIZE 32
|
|
|
|
#define SPH_MAX_CLASS_MEMBERS 100
|
[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
|
|
|
|
|
|
|
typedef struct SPH_TweakRule_
|
|
|
|
{
|
[truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
const char family[SPH_MAX_NAME_SIZE];
|
[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
|
|
|
const FT_UInt ppem;
|
[truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
const char style[SPH_MAX_NAME_SIZE];
|
[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
|
|
|
const FT_ULong glyph;
|
|
|
|
|
|
|
|
} SPH_TweakRule;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct SPH_ScaleRule_
|
|
|
|
{
|
[truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
const char family[SPH_MAX_NAME_SIZE];
|
[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
|
|
|
const FT_UInt ppem;
|
[truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
const char style[SPH_MAX_NAME_SIZE];
|
[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
|
|
|
const FT_ULong glyph;
|
|
|
|
const FT_ULong scale;
|
|
|
|
|
|
|
|
} SPH_ScaleRule;
|
|
|
|
|
|
|
|
|
[truetype] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
typedef struct SPH_Font_Class_
|
[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] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
const char name[SPH_MAX_NAME_SIZE];
|
|
|
|
const char member[SPH_MAX_CLASS_MEMBERS][SPH_MAX_NAME_SIZE];
|
[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] Improve sub-pixel code.
This patches fixes many issues with the ttsubpix implementation.
1. Data tables are defined, instead of declared, in the header, and
thus copied into each source file that includes it.
2. These tables were defined as global, mutable, visible variables,
and thus costing private RAM to every process that loads the
library (> 50 KB / process, this is huge!).
Additionally, this also made the library export the symbols
completely needlessly.
3. Missing `sph_' and `SPH_' prefixes to some of the definitions.
Note that this doesn't try to fix the incredibly inefficient storage
format for the data tables used by the code. This one will require
another pass in the future.
* src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS):
Renamed to...
(SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This.
Update all users.
(SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where
appropriate.
(Font_Class): Rename to...
(SPH_Font_Class): This. Decorate with `const' where appropriate.
* src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak):
Decorate arguments with `const' where appropriate.
Move font tweaking tables to...
* src/truetype/ttsubpic.c: This file and decorate them with `static'
and `const' where appropriate.
(X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to...
(spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This.
Update all users.
2013-01-16 19:48:31 +01:00
|
|
|
} SPH_Font_Class;
|
[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 */
|
[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
|
|
|
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The main structure for the interpreter which collects all necessary */
|
|
|
|
/* variables and states. */
|
|
|
|
/* */
|
|
|
|
typedef struct TT_ExecContextRec_
|
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Face face;
|
|
|
|
TT_Size size;
|
|
|
|
FT_Memory memory;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* instructions state */
|
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Error error; /* last execution error */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Long top; /* top of exec. stack */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2015-02-17 09:21:26 +01:00
|
|
|
FT_Long stackSize; /* size of exec. stack */
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Long* stack; /* current exec. stack */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Long args;
|
2015-02-17 09:21:26 +01:00
|
|
|
FT_Long new_top; /* new top after exec. */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_GlyphZoneRec zp0, /* zone records */
|
2002-04-01 16:25:28 +02:00
|
|
|
zp1,
|
|
|
|
zp2,
|
|
|
|
pts,
|
|
|
|
twilight;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Size_Metrics metrics;
|
|
|
|
TT_Size_Metrics tt_metrics; /* size metrics */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_GraphicsState GS; /* current graphics state */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Int curRange; /* current code range number */
|
|
|
|
FT_Byte* code; /* current code range */
|
|
|
|
FT_Long IP; /* current instruction pointer */
|
|
|
|
FT_Long codeSize; /* size of current range */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Byte opcode; /* current opcode */
|
|
|
|
FT_Int length; /* length of current opcode */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Bool step_ins; /* true if the interpreter must */
|
|
|
|
/* increment IP after ins. exec */
|
2010-08-06 00:47:57 +02:00
|
|
|
FT_ULong cvtSize;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Long* cvt;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt glyphSize; /* glyph instructions buffer size */
|
|
|
|
FT_Byte* glyphIns; /* glyph instructions buffer */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt numFDefs; /* number of function defs */
|
|
|
|
FT_UInt maxFDefs; /* maximum number of function defs */
|
|
|
|
TT_DefArray FDefs; /* table of FDefs entries */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt numIDefs; /* number of instruction defs */
|
|
|
|
FT_UInt maxIDefs; /* maximum number of ins defs */
|
|
|
|
TT_DefArray IDefs; /* table of IDefs entries */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt maxFunc; /* maximum function index */
|
|
|
|
FT_UInt maxIns; /* maximum instruction index */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Int callTop, /* top of call stack during execution */
|
|
|
|
callSize; /* size of call stack */
|
|
|
|
TT_CallStack callStack; /* call stack */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UShort maxPoints; /* capacity of this context's `pts' */
|
|
|
|
FT_Short maxContours; /* record, expressed in points and */
|
|
|
|
/* contours. */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
TT_CodeRangeTable codeRangeTable; /* table of valid code ranges */
|
|
|
|
/* useful for the debugger */
|
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UShort storeSize; /* size of current storage */
|
|
|
|
FT_Long* storage; /* storage area */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_F26Dot6 period; /* values used for the */
|
|
|
|
FT_F26Dot6 phase; /* `SuperRounding' */
|
|
|
|
FT_F26Dot6 threshold;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Bool instruction_trap; /* If `True', the interpreter will */
|
|
|
|
/* exit after each instruction */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_GraphicsState default_GS; /* graphics state resulting from */
|
|
|
|
/* the prep program */
|
|
|
|
FT_Bool is_composite; /* true if the glyph is composite */
|
|
|
|
FT_Bool pedantic_hinting; /* true if pedantic interpretation */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* latest interpreter additions */
|
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Long F_dot_P; /* dot product of freedom and projection */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* vectors */
|
|
|
|
TT_Round_Func func_round; /* current rounding function */
|
|
|
|
|
|
|
|
TT_Project_Func func_project, /* current projection function */
|
|
|
|
func_dualproj, /* current dual proj. function */
|
|
|
|
func_freeProj; /* current freedom proj. func */
|
|
|
|
|
|
|
|
TT_Move_Func func_move; /* current point move function */
|
* src/truetype/ttinterp.c (CUR_Func_move_orig): New macro.
(Direct_Move_Orig, Direct_Move_Orig_X, Direct_Move_Orig_Y): New
functions. Similar to Direct_Move, Direct_Move_X, and
Direct_Move_Y but without touching.
(Compute_Funcs): Use new functions.
(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): Fix rounding of value zero.
(DO_DIV): Don't use TT_MULDIV.
(Ins_SHC): This instruction actually touches the points.
(Ins_MSIRP): Fix undocumented behaviour.
* src/truetype/ttinterp.h (TT_ExecContextRec): Updated.
* docs/VERSION.DLL: Updated.
* src/base/ftobjs.c (FT_Set_Char_Size): Make metrics->x_scale and
metrics->y_scale really precise.
(FT_Load_Glyph): Update computation of linearHoriAdvance and
linearVertAdvance.
* src/true/type/ttinterp.c (Update_Max): Use FT_REALLOC.
2003-11-24 23:54:58 +01:00
|
|
|
TT_Move_Func func_move_orig; /* move original position function */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2014-09-03 04:38:59 +02:00
|
|
|
TT_Cur_Ppem_Func func_cur_ppem; /* get current proj. ppem value */
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
TT_Get_CVT_Func func_read_cvt; /* read a cvt entry */
|
|
|
|
TT_Set_CVT_Func func_write_cvt; /* write a cvt entry (in pixels) */
|
|
|
|
TT_Set_CVT_Func func_move_cvt; /* incr a cvt entry (in pixels) */
|
|
|
|
|
[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; /* bi-level hinting and */
|
|
|
|
/* grayscale rendering */
|
|
|
|
|
|
|
|
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
|
|
|
/*
|
|
|
|
* Modern TrueType fonts are usually rendered through Microsoft's
|
|
|
|
* collection of rendering techniques called ClearType (e.g., subpixel
|
|
|
|
* rendering and subpixel hinting). When ClearType was introduced, most
|
|
|
|
* fonts were not ready. Microsoft decided to implement a backwards
|
|
|
|
* compatibility mode that employed several simple to complicated
|
|
|
|
* assumptions and tricks that modified the interpretation of the
|
|
|
|
* bytecode contained in these fonts to make them look ClearType-y
|
|
|
|
* somehow. Most (web)fonts that were released since then have come to
|
|
|
|
* rely on these hacks to render correctly, even some of Microsoft's
|
|
|
|
* flagship ClearType fonts (Calibri, Cambria, Segoe UI).
|
|
|
|
*
|
|
|
|
* The minimal subpixel hinting code (interpreter version 40) employs a
|
|
|
|
* small list of font-agnostic hacks to bludgeon non-native-ClearType
|
|
|
|
* fonts (except tricky ones[1]) into submission. It will not try to
|
|
|
|
* toggle hacks for specific fonts for performance and complexity
|
|
|
|
* reasons. The focus is on modern (web)fonts rather than legacy fonts
|
|
|
|
* that were made for black-and-white rendering.
|
|
|
|
*
|
|
|
|
* Major hacks
|
|
|
|
*
|
|
|
|
* - Any point movement on the x axis is ignored (cf. `Direct_Move' and
|
|
|
|
* `Direct_Move_X'). This has the smallest code footprint and single
|
|
|
|
* biggest effect. The ClearType way to increase resolution is
|
|
|
|
* supersampling the x axis, the FreeType way is ignoring instructions
|
|
|
|
* on the x axis, which gives the same result in the majority of
|
|
|
|
* cases.
|
|
|
|
*
|
|
|
|
* - Points are not moved post-IUP (neither on the x nor on the y axis),
|
|
|
|
* except the x component of diagonal moves post-IUP (cf.
|
|
|
|
* `Direct_Move', `Direct_Move_Y', `Move_Zp2_Point'). Post-IUP
|
|
|
|
* changes are commonly used to `fix' pixel patterns which has little
|
|
|
|
* use outside monochrome rendering.
|
|
|
|
*
|
|
|
|
* - SHPIX and DELTAP don't execute unless moving a composite on the
|
|
|
|
* y axis or moving a previously y touched point. SHPIX additionally
|
|
|
|
* denies movement on the x axis (cf. `Ins_SHPIX' and `Ins_DELTAP').
|
|
|
|
* Both instructions are commonly used to `fix' pixel patterns for
|
|
|
|
* monochrome or Windows's GDI rendering but make little sense for
|
|
|
|
* FreeType rendering. Both can distort the outline. See [2] for
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* - The hdmx table and modifications to phantom points are ignored.
|
|
|
|
* Bearings and advance widths remain unchanged (except rounding them
|
|
|
|
* outside the interpreter!), cf. `compute_glyph_metrics' and
|
|
|
|
* `TT_Hint_Glyph'. Letting non-native-ClearType fonts modify spacing
|
|
|
|
* might mess up spacing.
|
|
|
|
*
|
|
|
|
* Minor hacks
|
|
|
|
*
|
|
|
|
* - FLIPRGON, FLIPRGOFF, and FLIPPT don't execute post-IUP. This
|
|
|
|
* prevents dents in e.g. Arial-Regular's `D' and `G' glyphs at
|
|
|
|
* various sizes.
|
|
|
|
*
|
|
|
|
* (Post-IUP is the state after both IUP[x] and IUP[y] have been
|
|
|
|
* executed.)
|
|
|
|
*
|
|
|
|
* The best results are achieved for fonts that were from the outset
|
|
|
|
* designed with ClearType in mind, meaning they leave the x axis mostly
|
|
|
|
* alone and don't mess with the `final' outline to produce more
|
|
|
|
* pleasing pixel patterns. The harder the designer tried to produce
|
|
|
|
* very specific patterns (`superhinting') for pre-ClearType-displays,
|
|
|
|
* the worse the results.
|
|
|
|
*
|
|
|
|
* Microsoft defines a way to turn off backwards compatibility and
|
|
|
|
* interpret instructions as before (called `native ClearType')[2][3].
|
|
|
|
* The font designer then regains full control and is responsible for
|
|
|
|
* making the font work correctly with ClearType without any
|
|
|
|
* hand-holding by the interpreter or rasterizer[4]. The v40
|
|
|
|
* interpreter assumes backwards compatibility by default, which can be
|
|
|
|
* turned off the same way by executing the following in the control
|
|
|
|
* program (cf. `Ins_INSTCTRL').
|
|
|
|
*
|
|
|
|
* #PUSH 4,3
|
|
|
|
* INSTCTRL[]
|
|
|
|
*
|
|
|
|
* [1] Tricky fonts as FreeType defines them rely on the bytecode
|
|
|
|
* interpreter to display correctly. Hacks can interfere with them,
|
|
|
|
* so they get treated like native ClearType fonts (v40 with
|
|
|
|
* backwards compatibility turned off). Cf. `TT_RunIns'.
|
|
|
|
*
|
|
|
|
* [2] Proposed by Microsoft's Greg Hitchcock in
|
|
|
|
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
|
|
|
|
*
|
|
|
|
* [3] Beat Stamm describes it in more detail:
|
|
|
|
* http://www.beatstamm.com/typography/RTRCh4.htm#Sec12
|
|
|
|
*
|
|
|
|
* [4] The list of `native ClearType' fonts is small at the time of this
|
|
|
|
* writing; I found the following on a Windows 10 Update 1511
|
|
|
|
* installation: Constantia, Corbel, Sitka, Malgun Gothic, Microsoft
|
|
|
|
* JhengHei (Bold and UI Bold), Microsoft YaHei (Bold and UI Bold),
|
|
|
|
* SimSun, NSimSun, and Yu Gothic.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Using v40 implies subpixel hinting. Used to detect interpreter */
|
|
|
|
/* version switches. `_lean' to differentiate from the Infinality */
|
|
|
|
/* `subpixel_hinting', which is managed differently. */
|
|
|
|
FT_Bool subpixel_hinting_lean;
|
|
|
|
|
|
|
|
/* Long side of a LCD subpixel is vertical (e.g., screen is rotated). */
|
|
|
|
/* `_lean' to differentiate from the Infinality `vertical_lcd', which */
|
|
|
|
/* is managed differently. */
|
|
|
|
FT_Bool vertical_lcd_lean;
|
|
|
|
|
|
|
|
/* Default to backwards compatibility mode in v40 interpreter. If */
|
|
|
|
/* this is false, it implies the interpreter is in v35 or in native */
|
|
|
|
/* ClearType mode. */
|
|
|
|
FT_Bool backwards_compatibility;
|
|
|
|
|
|
|
|
/* Useful for detecting and denying post-IUP trickery that is usually */
|
|
|
|
/* used to fix pixel patterns (`superhinting'). */
|
|
|
|
FT_Bool iupx_called;
|
|
|
|
FT_Bool iupy_called;
|
|
|
|
|
|
|
|
/* ClearType hinting and grayscale rendering, as used by Universal */
|
|
|
|
/* Windows Platform apps (Windows 8 and above). Like the standard */
|
|
|
|
/* colorful ClearType mode, it utilizes a vastly increased virtual */
|
|
|
|
/* resolution on the x axis. Different from bi-level hinting and */
|
|
|
|
/* grayscale rendering, the old mode from Win9x days that roughly */
|
|
|
|
/* adheres to the physical pixel grid on both axes. */
|
|
|
|
FT_Bool grayscale_cleartype;
|
|
|
|
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
|
|
|
|
|
|
|
|
#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
|
|
|
TT_Round_Func func_round_sphn; /* subpixel rounding function */
|
|
|
|
|
2015-05-23 07:21:25 +02:00
|
|
|
FT_Bool subpixel_hinting; /* Using subpixel hinting? */
|
[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
|
|
|
FT_Bool ignore_x_mode; /* Standard rendering mode for */
|
|
|
|
/* subpixel hinting. On if gray */
|
2013-12-11 09:01:13 +01:00
|
|
|
/* or subpixel hinting is on. */
|
[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-24 09:50:24 +02:00
|
|
|
/* The following 6 aren't fully implemented but here for MS rasterizer */
|
[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
|
|
|
/* compatibility. */
|
|
|
|
FT_Bool compatible_widths; /* compatible widths? */
|
|
|
|
FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */
|
|
|
|
FT_Bool bgr; /* bgr instead of rgb? */
|
2015-05-24 09:50:24 +02:00
|
|
|
FT_Bool vertical_lcd; /* long side of LCD subpixel */
|
|
|
|
/* rectangles is horizontal */
|
[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
|
|
|
FT_Bool subpixel_positioned; /* subpixel positioned */
|
|
|
|
/* (DirectWrite ClearType)? */
|
2015-05-24 09:50:24 +02:00
|
|
|
FT_Bool gray_cleartype; /* ClearType hinting but */
|
|
|
|
/* grayscale rendering */
|
[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-01-28 13:56:23 +01:00
|
|
|
FT_Int rasterizer_version; /* MS rasterizer version */
|
[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-01-28 13:56:23 +01:00
|
|
|
FT_Bool iup_called; /* IUP called for glyph? */
|
[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-01-28 13:56:23 +01:00
|
|
|
FT_ULong sph_tweak_flags; /* flags to control */
|
|
|
|
/* hint tweaks */
|
2013-01-26 19:29:52 +01:00
|
|
|
|
2013-01-28 13:56:23 +01:00
|
|
|
FT_ULong sph_in_func_flags; /* flags to indicate if in */
|
|
|
|
/* special functions */
|
2013-01-26 19:29:52 +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
|
|
|
#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
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
} TT_ExecContextRec;
|
|
|
|
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
extern const TT_GraphicsState tt_default_graphics_state;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2013-01-25 16:41:24 +01:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
[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
|
|
|
FT_LOCAL( void )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Goto_CodeRange( TT_ExecContext exec,
|
|
|
|
FT_Int range,
|
|
|
|
FT_Long IP );
|
1999-12-17 00:11:37 +01: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
|
|
|
FT_LOCAL( void )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Set_CodeRange( TT_ExecContext exec,
|
|
|
|
FT_Int range,
|
|
|
|
void* base,
|
|
|
|
FT_Long length );
|
1999-12-17 00:11:37 +01: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
|
|
|
FT_LOCAL( void )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Clear_CodeRange( TT_ExecContext exec,
|
|
|
|
FT_Int range );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-11-07 18:21:11 +01:00
|
|
|
|
2010-05-20 15:38:00 +02:00
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
Update_Max( FT_Memory memory,
|
|
|
|
FT_ULong* size,
|
2015-02-17 09:21:26 +01:00
|
|
|
FT_ULong multiplier,
|
2010-05-20 15:38:00 +02:00
|
|
|
void* _pbuff,
|
|
|
|
FT_ULong new_max );
|
2013-01-25 16:41:24 +01:00
|
|
|
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
2010-05-20 15:38:00 +02:00
|
|
|
|
|
|
|
|
2000-11-07 18:21:11 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_New_Context */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Queries the face context for a given font. Note that there is */
|
|
|
|
/* now a _single_ execution context in the TrueType driver which is */
|
|
|
|
/* shared among faces. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the source face object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* A handle to the execution context. Initialized for `face'. */
|
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* Only the glyph loader and debugger should call this function. */
|
2015-01-14 17:46:55 +01:00
|
|
|
/* (And right now only the glyph loader uses it.) */
|
2000-11-07 18:21:11 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( TT_ExecContext )
|
2005-08-16 03:54:59 +02:00
|
|
|
TT_New_Context( TT_Driver driver );
|
2000-11-07 18:21:11 +01:00
|
|
|
|
2012-06-27 08:16:06 +02:00
|
|
|
|
2013-01-25 16:41:24 +01:00
|
|
|
#ifdef TT_USE_BYTECODE_INTERPRETER
|
[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
|
|
|
FT_LOCAL( void )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Done_Context( TT_ExecContext exec );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL( FT_Error )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Load_Context( TT_ExecContext exec,
|
|
|
|
TT_Face face,
|
|
|
|
TT_Size size );
|
1999-12-17 00:11:37 +01: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
|
|
|
FT_LOCAL( void )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Save_Context( TT_ExecContext exec,
|
|
|
|
TT_Size ins );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL( FT_Error )
|
2015-01-14 17:46:55 +01:00
|
|
|
TT_Run_Context( TT_ExecContext exec );
|
2013-01-25 16:41:24 +01:00
|
|
|
#endif /* TT_USE_BYTECODE_INTERPRETER */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-11-07 18:21:11 +01:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_RunIns */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Executes one or more instruction in the execution context. This */
|
|
|
|
/* is the main function of the TrueType opcode interpreter. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* exec :: A handle to the target execution context. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* FreeType error code. 0 means success. */
|
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* Only the object manager and debugger should call this function. */
|
|
|
|
/* */
|
|
|
|
/* This function is publicly exported because it is directly */
|
|
|
|
/* invoked by the TrueType debugger. */
|
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
TT_RunIns( TT_ExecContext exec );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
FT_END_HEADER
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2016-01-12 21:37:13 +01:00
|
|
|
#endif /* TTINTERP_H_ */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|