src/truetype/ttgload.c


Log

Author Commit Date CI Message
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.
Werner Lemberg 8982405f 2017-01-03T09:46:19 [truetype] Various minor fixes. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction size only if we do native hinting. (TT_Load_Glyph): Trace returned error code. * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace returned error code. (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is invalid.
Werner Lemberg 4441f7b2 2016-12-26T17:08:17 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp. Other minor formatting.
Werner Lemberg e6a429e2 2016-12-21T20:27:48 [cff, truetype] Another try for #49829. * src/cff/cffdrivr.c: Don't include `FT_SERVICE_METRICS_VARIATIONS_H'. (cff_get_advances): Use `ttface->variation_support'. * src/truetype/ttdriver.c (tt_get_advances): Use `ttface->variation_support'. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Use `ttface->variation_support'.
Ben Wagner cc576f80 2016-12-20T11:37:42 [truetype] Fix linear metrics of GX variation fonts. When asking for an unhinted non-default variations, `linearVertAdvance' is currently the value from the `hmtx' table instead of the actual value after applying the variation. `HVAR' support fixes this, but fonts will exist without that table and will need sane fallback. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Implement linear advance adjustments if `HVAR' or `VVAR' tables are missing.
Werner Lemberg eb6d0208 2016-12-18T09:29:58 Minor GX code shuffling. * include/freetype/internal/tttypes.h (TT_Face): Move `is_default_instance' into TT_CONFIG_OPTION_GX_VAR_SUPPORT block. * src/sfnt/sfobjs.c (sfnt_init_face): Updated. * src/truetype/ttgload.c (IS_DEFAULT_INSTANCE): New macro. (TT_Load_Glyph): Use it.
Werner Lemberg 5d664b6d 2016-12-17T20:47:42 Use FT_SET_ERROR where useful. Other minor code formatting.
Werner Lemberg 2067c698 2016-09-29T19:49:07 [truetype] Disallow bitmap strokes for non-default instances. Also speed up access of default instances if GX variations are active. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `is_default_instance' member. * src/sfnt/sfobjs.c (sfnt_init_face): Initialize `is_default_instance'. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Add test for default instance. (TT_Load_Glyph): Load embedded bitmaps for default instance only. * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Compute `is_default_instance'.
Werner Lemberg 2ecf89b4 2016-09-28T19:06:21 */*: s/FT_MEM_ZERO/FT_ZERO/ where appropriate.
Werner Lemberg e27b8a55 2016-09-27T21:21:01 [truetype] Speed up `TT_Load_Glyph'. This avoids additional calls to `tt_face_lookup_table' for the `glyf' table, which can be expensive. * include/freetype/internal/tttypes.h (TT_LoaderRec): Move `glyf_offset' field to ... (TT_FaceRec): ... this structure. * src/truetype/ttgload.c (load_truetype_glyph): Updated. (tt_loader_init): Move initialization of `glyf_offset' to ... * src/truetype/ttpload.c (tt_face_load_loca): .. this function.
Werner Lemberg cf4224ad 2016-08-16T06:44:23 [truetype] Fix compiler warning. * src/truetype/ttgload.c (load_truetype_glyph): Add cast.
Behdad Esfahbod 8183eeb1 2016-08-06T23:12:55 [truetype] Fix GX variation handling of composites. * src/truetype/ttgload.c (load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `ARGS_ARE_XY_VALUES' flag.
Werner Lemberg fae4ec05 2016-07-29T06:43:32 [sfnt, truetype] Don't abort on invalid `maxComponentDepth'. Since 2016-05-16 we detect infinite recursion directly. * src/sfnt/ttload.c (tt_face_load_maxp): Don't adjust `maxComponentDepth'. * src/truetype/ttgload.c (load_truetype_glyph): Don't abort if `maxComponentDepth' is not valid. Instead, simply adjust its value and emit a tracing message.
Werner Lemberg 8ba407a7 2016-06-25T18:09:22 [truetype] Really fix deallocation in case of error (#47726). * src/truetype/ttgload.c (load_truetype_glyph): Thinko; initialize `outline.points' also.
Nikolaus Waxweiler 01de37e5 2016-05-18T07:07:44 [truetype] Make TT_LOADER_SET_PP support subpixel hinting [3/3]. * src/truetype/ttgload.c (TT_LOADER_SET_PP): Replace macro with... (tt_loader_set_pp): ... this new function. Update all callers.
Nikolaus Waxweiler 59615736 2016-05-18T06:57:59 [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.
Werner Lemberg 533887a9 2016-05-16T20:38:41 Whitespace, formatting.
suzuki toshiya a7d8bdbc 2016-05-16T21:54:32 [truetype] Improve the recursive reference detector. The previous fix for #46372 misunderstood a composite glyph referring same component twice as a recursive reference. See the discussion http://lists.gnu.org/archive/html/freetype/2016-05/msg00000.html Thanks to Khaled Hosny for finding this issue. * src/truetype/ttgload.c (ft_list_get_node_at): A function to get the i-th node from FT_List. (load_truetype_glyph): In the traversal scan of the reference tree in the composite glyph, we clear the nodes filled by previous sibling chain.
Werner Lemberg 432e00db 2016-04-24T08:14:07 [truetype] Fix deallocation in case of error (#47726). * src/truetype/ttgload.c (load_truetype_glyph): Initialize fields in `outline' that are going to be deallocated in case of error.
Werner Lemberg b6633073 2016-03-22T08:26:55 * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Minor. This fixes an AddressSanitizer issue: ttgload.c:430:7: runtime error: null pointer passed as argument 1, which is declared to never be null
Werner Lemberg 9adeab64 2016-01-13T11:54:10 Update copyright year.
Werner Lemberg 4679bf83 2015-11-28T19:05:36 Fix C++ compilation. * src/autofit/afloader.c: Include FT_INTERNAL_CALC_H. * src/truetype/ttgload.c (load_truetype_glyph): Pacify compiler.
Werner Lemberg 837285e4 2015-11-09T09:20:08 [truetype] Remove integer to pointer conversion compiler warning. Problem reported by Alexei. * src/truetype/ttgload.c (load_truetype_glyph): Use a solution found in the glib library to fix the issue.
Werner Lemberg 758d55e5 2015-11-04T11:44:47 [truetype] Catch infinite recursion in subglyphs (#46372). * include/freetype/internal/tttypes.h (TT_LoaderRec): New field `composites'. * src/truetype/ttgload.c: Include FT_LIST_H. (load_truetype_glyph): Add composite subglyph index to a list; abort if index is already in list. (tt_loader_init): Updated. (tt_loader_done): New function. (TT_Load_Glyph): Call `tt_loader_done'.
Werner Lemberg 040edaf5 2015-11-04T07:35:51 [truetype] Better tracing of composite glyphs. * src/truetype/ttgload.c (TT_Load_Composite_Glyph, load_truetype_glyph): Implement it.
Hin-Tak Leung 265ade8e 2015-09-26T14:51:30 Add new FT_LOAD_COMPUTE_METRICS load flag. * include/freetype/freetype.h (FT_LOAD_COMPUTE_METRICS): New macro. * src/truetype/ttgload.c (compute_glyph_metrics): Usage.
Werner Lemberg bd0438a4 2015-09-16T18:05:43 Minor fixes for some clang warnings. * src/base/ftoutln.c (FT_Outline_EmboldenXY): Cast, possible missing initialization. * src/truetype/ttgload.c (TT_Process_Composite_Component): Cast.
Alexei Podtelezhnikov ae258aa0 2015-08-14T23:23:18 [truetype] Clean up. * src/truetype/ttgload.c (TT_Process_Composite_Component): Use `FT_Outline_Transform' and `FT_Outline_Translate'. (translate_array): Dropped.
Alexei Podtelezhnikov 98e8e999 2015-08-06T00:06:14 [truetype] Clean up types. * src/truetype/ttobjs.c (TT_Size): Move declaration from here. * include/freetype/internal/tttypes.h (TT_Size): ... to here. (TT_LoaderRec): Switch to appropriate types for `face' and `size'. * src/truetype/ttgload.c: Remove corresponding type casts. * src/truetype/ttsubpix.c: Ditto.
Werner Lemberg 8dfc7601 2015-08-03T12:23:30 * src/truetype/ttgload.c (load_truetype_glyph) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Fix crash for composite glyphs having a depth greater than 1.
Werner Lemberg 6343ba22 2015-08-01T07:53:48 Fix some bugs found by clang's `-fsanitize=undefined' (#45661). * src/base/ftrfork.c (FT_Raccess_Get_HeaderInfo): Only accept positive values from header. Check overflow. * src/base/ftoutln.c (SCALED): Correctly handle left-shift of negative values. * src/bdf/bdf.h (_bdf_glyph_modified, _bdf_set_glyph_modified, _bdf_clear_glyph_modified): Use unsigned long constant. * src/bdf/bdfdrivr.c (BDF_Size_Select, BDF_Glyph_Load): Don't left-shift values that can be negative. * src/pcf/pcfdrivr.c (PCF_Size_Select, PCF_Glyph_Load): Don't left-shift values that can be negative. * src/raster/ftraster.c (SCALED): Correctly handle left-shift of negative values. * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Don't left-shift values that can be negative. * src/truetype/ttgload.c (TT_Load_Composite_Glyph, compute_glyph_metrics, load_sbit_image): Don't left-shift values that can be negative.
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.
Werner Lemberg e9df4e47 2015-05-31T12:21:34 [truetype] In GX, make private point numbers work correctly. This is completely missing in Apple's documentation: If a `gvar' tuple uses private point numbers (this is, deltas are specified for some points only), the uncovered points must be interpolated for this tuple similar to the IUP bytecode instruction. Examples that need this functionality are glyphs `Oslash' and `Q' in Skia.ttf. * src/truetype/ttgxvar.c (tt_delta_shift, tt_delta_interpolate, tt_handle_deltas): New functions. (TT_Vary_Get_Glyph_Deltas): Renamed to... (TT_Vary_Apply_Glyph_Deltas): ... this; it directly processes the points and does no longer return an array of deltas. Add tracing information. Call `tt_handle_deltas' to interpolate missing deltas. Also fix a minor memory leak in case of error. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Updated.
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 0a6b6ff7 2015-05-17T22:54:48 [truetype] Fix loading of composite glyphs. * src/truetype/ttgload.c (TT_Load_Composite_Glyph): If the ARGS_ARE_XY_VALUES flag is not set, handle argument values as unsigned. I trust `ttx' (which has exactly such code) that it does the right thing here... The reason that noone has ever noticed this bug is probably the fact that point-aligned subglyphs are rare, as are subglyphs with a number of points in the range [128;255], which is quite large (or even in the range [32768;65535], which is extremely unlikely).
Alexei Podtelezhnikov adb08efc 2015-04-11T23:54:19 [bdf,pcf,truetype] NULL.
Werner Lemberg 0a33a398 2015-02-17T08:03:05 [truetype] Various signedness fixes. * include/internal/ftgloadr.h, src/truetype/ttpload.c: Apply. * src/truetype/ttgload.c: Apply. (TT_Get_VMetrics): Protect against invalid ascenders and descenders while constructing advance height.
Jon Anderson 416d8796 2015-02-06T10:16:45 [truetype] Fix regression in the incremental glyph loader. * src/truetype/ttgload.c (load_truetype_glyph): For incremental fonts, the glyph index may be greater than the number of glyphs indicated, so guard the check with a preprocessor conditional.
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 6689a009 2014-11-25T08:53:09 [Savannah bug #43682] Properly handle missing return errors. The functions in this patch *do* return non-trivial errors that must be taken care of. * src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c (FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render), src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>, src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode (t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c (load_truetype_glyph <subglyph loop>, tt_loader_init, TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend), src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
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 03987bfd 2014-10-16T07:19:46 A better fix for Savannah bug #43392. Suggested by Doug Felt <dougfelt@gmail.com>. * src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics): Set `vertAdvance' to zero... * src/truetype/ttgload.c (TT_Load_Glyph): ... and set here a default value for `vertAdvance' based on `linearVertAdvance' in case `vertAdvance' is zero. Note that the previous computed ad-hoc value for `linearVertAdvance' was apparently not tested in a real-life situation.
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 b24e8d33 2014-03-06T14:54:22 Remove more clang analyzer warnings. * src/bdf/bdflib.c (_bdf_readstream), src/truetype/ttgload.c (TT_Load_Glyph): Remove dead stores.
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 69d1a360 2013-12-10T10:12:27 [truetype] Fix scaling of vertical phantom points. * src/truetype/ttgload.c (load_truetype_glyph): Scale pp3.x and pp4.x also.
Werner Lemberg 7318b1aa 2013-12-10T09:40:36 Formatting.
Werner Lemberg 05c786d9 2013-12-10T08:38:57 [truetype] Fix positioning of composite glyphs. Problem reported by Nigel Tao <nigeltao@golang.org>. * src/truetype/ttgload.c (TT_Hint_Glyph): Remove code that shifts the glyph (component) by a fractional value computed from the LSB phantom point. This is wrong, since the horizontal phantom points get rounded horizontally later on.
Werner Lemberg 98d185c7 2013-12-07T09:26:55 [truetype] Next round in phantom point handling. Greg Hitchcock provided very interesting insights into the complicated history of the horizontal positions of the TSB and BSB phantom points. * src/truetype/ttgload.c (TT_LOADER_SET_PP) [TT_CONFIG_OPTION_SUBPIXEL_HINTING]: Use `subpixel_hinting' and `grayscale_hinting' flags as conditionals for the x position of TSB and BSB.
Werner Lemberg c2b47539 2013-12-03T07:01:57 [truetype] Remove dead code. Reported by Nigel Tao <nigeltao@golang.org>. * include/internal/tttypes.h (TT_LoaderRec): Remove unused `preserve_pps' field. * src/truetype/ttgload.c (TT_Hint_Glyph): Updated.
Werner Lemberg bdd5e75e 2013-12-03T06:57:02 [truetype] Fix phantom point handling. This is a further improvement to the changes from 2013-11-06. * src/truetype/ttgload.c (TT_Hint_Glyph): Horizontal phantom points are rounded horizontally, vertical ones are rounded vertically. (TT_LOADER_SET_PP): The horizontal position of vertical phantom points in pre-ClearType mode is zero, as shown in the OpenType specification.
Werner Lemberg a44b784b 2013-12-02T09:52:38 Formatting.
Werner Lemberg 64872a50 2013-12-02T07:51:17 [truetype] Fix change from 2013-11-20. Problem reported by Akira Kakuto <kakuto@fuk.kindai.ac.jp>. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Protect call to `Update_Max' with both a TT_USE_BYTECODE_INTERPRETER guard and a `IS_HINTED' clause. Also remove redundant check using `maxSizeOfInstructions' – in simple glyphs, the bytecode data comes before the outline data, and a validity test for this is already present.
Werner Lemberg 28626869 2013-11-20T21:06:18 [truetype] Don't trust `maxp's `maxSizeOfInstructions'. Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>; see http://lists.nongnu.org/archive/html/freetype-devel/2013-08/msg00005.html for details. * src/base/ftobjs.c (FT_Load_Glyph): Check size of `fpgm' and `prep' tables also for setting `autohint'. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use code from `TT_Process_Composite_Glyph' for handling unreliable values of `maxSizeOfInstructions'.
Werner Lemberg ea5c781a 2013-11-12T08:55:26 [truetype] Fix last `truetype' commit. * src/truetype/ttgload.c (tt_get_metrics): Preserve stream position. Return error value. (load_truetype_glyph): Updated.
Werner Lemberg 5e225b7c 2013-11-06T08:41:59 [truetype] Fix handling of phantom points in composite glyphs. Problem reported by Nigel Tao <nigeltao@golang.org>. This is a follow-up commit to the previous one. * src/truetype/ttgload.c (load_truetype_glyph): Call `tt_get_metrics' after loading the glyph header.
Werner Lemberg 7e4b0fbf 2013-11-06T07:14:49 [truetype] Improve emulation of vertical metrics. This commit also improves the start values of vertical phantom points. Kudos to Greg Hitchcock for help. * src/truetype/ttgload.c (TT_Get_VMetrics): Add parameter to pass `yMax' value. Replace code with fixed Microsoft definition. (tt_get_metrics): Updated. (TT_LOADER_SET_PP): Add explanation how to initialize phantom points, taken from both the OpenType specification and private communication with Greg (which will eventually be added to the standard). Fix horizontal position of `pp3' and `pp4'. * src/truetype/ttgload.h: Updated. * src/truetype/ttdriver.c (tt_get_advances): Updated. * docs/CHANGES: Updated.
Werner Lemberg c6064286 2013-11-05T13:29:15 [truetype] Correctly reset point tags for glyph components. Problem reported by Nigel Tao <nigeltao@golang.org>. * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix loop.
Werner Lemberg e921bdeb 2013-11-01T12:41:27 Comment fix.
Werner Lemberg ffee64af 2013-08-26T12:55:48 Better tracing of loaded glyphs. Previously, the loading of a glyph was traced at level 4, if at all. With this change, all font loading routines emit a tracing message at level 1, making it easier to select tracing output (for example using F2_DEBUG="any:1 afhints:7 aflatin:7"). * src/bdf/bdfdrivr.c (BDF_Glyph_Load): Add tracing message. * src/cff/cffdrivr.c (cff_glyph_load): Ditto. * src/cff/cffgload.c (cff_decoder_prepare): Improve tracing messages. * src/cid/cidgload.c (cid_load_glyph): Use level 1 for tracing message. * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto. * src/pfr/pfrobjs.c (pfr_slot_load): Add tracing message. * src/truetype/ttgload.c (TT_Load_Glyph): Ditto. * src/type1/t1gload.c (T1_Load_Glyph): Ditto. * src/type42/t42objs.c (T42_GlyphSlot_Load): Ditto. * src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto.
Werner Lemberg 5e094c6f 2013-06-10T14:59:21 [truetype] Improve handling of broken sbit advance widths. * src/truetype/ttgload.c (TT_Load_Glyph): Use the glyph's (scaled) `linearHoriAdvance' if the sbit's `horiAdvance' value is zero. Cf. font `Fixedsys Excelsior' v3.01 (FSEX300.ttf), glyph A, 16ppem.
Werner Lemberg 45392b77 2013-06-05T13:43:20 Fix compiler warnings. * include/freetype/internal/ftmemory.h: Decorate memory allocation macros with `FT_Long' where appropriate. Remove duplicate of FT_MEM_QRENEW_ARRAY definition. * src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use cast. * src/base/ftobjs.c: Add warning disabling pragma for MSVC while including `md5.c'. * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdESC>: Add cast. * src/sfnt/ttsbit.c (tt_sbit_decoder_load_compound): Fix casts. (tt_sbit_decoder_load_bitmap): Beautification. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Initialize variables (earlier). * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Pacify compiler. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use unsigned constants where appropriate. * src/type1/t1load.c (T1_Get_MM_Var): Ditto.
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 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 6b9034f0 2013-01-28T13:56:23 Formatting, comment improvements.
Infinality a5fe3595 2013-01-26T12:29:52 [truetype] Align more to ClearType whitepaper for sph.
David 'Digit' Turner 72447195 2013-01-25T00:36:35 [truetype] Fix C++ compilation. * src/truetype/ttsubpix.h: Updated. (SPH_X_SCALING_RULES_SIZE): Moved and renamed to... * src/truetype/ttsubpix.c (X_SCALING_RULES_SIZE): This. (sph_X_SCALING_Rules): Removed. (scale_test_tweak): Make function static. (sph_test_tweak_x_scaling): New function. * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Updated.
Werner Lemberg e9f330ad 2013-01-24T09:12:56 [base] Make `FT_Hypot' really internal. * include/freetype/fttrigon.h (FT_Hypot): Move to... * include/freetype/internal/ftcalc.h: This file. * src/base/fttrigon.c (FT_Hypot): Move to... * src/base/ftcalc.c: This file. Include FT_TRIGONOMETRY_H. * src/truetype/ttgload.c: Don't include FT_TRIGONOMETRY_H.
Alexei Podtelezhnikov b6de8e66 2013-01-23T23:31:41 [base, truetype] New internal FT_Hypot function. * include/freetype/fttrigon.h (FT_Hypot): Declare it. * src/base/fttrigon.c (FT_Hypot): Define it. * src/truetype/ttgload.c (TT_Process_Composite_Component): Use it instead of explicit expressions. * src/truetype/ttinterp.c (Current_Ratio, Normalize): Use it instead of TT_VecLen. (TT_VecLen): Removed.
Werner Lemberg 71900980 2013-01-16T20:08:35 Minor.
David Turner 3a406127 2013-01-16T19:48:31 [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.
Werner Lemberg 7d6dc907 2012-12-27T01:08:24 * src/truetype/ttgload.c (tt_loader_init): Add more tracing.
Werner Lemberg df018924 2012-12-20T06:07:33 Formatting.
Infinality 1749ae20 2012-12-18T07:23:09 [truetype] Minor performance enhancement.
Infinality 71f242c2 2012-12-16T19:52:01 [truetype ] Remove unusued code. Add minor fixes.
Werner Lemberg 06e31e9b 2012-08-27T09:35:22 [truetype] Fix compilation warning. * src/truetype/ttgload.c (IS_HINTED): Move macro to... * src/truetype/ttobjs.h: This header file.
Werner Lemberg b3953aa7 2012-06-28T06:23:12 [truetype] Set the `subpixel_positioned' flag unconditionally. This is how the code currently behaves. * src/truetype/ttgload.c (tt_loader_init): Do it.
Werner Lemberg 83c0ebab 2012-06-27T08:16:06 Fix conditional compilation. * include/freetype/internal/ftcalc.h (FT_MulDiv_No_Round): Don't enclose with `TT_USE_BYTECODE_INTERPRETER'; we now need the function elsewhere also. * src/autofit/afcjk.h: Use AF_CONFIG_OPTION_CJK. * src/truetype/ttgload.c (tt_loader_init): Fix compiler warning. * src/truetype/ttinterp.c (Ins_MSIRP): Fix compiler warning. * src/truetype/ttinterp.h: Use TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
Infinality 79e36bae 2012-06-18T10:36:06 [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.
Werner Lemberg 9c6d1ac3 2012-04-07T06:39:25 Remove compiler warning. * src/truetype/ttgload.c (TT_Load_Glyph) [!TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Access `glyph->face' directly.
Werner Lemberg 0fc8debe 2012-03-02T16:09:51 [truetype] Fix Savannah bug #35689. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check first outline point.
Werner Lemberg 9290fa90 2012-02-29T17:29:07 [truetype] Remove redundant check. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Remove reduntant second check for ordered contour start points.
Behdad Esfahbod 8c82ec5b 2011-04-21T08:21:37 Always ignore global advance. This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant, deprecated, and ignored. The new behavior is what every major user of FreeType has been requesting. Global advance is broken in many CJK fonts. Just ignoring it by default makes most sense. * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics, tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph), src/truetype/ttgload.h: Implement it. * docs/CHANGES: Updated.
Werner Lemberg 6e3fee0b 2011-03-21T09:28:52 Typo.
Werner Lemberg 18931a5a 2011-02-01T07:08:43 [truetype] FT_LOAD_PEDANTIC now affects `prep' and `fpgm' also. * src/truetype/ttgload.c (tt_loader_init): Handle `FT_LOAD_PEDANTIC'. * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep, tt_size_init_bytecode, tt_size_ready_bytecode): New argument to handle pedantic mode. * src/truetype/ttobjs.h: Updated.
Werner Lemberg 91a97164 2011-01-30T20:12:54 Whitespace.
Werner Lemberg 6abb9232 2010-09-14T09:02:10 Improve tracing messages. * src/truetype/ttinterp.c (TT_RunIns): Improve wording of tracing message. * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Add tracing message. * src/truetype/ttgload.c (tt_loader_init): Add tracing message. * src/cache/ftcsbits.c (ftc_snode_load): Emit tracing message if glyph doesn't fit into a small bitmap container.
Werner Lemberg ae425e51 2010-06-29T12:31:08 Fix minor tracing issues. * src/cff/cffgload.c, src/truetype/ttgload.c: Adjust tracing levels.
Werner Lemberg f765e440 2010-06-24T10:34:29 */*: Use module specific error names where appropriate.
Werner Lemberg 6da023d1 2010-05-20T15:38:00 TrueType: Make FreeType ignore maxSizeOfInstructions in `maxp'. Acroread does the same. * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Call `Update_Max' to adjust size of instructions array if necessary and add a rough safety check. (load_truetype_glyph): Save `loader->byte_len' before recursive call. * src/truetype/ttinterp.h, src/truetype/ttinterp.c (Update_Max): Declare it as FT_LOCAL.
John Tytgat 8c4cce52 2010-04-05T08:22:22 Fix Savannah bug #29404. * src/truetype/ttgload.c: Revert change 2752bd1a (check on bit 1 of `head' table of TrueType fonts).
Chris Liddell 10cf3887 2010-02-18T17:09:30 Fix Savannah bug #28905. Initialize phantom points before calling the incremental interface to update glyph metrics. * src/truetype/ttgload.c (tt_get_metrics_incr_overrides) [FT_CONFIG_OPTION_INCREMENTAL]: New function, split off from... (tt_get_metrics): This. Updated. (load_truetype_glyph): Use tt_get_metrics_incr_overrides.