src/truetype/ttinterp.c


Log

Author Commit Date CI Message
Werner Lemberg 0aca17cf 2017-08-22T08:25:14 [truetype] Integer overflow. Changes triggered by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3107 * src/truetype/ttinterp.c (Ins_MDRP, Ins_MIRP, Ins_ALIGNPTS): Use NEG_LONG.
Werner Lemberg 17196b7c 2017-08-05T18:58:34 [truetype] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2868 * src/truetype/ttinterp.c (Ins_ALIGNRP): Use NEG_LONG.
Nikolaus Waxweiler 7f44c2db 2017-08-03T06:15:30 [truetype] Do not set any ClearType flags in v40 monochrome mode. This fixes weird behavior of instructions that resulted in rendering differences between v35 and v40 in monochrome mode, e.g., in `timesbi.ttf'. * src/truetype/ttinterp.c (Ins_GETINFO) [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Check `subpixel_hinting_lean'.
Werner Lemberg ca799e9b 2017-07-03T06:27:52 [truetype] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2455 * src/truetype/ttinterp.c (Ins_SCFS): Use SUB_LONG.
Werner Lemberg dde8f5ab 2017-06-27T06:16:04 [truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2384 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2391 * src/base/ftcalc.c (FT_MulDiv, FT_MulDiv_No_Round, FT_DivFix): Use NEG_LONG. * src/truetype/ttinterp.c (Ins_SxVTL): Use NEG_LONG.
Werner Lemberg b27cef27 2017-06-24T20:17:46 [truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2364 * src/truetype/ttinterp.c (Ins_ISECT): Use NEG_LONG.
Werner Lemberg 298e2ea5 2017-06-22T11:52:43 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2323 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2328 * src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and SUB_INT32. * src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG.
Werner Lemberg 8c763fb1 2017-06-20T07:49:52 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2300 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2313 * src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32. * src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS.
Werner Lemberg 4dc00cf5 2017-06-16T13:33:09 [truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2270 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2278 * src/truetype/ttinterp.c (Ins_MDRP, _iup_worker_interpolate): Use ADD_LONG and SUB_LONG.
Werner Lemberg 5c402d97 2017-06-13T06:56:48 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2216 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2218 * src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32. * src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG.
Werner Lemberg 9038837e 2017-06-09T20:42:46 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186 * src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32. * src/truetype/ttinterp.c (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): Use ADD_LONG, SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG, FT_PAD_ROUND_LONG (Ins_SxVTL, Ins_MIRP): Use SUB_LONG. (_iup_worker_shift): Use SUB_LONG and ADD_LONG.
Werner Lemberg dcd8de27 2017-06-09T11:21:58 */*: Remove `OVERFLOW_' prefix. This increases readability.
Werner Lemberg 7bffeacd 2017-06-07T17:08:01 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2133 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2137 * src/cff/cf2hints.c (cf2_hint_init): Use OVERFLOW_SUB_INT32. * src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use OVERFLOW_SUB_LONG.
Werner Lemberg 9fa8a299 2017-06-04T20:43:08 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2075 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2088 * src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32. * src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG, OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG.
Werner Lemberg addb2ddd 2017-06-03T21:05:42 [base, cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068 * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. * src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32. * src/truetype/ttgload.c (compute_glyph_metrics): User OVERFLOW_SUB_LONG. * src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig, Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X, Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG.
Werner Lemberg 1ea34322 2017-06-03T06:52:13 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. (Ins_SUB): Use OVERFLOW_SUB_LONG. (Ins_NEG): Use NEG_LONG.
Werner Lemberg 8d435c46 2017-06-01T07:09:44 * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter again. Problem reported by Marek Kašík <mkasik@redhat.com>. The problematic font that exceeds the old limit is Padauk-Bold, version 3.002, containing bytecode generated by a buggy version of ttfautohint.
Nikolaus Waxweiler a0455468 2017-05-20T07:28:46 [truetype] Always use interpreter v35 for B/W rendering (#51051). * src/truetype/ttgload.c (tt_loader_init) [TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL]: Adjust `subpixel_hinting_lean', `grayscale_cleartype', and `vertical_lcd_lean' accordingly. * src/truetype/ttinterp.c (Ins_GETINFO): Updated. (TT_RunIns): Update `backward_compatibility' flag.
Werner Lemberg 8cd31eb7 2017-05-03T23:54:29 */*: s/backwards compatibility/backward compatibility/.
Werner Lemberg 5f18d867 2017-04-22T23:02:21 [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). * src/truetype/ttobs.h (TT_SizeRec): Add field `hinted_metrics' to hold hinted metrics. Make `metrics' a pointer so that `tt_glyph_load' can easily switch between metrics. * src/truetype/ttdriver.c (tt_size_request): Updated. (tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is used. * src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph, TT_Process_Composite_Component, load_truetype_glyph, compute_glyph_metrics, TT_Load_Glyph): Updated. * src/truetype/ttinterp.c (TT_Load_Context): Updated. * src/truetype/ttobjs.c (tt_size_reset): Updated. * src/truetype/ttsubpix.c (sph_set_tweaks): Updated.
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.