src/truetype/ttinterp.c


Log

Author Commit Date CI Message
Werner Lemberg 093c1820 2017-04-03T11:37:33 [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981 * include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New error code. * src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution of these two opcodes in `glyf' bytecode. (TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode in case of error since function tables can no longer be modified (due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can enormously speed up handling of broken fonts.
Werner Lemberg 3e79254a 2017-03-18T10:06:15 * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). The problematic font that exceeds the old limit is Lato-Regular, version 2.007, containing bytecode generated by a buggy version of ttfautohint.
Werner Lemberg 13fa85a2 2017-03-18T09:42:58 [truetype] Another limitation for bytecode loop count maximum. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=900 * src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max' by number of glyphs also.
Werner Lemberg 9931175d 2017-03-18T07:06:49 Improve `make multi'. * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/sfnt/pngshim.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. * src/sfnt/ttbdf.c: Avoid empty source file. * src/sfnt/ttpost.c: Guard file with TT_CONFIG_OPTION_POSTSCRIPT_NAMES. * src/sfnt/ttsbit.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS. * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty source file. * src/truetype/ttsubpix.c: Guard file with TT_USE_BYTECODE_INTERPRETER also. * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort entries.
Werner Lemberg 43061d6a 2017-01-20T10:16:38 * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits.
Alexei Podtelezhnikov 236bbdbe 2017-01-18T23:12:31 Typos.
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.
Werner Lemberg f80c4473 2016-12-26T23:57:45 Replace `++foo' and `--foo' with `foo++' and `foo--', resp.
Werner Lemberg 4441f7b2 2016-12-26T17:08:17 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp. Other minor formatting.
Werner Lemberg 37c72f66 2016-12-25T22:55:25 Minor formatting.
Werner Lemberg 328d6844 2016-10-29T00:18:56 [truetype] Remove clang warnings. * src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for loop counter handling. * src/truetype/ttinterp.c: Updated. (Ins_SCANTYPE): Use signed constant. (TT_RunIns): Ensure `num_twilight_points' is 16bit.
Werner Lemberg 5081674c 2016-10-22T19:16:08 [truetype] Fix SCANTYPE instruction (#49394). * src/truetype/ttinterp.c (Ins_SCANTYPE): Only use lower 16bits.
Werner Lemberg 2ecf89b4 2016-09-28T19:06:21 */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate.
Werner Lemberg a3e2c832 2016-09-27T21:42:02 [truetype] Trace number of executed opcodes. * src/truetype/ttinterp.c (TT_RunIns): Implement it.
Werner Lemberg 0d945929 2016-09-27T08:44:31 [truetype] Introduce dynamic limits for some bytecode opcodes. This speeds up FreeType's handling of malformed fonts. * src/truetype/ttinterp.c (TT_RunIns): Set up limits for the number of twilight points, the total number of negative jumps, and the total number of loops in LOOPCALL opcodes. The values are based on the number of points and entries in the CVT table. (Ins_JMPR): Test negative jump counter. (Ins_LOOPCALL): Test loopcall counter. * src/truetype/ttinterp.h (TT_ExecContext): Updated. * docs/CHANGES: Updated.
Werner Lemberg b1e7b68e 2016-09-08T08:56:34 * src/truetype/ttinterp.c: Include `ttgxvar.h'. This fixes the `multi' build.
Werner Lemberg a4c2a311 2016-08-22T19:32:34 [truetype] Fix `MPS' instruction. According to Greg Hitchcock, MPS in DWrite really returns the point size. * src/truetype/ttobjs.h (TT_SizeRec): Add `point_size' member. * src/truetype/ttdriver.c (tt_size_request): Set `point_size'. * src/truetype/ttinterp.h (TT_ExecContextRec): Add `pointSize' member. * src/truetype/ttinterp.c (TT_Load_Context): Updated. (Ins_MPS): Fix instruction.
Alexei Podtelezhnikov 125f2b63 2016-08-11T23:40:05 * src/truetype/ttinterp.c (Pop_Push_Count): Revert changes.
Alexei Podtelezhnikov 49d474f6 2016-08-11T23:03:09 * src/truetype/ttinterp.c (TT_RunIns): Minor and formatting.
Alexei Podtelezhnikov dce554b1 2016-08-11T07:29:19 * src/truetype/ttinterp.c (Pop_Push_Count): Fix some entries.
Werner Lemberg 053943a7 2016-07-30T00:27:48 [truetype] Comment.
Hin-Tak Leung 3a528bbe 2016-07-22T06:59:36 [truetype] Record the end of IDEFs. To match the logic in FDEF. The value of the end is only used for bound-checking in `Ins_JMPR', so it may not have been obvious that it was not recorded. Tested (as part of Font Validator 2.0) all the fonts on Fedora and did not see any change. * src/truetype/ttinterp.c (Ins_IDEF): Updated.
Werner Lemberg a3b70d76 2016-07-18T06:23:36 [truetype] Make GETDATA work only for GX fonts. * src/truetype/ttinterp.c (opcode_name): Updated. (Ins_GETDATA): Only define for `TT_CONFIG_OPTION_GX_VAR_SUPPORT'. (TT_RunIns): Updated.
Werner Lemberg 8c93013c 2016-07-17T22:40:31 [truetype] Add support for Apple's GETDATA[], opcode 0x92 bytecode instruction. It always returns 17, and we have absolutely no idea what it is good for... * src/truetype/ttinterp.c (Pop_Push_Count, opcode_name): Updated. (Ins_GETDATA): New function. (TT_RunIns): Add it.
Werner Lemberg e0843609 2016-07-16T18:46:28 [truetype] Add bytecode support for GX variation fonts. This commit implements undocumented (but confirmed) stuff from Apple's old bytecode engine. GETVARIATION[], opcode 0x91 This opcode pushes normalized variation coordinates for all axes onto the stack (in 2.14 format). Coordinate of first axis gets pushed first. GETINFO[], selector bit 3 If GX variation support is enabled, bit 10 of the result is set to 1. * src/truetype/ttinterp.c: Include FT_MULTIPLE_MASTERS_H. (opcode_name) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. (Ins_GETINFO) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle selector bit 3, checking support for variation glyph hinting. (Ins_GETVARIATION) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New function to implement opcode 0x91. (TT_RunIns) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Handle opcode 0x91.
Werner Lemberg 32a32062 2016-07-16T16:39:26 [truetype] Fix GETINFO bytecode instruction. * src/truetype/ttinterp.c (Ins_GETINFO): Fix return value for stretching information.
Nikolaus Waxweiler 86eb43a9 2016-07-16T06:37:57 * src/truetype/ttinterp.c (Ins_MIRP): Fix copy-and-paste error. Problem reported by Hin-Tak Leung.
Werner Lemberg 474682ff 2016-07-06T08:54:35 * src/truetype/ttinterp.c (TInstruction_Function): Removed, unused.
Nikolaus Waxweiler b4598828 2016-05-31T08:39:52 [truetype] Let SHPIX move points in the twilight zone in v40. * src/truetype/ttinterp.c (Ins_SHPIX): Allow SHPIX to move points in the twilight zone. Otherwise, treat SHPIX the same as DELTAP. Unbreaks various fonts such as older versions of Rokkitt and DTL Argo T Light that would glitch severly after calling ALIGNRP after a blocked SHPIX.
Nikolaus Waxweiler ed1d8983 2016-05-18T06:58:44 [truetype] New implementation of v38 bytecode interpreter [2/3]. This patch actually modifies the bytecode interpreter. See added comments in `ttinterp.h' for more information on this and the following commit in the series. * src/truetype/ttinterp.c (SUBPIXEL_HINTING): Replaced by... (NO_SUBPIXEL_HINTING, SUBPIXEL_HINTING_INFINALITY, SUBPIXEL_HINTING_MINIMAL): ...new macros. (Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backwards compatibility. Updated. (Ins_RS, Ins_FDEF, Ins_ENDF, Ins_CALL, Ins_LOOPCALL, Ins_MD): Updated. (Ins_INSTCTRL): Handle native ClearType mode flag. Updated. (Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backwards compatibility. (Move_Zp2_Point): Ditto. (Ins_SHP): Updated. (Ins_SHPIX): Handle backwards compatibility. Updated. (Ins_MSIRP, Ins_MDAP, Ins_MIAP, Ins_MDRP, Ins_MIRP): Updated. (Ins_ALIGNRP): Updated. (Ins_IUP, Ins_DELTAP): Handle backwards compatibility. Updated. (Ins_GETINFO): Handle v38 flags. Updated. (TT_RunIns): Handle backwards compatibility mode. Updated.
Alexei Podtelezhnikov e8542260 2016-04-08T23:21:34 Typos.
Nikolaus Waxweiler 6875093a 2016-01-28T12:24:36 Remove unpatented hinter (1/3). * src/truetype/ttinterp.c [TT_CONFIG_OPTION_UNPATENTED_HINTING]: Remove all code related to this macro.
Werner Lemberg 9adeab64 2016-01-13T11:54:10 Update copyright year.
Werner Lemberg 24a1fcdf 2015-10-15T21:50:15 [truetype] Add TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES (#46208). * devel/ftoption.h, include/freetype/config/ftoption.h (TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES): New configuration macro. * src/truetype/ttinterp.c (MAX_RUNNABLE_OPCODES): Removed. (TT_RunIns): Updated.
Werner Lemberg 837ad9d4 2015-10-15T21:15:45 * src/truetype/ttinterp.c (TT_RunIns): Fix bytecode stack tracing. The used indices were off by 1.
Alexei Podtelezhnikov 09635264 2015-08-31T23:14:46 Minor.
Werner Lemberg eb1bba9b 2015-06-30T09:46:39 Fix some clang compiler warnings. * src/base/ftoutln.c (FT_Outline_EmboldenXY), src/cff/cf2intrp.c (cf2_interpT2CharString), src/truetype/ttgload.c (load_truetype_glyph), src/truetype/ttgxvar.c (tt_handle_deltas), src/truetype/ttinterp.c (Ins_INSTCTRL): Fix signedness issues.
Alexei Podtelezhnikov 5aaabb44 2015-06-29T22:46:54 [truetype] Speed up bytecode interpreter. * src/truetype/ttinterp.c (Normalize): Use `FT_Vector_NormLen'.
Werner Lemberg e1862306 2015-06-07T16:11:18 * Version 2.6 released. ======================= Tag sources with `VER-2-6'. * docs/VERSION.DLL: Update documentation and bump version number to 2.6. * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, builds/windows/vc2005/index.html, builds/windows/vc2008/freetype.vcproj, builds/windows/vc2008/index.html, builds/windows/vc2010/freetype.vcxproj, builds/windows/vc2010/index.html, builds/windows/visualc/freetype.dsp, builds/windows/visualc/freetype.vcproj, builds/windows/visualc/index.html, builds/windows/visualce/freetype.dsp, builds/windows/visualce/freetype.vcproj, builds/windows/visualce/index.html, builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/freetype.vcproj, builds/wince/vc2008-ce/index.html: s/2.5.5/2.6/, s/255/26/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 6. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 18:0:12. * CMakeLists.txt (VERSION_MINOR): Set to 0. (VERSION_PATCH): Set to 6. * src/autofit/afmodule.c [!FT_MAKE_OPTION_SINGLE_OBJECT]: Add declarations for dumping functions. * src/truetype/ttinterp.c (TT_New_Context): Pacify compiler. * builds/toplevel.mk: Use `freetype.mk's code to compute the version string. Don't include a zero patch level in version string. * builds/freetype.mk: Remove code for computing the version string.
Werner Lemberg 54d04286 2015-06-01T12:12:06 [truetype] While tracing opcodes, show code position and stack. * src/truetype/ttinterp.c: Change all existing TRACE7 calls to TRACE6. (opcode_name): Add string lengths. (TT_RunIns): Implement display of code position and stack.
Werner Lemberg a5e1f6f3 2015-05-24T23:29:23 [truetype] Fix commit from 2015-05-22. * src/truetype/ttgload.c, src/truetype/ttinterp.c: Guard new code with `TT_CONFIG_OPTION_SUBPIXEL_HINTING'. Problem reported by Nikolaus Waxweiler <madigens@gmail.com>.
Werner Lemberg 7f099482 2015-05-24T09:50:24 [truetype] Fix return values of GETINFO bytecode instruction. * src/truetype/ttinterp.h (TT_ExecContextRec): New fields `vertical_lcd' and `gray_cleartype'. * src/truetype/ttgload.c (tt_loader_init): Initialize new fields. Change `symmetrical smoothing' to TRUE, since FreeType produces exactly this. * src/truetype/ttinterp.c (Ins_GETINFO): Fix selector/return bit values for symmetrical smoothing, namely 11/18. Handle bits for vertical LCD subpixels (8/15) and Gray ClearType (12/19).
Werner Lemberg bb435da2 2015-05-23T07:21:25 [truetype] Minor. * src/truetype/ttinterp.h (TT_ExecContext): s/subpixel/subpixel_hinting. * src/truetype/ttgload.c, src/truetype/ttgload.h: Updated.
Werner Lemberg c61cad86 2015-05-22T22:02:15 [truetype] Support selector index 3 of the INSTCTRL instruction. This flag activates `native ClearType hinting', disabling backwards compatibility mode as described in Greg Hitchcocks whitepaper. In other words, it enables unrestricted functionality of all TrueType instructions in ClearType. * src/truetype/ttgload.c (tt_get_metrics): Call `sph_set_tweaks' unconditionally. (tt_loader_init): Unset `ignore_x_mode' flag if bit 2 of `GS.instruct_control' is active. * src/truetype/ttinterp.c (Ins_INSTCTRL): Handle selector index 3. (Ins_GETINFO): Updated. * docs/CHANGES: Document it.
Werner Lemberg 790b8dfb 2015-05-20T12:33:40 [truetype] Minor.
Alexei Podtelezhnikov 40623a1f 2015-04-27T22:27:00 [truetype] Speed up IUP. * src/truetype/ttinterp.c (_iup_worker_interpolate): Separate trivial snapping to the same position from true interpolation.
Werner Lemberg d9c3f151 2015-02-17T09:21:26 [truetype] More signedness fixes. * include/internal/tttypes.h, src/truetype/ttinterp.h, src/truetype/ttobjs.h, src/truetype/ttinterp.c, src/truetype/ttobjs.c: Apply.
Werner Lemberg f57fc59e 2015-01-17T20:41:43 Run `src/tools/update-copyright'.
Werner Lemberg f796cf6c 2015-01-17T20:11:10 Normalize copyright notice format.
Behdad Esfahbod 531d463a 2015-01-14T17:46:55 [truetype] Allocate TT_ExecContext in TT_Size instead of TT_Driver. Previously the code had stipulation for using a per-TT_Size exec context if `size->debug' was true. But there was no way that `size->debug' could *ever* be true. As such, the code was always using the singleton `TT_ExecContext' that was stored in `TT_Driver'. This was, clearly, not threadsafe. With this patch, loading glyphs from different faces from different threads doesn't crash in the bytecode loader code. * src/truetype/ttobjs.h (TT_SizeRec): Remove `debug' member. (TT_DriverRec): Remove `context' member. * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Remove `TT_ExecContext' code related to a global `TT_Driver' object. (tt_driver_done): Don't remove `TT_ExecContext' object here but ... (tt_size_done_bytecode): ... here. (tt_driver_init): Don't create `TT_ExecContext' object here but ... (tt_size_init_bytecode): ... here, only on demand. * src/truetype/ttinterp.c (TT_Run_Context): Remove defunct debug code. (TT_New_Context): Remove `TT_ExecContext' code related to a global `TT_Driver' object. * src/truetype/ttinterp.h: Updated. * src/truetype/ttgload.c (TT_Hint_Glyph, tt_loader_init): Updated.
Werner Lemberg 2af74c9b 2015-01-11T10:08:09 [truetype] Better grouping of functions in `ttinterp.c'. No code change.
Werner Lemberg 95b57052 2015-01-11T09:50:49 [truetype] Prettyfing. * src/truetype/ttinterp.c (project, dualproj, fast_project, fast_dualproj): Rename to... (PROJECT, DUALPROJ, FAST_PROJECT, FAST_DUALPROJ): ... this.
Werner Lemberg ea173c04 2015-01-11T08:58:54 * src/truetype/ttinterp.c (Ins_JROT, Ins_JROF): Simplify. Based on a patch from Behdad.
Werner Lemberg 628578c6 2015-01-11T08:53:31 * src/truetype/ttinterp.c (Ins_SxVTL): Simplify function call.
Werner Lemberg 08e7909a 2015-01-11T08:45:50 * src/truetype/ttinterp.c (Normalize): Remove unused argument.
Werner Lemberg 4aaadf46 2015-01-11T08:42:28 [truetype] More macro expansions. * src/truetype/ttinterp.c (FT_UNUSED_EXEC): Remove macro by expansion.
Werner Lemberg d03a67a1 2015-01-11T08:39:14 [truetype] More macro expansions. * src/truetype/ttinterp.c (INS_ARG): Remove macro by expansion, adjusting funtion calls where necessary. (FT_UNUSED_ARG): Removed, no longer needed.
Werner Lemberg 7e1db6d4 2015-01-11T00:56:55 Formatting, typos.
Werner Lemberg eb341368 2015-01-11T00:23:27 [truetype] More macro expansions. Based on a patch from Behdad. * src/truetype/ttinterp.c (DO_*): Expand macros into corresponding `Ins_*' functions. (TT_RunIns): Replace `DO_*' macros with `Ins_*' function calls. (ARRAY_BOUND_ERROR): Remove second definition, which is no longer needed. (Ins_SVTCA, Ins_SPVTCA, Ins_SFVTCA): Replaced with... (Ins_SxyTCA): New function.
Werner Lemberg 01be130d 2015-01-10T23:05:37 [truetype] Remove TT_CONFIG_OPTION_INTERPRETER_SWITCH. Behdad suggested this code simplification, and nobody objected... * include/config/ftoption.h, devel/ftoption.h (TT_CONFIG_OPTION_INTERPRETER_SWITCH): Remove. * src/truetype/ttinterp.c [TT_CONFIG_OPTION_INTERPRETER_SWITCH]: Remove related code. (ARRAY_BOUND_ERROR): Use do-while loop.
Werner Lemberg 6cc1f123 2015-01-10T21:56:59 [truetype] More macro expansions. * src/truetype/ttinterp.c, src/truetype/ttinterp.h (EXEC_ARG_, EXEC_ARG): Remove by replacing with expansion.
Werner Lemberg 24681455 2015-01-10T21:53:48 [truetype] More macro expansions. Based on a patch from Behdad. * src/truetype/ttinterp.c (SKIP_Code, GET_ShortIns, NORMalize, SET_SuperRound, ROUND_None, INS_Goto_CodeRange, CUR_Func_move, CUR_Func_move_orig, CUR_Func_round, CUR_Func_cur_ppem, CUR_Func_read_cvt, CUR_Func_write_cvt, CUR_Func_move_cvt, CURRENT_Ratio, INS_SxVTL, COMPUTE_Funcs, COMPUTE_Round, COMPUTE_Point_Displacement, MOVE_Zp2_Point): Remove by replacing with expansion. (Cur_Func_project, CUR_Func_dualproj, CUR_fast_project, CUR_fast_dualproj): Replace with macros `project', `dualproj', `fast_project', `fast_dualproj'.
Werner Lemberg fae0c81f 2015-01-10T20:23:10 [truetype] More macro expansions. * src/truetype/ttinterp.c (EXEC_OP_, EXEC_OP): Remove by replacing with expansion.
Werner Lemberg 5a752f33 2015-01-10T20:08:35 [truetype] Remove code for static TrueType interpreter. This is a follow-up patch. * src/truetype/ttinterp.c, src/truetype/ttinterp.h [TT_CONFIG_OPTION_STATIC_INTERPRETER, TT_CONFIG_OPTION_STATIC_RASTER]: Remove macros and related code.
Werner Lemberg 1b4d68cf 2015-01-10T19:56:28 * src/truetype/ttinterp.c (CUR): Remove by replacing with expansion. This starts a series of patches that simplifies the code of the bytecode interpreter.
Werner Lemberg 0098d550 2014-12-07T11:03:57 Uppercase all hex digits for orthogonality.
Werner Lemberg ed6a9df0 2014-12-06T23:28:58 Whitespace.
Werner Lemberg f34f1925 2014-11-26T21:59:21 * src/*: Add checks for parameters of API functions where missing. `API functions' are functions tagged with `FT_EXPORT_DEF'. Besides trivial fixes, the following changes are included, too. * src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Set error code if no service is available. * src/base/ftinit.c (FT_Done_FreeType): Change return value for invalid `library' parameter to `Invalid_Library_Handle'. * src/base/ftobjs.c (FT_New_Size): Change return value for invalid `asize' parameter to `Invalid_Argument'. * src/base/ftoutln.c (FT_Outline_Copy): Change return value for invalid `source' and `target' parameters to `Invalid_Outline'. (FT_Outline_Done_Internal): Change return value for invalid `outline' parameter to `Invalid_Outline'.
Werner Lemberg ef439fd2 2014-11-25T08:14:15 [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.
Werner Lemberg 706f752b 2014-11-03T07:20:57 * src/truetype/ttinterp.c (Ins_DELTAP): Fix subpixel hinting. Before this patch, it was impossible to ever call DELTAP[123] in subpixel hinting mode as described in the ClearType whitepaper; it only worked if in `compatibility mode'. However, compatibility mode essentially disables SHPIX, completely ruining hinting of ttfautohint output, for example. We now follow the whitepaper more closely so that DELTAP[123] instructions for touched points in the non-subpixel direction are executed.
Alexei Podtelezhnikov 118e651b 2014-10-19T23:31:08 [truetype] Clean up bytecode rounding. Zero distance does not have to be treated specially if you follow specifications and check the sign as the very last step of rounding. * src/truetype/ttinterp.c (Round_None, Round_To_Grid, Round_Down_To_Grid, Round_Up_To_Grid, Round_To_Double_Grid): Use macros when available, do not check for non-zero distance. (Round_To_Half_Grid, Round_Super, Round_Super_45): Ditto, return phase if sign changed.
Alexei Podtelezhnikov 7e83f068 2014-10-14T23:03:56 [truetype] Limit delta shift range. The legal range for delta shift is zero through six. Negative values are illegal according to https://developer.apple.com/fonts/TrueType-Reference-Manual/RM04/Chap4.html#delta%20shift * src/truetype/ttobjs.h (delta_shift, delta_base): Make unsigned. * src/truetype/ttinterp.h (DO_SDS): Throw an error if delta_shift out of range. (Ins_DELTAP, Ins_DELTAC): Optimize for legal delta_shift.
Alexei Podtelezhnikov 125c3ca8 2014-09-02T22:38:59 [truetype] Shortcut ppem calculations for square pixels. * src/truetype/ttinterp.h (TT_ExecContextRec): New field `cur_ppem_func' with a function pointer. * src/truetype/ttinterp.c (TT_RunIns): Initialize `cur_ppem_func' depending on the pixel geometry to either... (Current_Ppem_Stretched): ... this for stretched pixels. (Current_Ppem): ... or this for square pixels. (DO_MPPEM, DO_MPS, Ins_DELTAP, Ins_DELTAC): Use `cur_ppem_func'.
Behdad Esfahbod 1ec98b29 2014-08-31T08:47:11 Don't use `register' keyword. Fixes compiler warnings. * src/base/ftcalc.c (FT_Add64) [!FT_LONG64]: Do it. * src/gzip/inftrees.c (huft_build): Ditto. * src/truetype/ttinterp.c (TT_MulFix14_arm): Ditto.
Alexei Podtelezhnikov a8bc49e1 2014-08-24T22:14:01 [truetype] Optimize DELTAP and DELTAC. * src/truetype/ttinterp.c (Ins_DELTAP, Ins_DELTAC): Move ppem calculations outside of the loop.
Werner Lemberg 441b3f38 2014-07-13T02:28:14 [truetype] Improve handling of buggy `prep' tables. In case of an error in the `prep' table, no longer try to execute it again and again. This makes FreeType handle endless loops in buggy fonts much faster. * src/truetype/ttobjs.h (TT_SizeRec): The fields `bytecode_ready' and `cvt_ready' are now negative if not initialized yet, otherwise they indicate the error code of the last run. * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep, tt_size_done_bytecode, tt_size_init_bytecode, tt_size_ready_bytecode, tt_size_init, tt_size_done, tt_size_reset): Updated. * src/truetype/ttgload.c (tt_loader_init): Updated. * src/truetype/ttinterp.c (TT_RunIns): Force reexecution of `fpgm' and `prep' only if we are in the `glyf' table.
Werner Lemberg 6497b9c5 2014-06-13T09:28:00 Fix compiler warnings. Reported by Wojciech Mamrak <wmamrak@gmail.com>. * src/autofit/afglobal.c (af_face_globals_compute_style_coverage), src/autofit/afmodule.c (af_property_set): Fix `signed' vs. `unsigned' issues. * src/autofit/aflatin.c (af_latin_metrics_init_blues): Make compiler happy. * src/base/ftlcdfil.c (_ft_lcd_filter_fir): Use only four elements for `fir'. Fix `signed' vs. `unsigned' issues. * src/sfnt/sfobjs.c (WRITE_BYTE): Removed, unused. (WRITE_USHORT, WRITE_ULONG): Add proper casts. * src/truetype/ttgload.c (TT_Get_VMetrics): Add proper casts. * src/truetype/ttinterp.c (Ins_DELTAP): Add proper casts for `B1' and `B2'.
Sean McBride 7be2a94a 2014-02-08T13:55:38 Fix clang static analyzer and compiler warnings. * src/autofit/afhints.c (af_glyph_hints_align_weak_points), src/autofit/afloader (af_loader_load_g) <FT_GLYPH_FORMAT_COMPOSITE>, src/base/ftcalc.c (FT_MSB), src/base/ftoutln.c (FT_Outline_Decompose), src/bdf/bdfdrivr.c (bdf_interpret_style), src/cff/cffparse.c (cff_parse_integer), src/cid/cidparse.c (cid_parser_new), src/pfr/pfrload.c (pfr_phy_font_load), src/raster/ftraster.c (Decompose_Curve), src/sfnt/sfdriver.c (sfnt_get_ps_name), src/sfnt/ttcmap.c (tt_cmap12_next, tt_cmap13_next), src/smooth/ftgrays.c (gray_hline): Remove dead code. * src/autofit/afmodule.c (af_property_get_face_globals, af_property_set, af_property_get), src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Make functions static. * src/base/ftobjs.c (ft_remove_renderer): Protect against library == NULL. (ft_property_do): Make function static. * src/base/ftrfork.c: Include `ftbase.h'. * src/sfnt/ttsbit.c (tt_face_load_sbix_image) [!FT_CONFIG_OPTION_USE_PNG], src/type1/t1gload.c (T1_Compute_Max_Advance): Avoid compiler warning. * src/truetype/ttinterp.c (TT_New_Context): Reduce scope of variable.
Chongyu Zhu 94c66944 2014-01-08T08:52:59 [arm] Fix Savannah bug #41138, part 2. * builds/unix/ftconfig.in (FT_MulFix_arm), include/config/ftconfig.h (FT_MulFix_arm), src/truetype/ttinterp.c (TT_MulFix14_arm): Fix preprocessor conditionals for `add.w'.
Werner Lemberg b337fa25 2013-12-21T19:33:15 Fix Savannah bug #40975 (sort of). * src/truetype/ttinterp.c (Ins_IP): Fix sign typo to make FreeType behave the same as the Windows TrueType engine for the invalid case.
Infinality 8bb09b0f 2013-12-11T09:01:13 [truetype] Simplify logic of rendering modes. This patch unifies the subpixel and non-subpixel cases. * src/truetype/ttinterp.h (TT_ExecContextRec): Remove `grayscale_hinting'; all code should refer to `grayscale' instead. Remove unused `native_hinting' member. Rename `subpixel_hinting' member to `subpixel. * src/truetype/ttgload.c (TT_LOADER_SET_PP): Updated. (tt_loader_init): Updated. * src/truetype/ttinterp.c (Ins_GETINFO): Simplify. Updated.
Werner Lemberg 7d449436 2013-11-02T11:36:37 [truetype] Fix GETINFO opcode handling of subpixel hinting bits. * src/truetype/ttinterp.c (Ins_GETINFO): Don't request bit 6 set to get info on subpixel hinting. * docs/CHANGES: Updated.
Werner Lemberg ebf52d6a 2013-11-01T13:26:28 [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.
Chongyu Zhu 41632b58 2013-10-15T11:40:34 [arm] Fix thumb2 inline assembly under LLVM. When using `ADD' with an immediate operand, the instruction is actually `ADD Rd, Rn, #<imm12>', that is, the maximum of the immediate operand cannot exceed 4095. It will fail to compile with LLVM. However, in GCC, due to some legacy compatibility considerations, `ADD.W' will be automatically emitted when the immediate operand is larger than 4095. * builds/unix/ftconfig.in, include/freetype/config/ftconfig.h (FT_MulFix_arm) [__GNUC__]: Support clang compiler. * src/truetype/ttinterp.c (TT_MulFix14_arm) [__GNUC__]: Ditto.
Werner Lemberg a32682f1 2013-08-06T00:21:46 Fix gcc pragmas, part 2. * src/truetype/ttinterp.c (TT_MulFix14_long_long, TT_DotFix14_long_long): `#pragma gcc diagnostic {push,pop}' has been introduced with gcc version 4.6.
Werner Lemberg 69e524d5 2013-08-05T23:38:32 Fix gcc pragmas. * src/truetype/ttinterp.c (TT_MulFix14_long_long, TT_DotFix14_long_long): Older gcc versions don't accept diagnostic pragmas within a function body.
David Turner f66d48e9 2013-07-16T13:18:00 Add assembler code for TT_MulFix14 and TT_DotFix14. This patch provides slightly optimized versions for ARM, x86, and x86_64 CPUs if built with GCC. Also remove some dead code. * src/truetype/ttinterp.c (TT_MulFix14_arm, TT_MulFix14_long_long, TT_DotFix14_long_long): New functions.
Werner Lemberg 25b7da53 2013-06-19T10:23:36 * Version 2.5.0 released. ========================= Tag sources with `VER-2-5-0'. * docs/VERSION.DLL: Update documentation and bump version number to 2.5.0. * README, Jamfile (RefDoc), builds/win32/vc2005/freetype.vcproj, builds/win32/vc2005/index.html, builds/win32/vc2008/freetype.vcproj, builds/win32/vc2008/index.html, builds/win32/vc2010/freetype.vcxproj, builds/win32/vc2010/index.html, builds/win32/visualc/freetype.dsp, builds/win32/visualc/freetype.vcproj, builds/win32/visualc/index.html, builds/win32/visualce/freetype.dsp, builds/win32/visualce/freetype.vcproj, builds/win32/visualce/index.html, builds/wince/vc2005-ce/freetype.vcproj, builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/freetype.vcproj, builds/wince/vc2008-ce/index.html: s/2.4.12/2.5.0/, s/2412/250/. * include/freetype/freetype.h (FREETYPE_MINOR): Set to 5. (FREETYPE_PATCH): Set to 0. * builds/unix/configure.raw (version_info): Set to 16:2:10. * src/base/ftobjs.c (FT_Open_Face): Pacify compiler. * src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIRP): Ditto.
Werner Lemberg 99e60d84 2013-06-10T01:44:37 Fix Savannah bug #39160. * src/truetype/ttinterp.c (Ins_SDPVTL): Set projection vector too for the degenerate case.
Behdad Esfahbod 2d6e1fbc 2013-05-23T08:01:20 Compilation fix. * src/truetype/ttinterp.c (TT_RunIns) [!TT_CONFIG_OPTION_SUBPIXEL_HINTING]: Make it work.
Infinality 3c783c1b 2013-05-21T21:03:00 [truetype] Formatting and an additional subpixel tweak.
Infinality 18f35ed1 2013-05-21T20:51:15 [truetype] Adjust subpixel zp2 moves and tweak rules.
Infinality 63bfa832 2013-05-20T07:38:21 [truetype] Simplify and improve subpixel function detection. Some small enhancements have allowed the removal of many macros and the simplification of existing rules in `ttsubpix.c'. * src/truetype/ttsubpix.h (SPH_TWEAK_ALLOW_X_DMOVEX, SPH_TWEAK_ALLOW_X_MOVE_ZP2, SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES, SPH_TWEAK_SKIP_INLINE_DELTAS, SPH_TWEAK_MIRP_CVT_ZERO): Removed. (SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP): New rule macro. * src/truetype/ttsubpix.c: Updated affected rules. * src/truetype/ttinterp.c (Direct_Move_X): Updated. (INS_FDEF): Add additional function detection. (INS_ENDF): Set runtime flag. (Ins_CALL): Skip the call under certain conditions. Remove bad code. (Ins_LOOPCALL): Skip the call under certain conditions. Remove bad code. (Move_Zp2_Point): Updated. (Ins_SHPIX): Updated. Skip the move under some situations. (Ins_MIAP): Improve conditions. (Ins_MIRP): Updated. (Ins_DELTAP): Skip move under certain conditions. Simplify conditions. (TT_RunIns): Updated. Add code to handle new function detection. Trace messages.
Werner Lemberg f04951af 2013-05-17T13:51:07 [truetype] Add `interpreter-version' property. This makes the option TT_CONFIG_OPTION_SUBPIXEL_HINTING controllable at runtime. * src/truetype/ttdriver.c: Include FT_TRUETYPE_DRIVER_H. (tt_property_set, tt_property_get): Fill templates. * src/truetype/ttobjs.h (TT_DriverRec): Add `interpreter_version' member. Remove unused `extension_component' member. * src/truetype/ttgload.c: Include FT_TRUETYPE_DRIVER_H. (tt_get_metrics, TT_Hint_Glyph, TT_Process_Simple_Glyph, compute_glyph_metrics, tt_loader_init): Use `interpreter_version'. * src/truetype/ttinterp.c: Include FT_TRUETYPE_DRIVER_H. (SUBPIXEL_HINTING): New macro to check `interpreter_version' flag. Update all affected functions to use it. Use TT_INTERPRETER_VERSION_XXX where appropriate. * src/truetype/ttobjs.c: Include FT_TRUETYPE_DRIVER_H. (tt_driver_init): Initialize `interpreter_version'. * src/truetype/ttsubpix.c: Include FT_TRUETYPE_DRIVER_H. Use TT_INTERPRETER_VERSION_XXX where appropriate.
Werner Lemberg 94152819 2013-05-04T16:40:12 More fixes for clang's `sanitize' feature. * src/base/ftcalc.c (FT_DivFix): Use unsigned values for computations which use the left shift operator and convert to signed as the last step. * src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate, FT_Vector_Length, FT_Vector_Polarize): Ditto. * src/cff/cffgload.c (cff_decoder_parse_charstrings): Simplify. * src/cff/cffload.c (cff_subfont_load): Fix constant. * src/cff/cffparse.c (cff_parse_integer, cff_parse_real, do_fixed, cff_parse_fixed_dynamic): Use unsigned values for computations which use the left shift operator and convert to signed as the last step. * src/cid/cidload.c (cid_get_offset): Ditto. * src/psaux/psconv.c (PS_Conv_ToFixed): Ditto. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto. * src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14): Ditto.
Werner Lemberg 89f50647 2013-03-14T17:50:49 */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate. FT_Err_XXX and friends are no longer directly used in the source code.
Werner Lemberg e3c93015 2013-03-14T11:21:17 */*: Use FT_Err_Ok only. This is a purely mechanical conversion.
Werner Lemberg 059bc335 2013-03-14T10:27:35 */*: Use `FT_THROW'. This is essentially a mechanical conversion, adding inclusion of `FT_INTERNAL_DEBUG_H' where necessary, and providing the macros for stand-alone compiling modes of the rasterizer modules. To convert the remaining occurrences of FT_Err_XXX and friends it is necessary to rewrite the code. Note, however, that it doesn't harm if some cases are not handled since FT_THROW is a no-op.
Werner Lemberg 00dfa330 2013-02-05T19:23:16 [truetype] A better fix for Savannah bug #38211. * src/truetype/ttinterp.c (Ins_IP): Implement identical behaviour to MS rasterizer if rp1 == rp2 (confirmed by Greg Hitchcock).
Werner Lemberg 40633205 2013-02-01T12:55:44 [truetype] Fix Savannah bug #38211. * src/truetype/ttinterp.c (Ins_IP): Make FreeType behave identical to other interpreters if rp1 == rp2 (which is invalid).