src/truetype


Log

Author Commit Date CI Message
Werner Lemberg 322b3be5 2017-01-15T13:57:25 * src/truetype/ttgxvar.c (tt_apply_var): Handle underline parameters also.
Werner Lemberg 723aafb5 2017-01-11T14:21:26 [truetype] Actually use metrics variation service. * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (ft_face_get_mvar_service): New auxiliary function to look up metrics variation service. (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call metrics variation service. * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for named instances.
Werner Lemberg d718ac4e 2017-01-11T14:12:34 [truetype] Provide metrics variation service. * include/freetype/internal/services/svmetric.h (FT_Metrics_Adjust_Func): Reduce number of necessary parameters. * src/truetype/ttgxvar.c: Include FT_LIST_H. (tt_size_reset_iterator): New auxiliary function for... (tt_apply_var): New function. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttdriver.c (tt_service_metrics_variations): Add `tt_apply_mvar'. * include/freetype/internal/ftserv.h (FT_ServiceCache): Add metrics variation service.
Werner Lemberg 07ee1d25 2017-01-11T12:50:51 [truetype] Parse `MVAR' table. * src/truetype/ttgxvar.h (MVAR_TAG_XXX): New macros for MVAR tags. (GX_Value, GX_MVarTable): New structures. (GX_Blend): Add it. * src/truetype/ttgxvar.c (GX_VALUE_SIZE, GX_VALUE_CASE, GX_GASP_CASE): New macros. (ft_var_get_value_pointer): New auxiliary function to get a pointer to a value from various SFNT tables already stored in `TT_Face'. (ft_var_load_mvar): New function. (TT_Get_MM_Var): Call it. (tt_done_blend): Updated.
Werner Lemberg 8ab08cff 2017-01-11T10:05:27 [truetype] More preparations for MVAR support. * src/truetype/ttobjs.c (tt_size_reset): Add argument to make function only recompute ascender, descender, and height. * src/truetype/ttobjs.h: Updated. * src/truetype/ttdriver.c (tt_size_select, tt_size_request): Updated.
Werner Lemberg 469ced7f 2017-01-08T09:28:34 [truetype] Again some GX code shuffling. We need this later on for MVAR also. * src/truetype/ttgxvar.c (tt_hadvance_adjust): Split off computing an item store variation delta into... (ft_var_get_item_delta): ...new function.
Werner Lemberg 02919134 2017-01-07T07:45:28 [truetype] More GX code shuffling. We need this later on for MVAR also. * src/truetype/ttgxvar.c (tt_done_blend): Split off handling of item variation store into... (ft_var_done_item_variation_store): ...new function.
Werner Lemberg fb90f00c 2017-01-06T22:23:52 [truetype] More generalization of GX stuff. We need this later on for MVAR also. * src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add parameters for delta-set index mapping and item variation store. (ft_var_load_item_variation_store): Add parameter for item variation store. s/hvarData/varData/. Move allocation of `hvar_table' to... (ft_var_load_hvar): ...this function. Updated.
Werner Lemberg 0bd0112f 2017-01-06T21:32:49 [truetype] Some GX structure renames for generalization. We need this later on for MVAR also. * src/truetype/ttgxvar.h (GX_HVarData): Renamed to... (GX_ItemVarData): ...this. (GX_HVarRegion): Renamed to... (GX_VarRegion): ...this. (GX_HVStore): Renamed to... (GX_ItemVarStore): ...this. (GX_WidthMap): Renamed to... (GX_DeltaSetIdxMap): ...this. (GX_HVarTable): Updated. * src/truetype/ttgxvar.c: Updated.
Werner Lemberg 9c814704 2017-01-06T21:13:36 [truetype] Code shuffling. * src/truetype/ttgxvar.c (): Split off loading of item variation store and delta set index mapping into... (ft_var_load_item_variation_store, ft_var_load_delta_set_index_mapping): ... new functions.
Werner Lemberg 7e1cce58 2017-01-06T20:31:22 [truetype] Add HVAR access without advance width map. * src/truetype/ttgxvar.c (ft_var_load_hvar): Handle case where `offsetToAdvanceWidthMapping' is zero. (tt_hadvance_adjust): Implement direct deltaSet access by glyph index.
Werner Lemberg 348d39c6 2017-01-05T12:29:55 Comment.
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.
Werner Lemberg 025226ae 2017-01-04T07:45:44 [cff, truetype] Minor tracing improvement. * src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c (tt_face_init): Indent first tracing message from SFNT driver.
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 248eaa4f 2017-01-03T00:27:07 Various fixes for clang's undefined behaviour sanitizer. * src/cff/cffload.c (FT_fdot14ToFixed): Fix casting. (cff_blend_doBlend): Don't left-shift negative numbers. Handle 5-byte numbers byte by byte to avoid alignment issues. * src/cff/cffparse.c (cff_parse): Handle 5-byte numbers byte by byte to avoid alignment issues. * src/cid/cidload (cid_read_subrs): Do nothing if we don't have any subrs. * src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing. * src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around definition of `ft_get_adobe_glyph_index'. * src/psnames/pstables.h: Regenerated. * src/psnames/psmodule.c: Inlude `pstables.h' twice to get both declaration and definition. * src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix casting.
Werner Lemberg e9a154e7 2016-12-31T21:41:08 [truetype] Check axis count in HVAR table. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=362 * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. (ft_var_load_avar): Fix tracing message.
Werner Lemberg 7591bf11 2016-12-29T21:39:06 [truetype] Variation font API stability issues. Make some functions work before a call to `TT_Set_MM_Blend'. * src/truetype/ttgxvar.c (tt_hadvance_adjust): Exit immediately if we don't blend. (TT_Get_MM_Blend, TT_Get_Var_Design): Return default values if we don't blend.
Werner Lemberg 91fc3bd7 2016-12-29T21:34:46 * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis data. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=348
Werner Lemberg 18018510 2016-12-29T21:30:06 [truetype] Tracing fixes. * src/truetype/ttgxvar.c (tt_hadvance_adjust): Emit correct information. (TT_Set_Var_Design): Fix typo. (TT_Get_Var_Design): Fix typos.
Werner Lemberg 84b0d992 2016-12-29T10:38:51 */*: Use `0.5f' for tracing 16.16 numbers.
Werner Lemberg e5e3556f 2016-12-27T06:49:37 [truetype, type1] Implement `FT_Get_Var_Design_Coordinates'. * src/truetype/ttgxvar.c (TT_Get_Var_Design): Implement. (TT_Set_Var_Design): Fix tracing. * src/type1/t1load.c (T1_Get_Var_Design): Implement.
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 a300c1c3 2016-12-24T09:27:15 * src/truetype/ttpload.c (tt_face_load_hdmx): Ignore `version'. Problem reported by 張俊芝 <418092625@qq.com>.
Werner Lemberg fde0b78c 2016-12-24T08:17:19 * src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length. This trivial fix allows us to accept more fonts. Problem reported by 張俊芝 <418092625@qq.com>.
Werner Lemberg 72091103 2016-12-21T23:46:29 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. I should really stop coding late in the evening... Thanks again to Ben for checking.
Werner Lemberg d44daf9e 2016-12-21T23:03:48 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko. Don't apply deltas twice for non-phantom points. Spotted by Ben Wagner.
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'.
Werner Lemberg 64a91137 2016-12-21T19:30:33 [truetype, sfnt] Introduce font variation flags to `TT_Face'. * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): New macros describing available functionality of various OpenType tables related to font variation. (TT_Face): New fields `variation_support' and `mvar_support', replacing and extending `use_fvar'. * src/sfnt/sfobjs.c (sfnt_init_face, sfnt_load_face): Use `variation_support'. * src/truetype/ttgxvar.c (ft_var_load_hvar): Set `variation_support' field. (TT_Vary_Apply_Glyph_Deltas): Updated.
Werner Lemberg 70704b34 2016-12-20T12:27:22 [truetype] Improve logic for getting fast advance widths. * src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c (tt_get_advances): Use `is_default_instance' for test; this gets recomputed after changing blend coordinates.
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 a1e85f11 2016-12-20T10:52:26 [cff, truetype] Fast advance width retrieval for fonts with HVAR. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM. * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (cff_get_advances): Test for HVAR and VVAR. * src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR.
Werner Lemberg a8652c59 2016-12-18T18:12:03 [truetype, cff] Extend `get_var_blend' function of MM service. In particular, we need access to named instance data. * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): Add argument for `FT_MM_Var'. * src/cff/cffload.c (cff_get_var_blend): Updated. * src/cff/cffload.h: Updated. * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. * src/truetype/ttgxvar.c (tt_get_var_blend): Updated. Accept value `NULL' for arguments. * src/truetype/ttgxvar.h: Updated.
Werner Lemberg 25f3ac2b 2016-12-18T15:50:18 [sfnt] Handle `fvar' with zero axes as a non-MM font. This is better behaviour than exiting with an error. * include/freetype/internal/tttypes.h (TT_Face): Add `use_fvar' field. * src/sfnt/sfobjs.c (sfnt_init_face): Compute `use_fvar', also updating the validation code. Use `use_fvar' to compute FT_FACE_FLAG_MULTIPLE_MASTERS. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Remove `fvar' validation code.
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 db17ceb4 2016-12-17T13:39:31 * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code.
Werner Lemberg 7c75b166 2016-12-17T13:28:24 [sfnt, truetype] Various sanitizing fixes. * src/sfnt/sfobjs.c (sfnt_init_face): If the axis count in `fvar' is zero, set `num_instances' to zero. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Handle `fvar' table with zero axes as invalid. * src/truetype/ttobjs.c (tt_face_init): Improve logic of loading `loca', `cvt', `fpgm', and `prep' table.
Werner Lemberg df2cf43e 2016-12-16T11:38:20 [truetype] Fix `cvar' sanity test. Reported by Dave Arnold. * src/truetype/ttgxvar.c (tt_face_vary_cvt): Use tuple count mask.
Werner Lemberg 68620248 2016-12-16T11:15:17 [cff, truetype] Remove compiler warnings; fix `make multi'. * src/cff/cf2font.h: Include `cffload.h'. * src/cff/cffload.c: Include FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. (cff_vstore_load): Eliminate `vsSize'. (cff_load_private_dict): Tag as `FT_LOCAL_DEF'. * src/cff/cffload.h: Include `cffobjs.h'. Provide declaration for `cff_load_private_dict'. * src/truetype/ttgxvar.c (ft_var_load_hvar): Eliminate `minorVersion' and `map_offset'.
Dave Arnold edf40148 2016-12-15T21:56:44 [cff] Implement CFF2 support (2/2). The font variation code. All parts dependent on the GX code in the `truetype' module are guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. In other words, you can still compile the `cff' module without defining TT_CONFIG_OPTION_GX_VAR_SUPPORT (which brings you CFF2 support without font variation). * src/cff/cf2font.c (cf2_font_setup): Add support for font variation. * src/cff/cf2font.h (CF2_Font): Add fields for variation data. * src/cff/cf2ft.c (cf2_free_instance): Free blend data. (cf2_getVStore, cf2_getNormalizedVector): New functions. * src/cff/cf2ft.h: Updated. * src/cff/cf2intrp.c: Include `cffload.h'. (cf2_cmdRESERVED_15, cf2_cmdRESERVED_16): Replace with... (cf2_cmdVSINDEX, cf2_cmdBLEND): ... this new enum values. (cf2_doBlend): New function. (cf2_interpT2CharString): Handle `vsindex' and `blend' opcodes. * src/cff/cffload.c (FT_fdot14ToFixed): New macro. (cff_vstore_done, cff_vstore_load): New functions. (cff_blend_clear, cff_blend_doBlend, cff_blend_build_vector, cff_blend_check_vector): New functions. (cff_load_private_dict): Add arguments for blend vector. Handle blend data. (cff_subfont_load, cff_subfont_done): Updated. (cff_font_load): Handle CFF2 variation store data. (cff_font_done): Updated. * src/cff/cffload.h: Include `cffparse.h'. Updated. * src/cff/cffobjs.c (cff_face_done): Updated. * src/cff/cffparse.c: Include `cffload.h'. (cff_parse_num): Handle internal value 255. (cff_parse_vsindex, cff_parse_blend): New functions. (CFF_FIELD_BLEND): New macro. (cff_parser_run): Updated. * src/cff/cffparse.h (cff_kind_blend): New enum value. * src/cff/cfftoken.h: Handle `vstore', `vsindex', and `blend' dictionary values. * src/cff/cfftypes.h (CFF_VarData, CFF_AxisCoords, CFF_VarRegion, CFF_VStore, CFF_Blend): New structures. (CFF_FontRecDict): Add `vstore_offset' field. (CFF_Private): Add `vsindex' field. (CFF_SubFont): Add fields for blend data. (CFF_Font): Add `vstore' field. * src/truetype/ttgxvar.c (TT_Get_MM_Var): `CFF2' is equal to `gvar', since glyph variation data is directly embedded. (TT_Set_MM_Blend): Don't load `gvar' table for CFF2 fonts.
Werner Lemberg 3bd79cc2 2016-12-15T14:34:57 [truetype] Provide HVAR advance width variation as a service. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Prevent double adjustment of advance width. * src/sfnt/ttmtx.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (tt_face_get_metrics): Apply metrics variations.
Dave Arnold aa0c4b4f 2016-12-15T14:04:51 [truetype] Provide function to apply `HVAR' advance width variation. * src/truetype/ttgxvar.c (tt_hadvance_adjust): New function. * src/truetype/ttgxvar.h: Updated.
Dave Arnold 097cd874 2016-12-15T12:58:26 [truetype] Add `HVAR' table parsing. Note that this is not complete yet; it only handles advance width variation. Activation of the code follows in another commit. * include/freetype/ftmm.h (FT_Var_Named_Style): Add `psid' member. * src/truetype/ttgxvar.h (GX_HVarData, GX_AxisCoords, GX_HVarRegion, GX_HVStore, GX_WidthMap): New auxiliary structures for... (GX_HVarTable): ... HVAR main structure. (GX_BlendRec): Add data for HVAR loading. * src/truetype/ttgxvar.c (FT_FIXED_ONE, FT_fdot14ToFixed, FT_intToFixed, FT_fixedToInt): New macros. (ft_var_load_hvar): New function. (TT_Get_MM_Var): Updated. (tt_done_blend): Deallocate HVAR data.
Werner Lemberg 0918325e 2016-12-14T20:44:11 [sfnt, truetype] Add framework for Metrics Variations service. No effect yet; service functions will be implemented later on. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * include/freetype/internal/services/svmetric.h: New file. * include/freetype/internal/ftserv.h (FT_SERVICE_METRICS_VARIATIONS_H): New macro. * include/freetype/internal/tttypes.h (TT_Face): New field `var'. * src/sfnt/sfobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (sfnt_init_face): Initialize `face->var'. * src/truetype/ttdriver.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (tt_service_metrics_variations): New service. (tt_services): Updated. * src/truetype/ttpic.h: Updated.
Werner Lemberg ab22b43b 2016-12-14T18:34:55 * src/truetype/ttgxvar.c (tt_get_var_blend): Fix compiler warning.
Werner Lemberg 8b174b4b 2016-12-11T09:16:52 [truetype, type1] Add `get_var_blend' to MM service. For internal use; we want to share code between the forthcoming CFF2 support and TrueType. * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): New typedef. (MultiMasters): Add `get_var_blend'. (FT_Service_MultiMasters): Updated. * src/truetype/ttgxvar.c (tt_get_var_blend): New function. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.
Werner Lemberg 27bdb36c 2016-12-10T09:56:03 [truetype, type1] Add `done_blend' to MM service. For internal use; we want to share code between the forthcoming CFF2 support and TrueType. * include/freetype/internal/services/svmm.h (FT_Done_Blend_Func): New typedef. (MultiMasters): Add `done_blend'. (FT_Service_MultiMasters): Updated. * src/truetype/ttgxvar.c (tt_done_blend): Use `TT_Face' as argument. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttobjs.c (TT_Face_Done): Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated.
Dave Arnold bcae6574 2016-12-05T22:08:15 Add `FT_Get_Var_Design_Coordinates' function. Note that the low-level functions aren't implemented yet. * include/freetype/ftmm.h: Declare. * include/freetype/internal/services/svmm.h (FT_Get_Var_Design_Func): New typedef. (MultiMasters): New MM service function `get_var_design'. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. Update all callers. * src/base/ftmm.c (FT_Get_Var_Design_Coordinates): Implement. * src/truetype/ttdriver.c: Updated. * src/truetype/ttgxvar.c (TT_Get_Var_Design): New dummy function to handle `get_var_design' service. * src/truetype/ttgxvar.h: Updated. * src/type1/t1driver.c: Updated. * src/type1/t1load.c (T1_Get_Var_Design): New dummp function to handle `get_var_design' service. * src/type1/t1load.h: Updated.
Behdad Esfahbod b72858c9 2016-11-03T06:41:00 [truetype] Clamp variation requests to valid range. This is required by OpenType 1.8; it also avoids rounding surprises. * src/truetype/ttgxvar.c (TT_Set_Var_Design): Clamp design coordinates outside of the allowed range to always stay within the range instead of producing an error.
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 ddf38726 2016-10-27T07:27:27 [truetype] Fix commit from 2014-11-24. Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>. * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking logic.
Werner Lemberg 9c45ac39 2016-10-26T16:00:00 Add `FT_Get_{MM,Var}_Blend_Coordinates' functions. * include/freetype/ftmm.h: Declare. * include/freetype/internal/services/svmm.h (FT_Get_MM_Blend_Func): New typedef. (MultiMasters): New MM service function `get_mm_blend'. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. Update all callers. * src/base/ftmm.c (FT_Get_MM_Blend_Coordinates, FT_Get_Var_Blend_Coordinates): Implement. * src/truetype/ttdriver.c: Updated. * src/truetype/ttgxvar.c (TT_Get_MM_Blend): New function to handle `get_mm_blend' service. * src/truetype/ttgxvar.h: Updated. * src/type1/t1driver.c: Updated. * src/type1/t1load.c (T1_Get_MM_Blend): New function to handle `get_mm_blend' service. * src/type1/t1load.h: Updated. * docs/CHANGES: Document.
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 7eeaf986 2016-10-14T08:58:17 [truetype] Fix handling of `cvar' table data. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53 * src/truetype/ttgxvar.c (tt_face_vary_cvt): Ignore invalid CVT indices.
Werner Lemberg 92281228 2016-10-11T07:12:12 * src/truetype/ttgxvar.c (tt_done_blend): Fix deallocation.
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 a3e2c832 2016-09-27T21:42:02 [truetype] Trace number of executed opcodes. * src/truetype/ttinterp.c (TT_RunIns): Implement it.
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 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 a764963f 2016-09-25T16:29:05 [truetype] Sanitize only last entry of `loca' table. Without this patch, a loca sequence like `0 100000 0 100000 ...', where value 100000 is larger than the `glyf' table size, makes FreeType handle the whole `glyf' table as a single glyph again and again, which is certainly invalid (and can be very slow, too). * src/truetype/ttpload.c (tt_face_get_location): Implement. Improve tracing messages.
Werner Lemberg c95b7652 2016-09-17T17:12:50 s/0/NULL/ for function pointers; comments, formatting.
Werner Lemberg e421a0bf 2016-09-10T08:02:30 [sfnt] Fix previous commit. Problems reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40 We now map the strike index right before accessing the physical data, not earlier. * src/sfnt/sfobjs.c (sfnt_load_face): Set `face->sbit_strike_map' after creating the map so that... * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): ... this function can be used before and after setting up `sbit_strike_map'. (tt_face_set_sbit_strike): Revert change. (tt_sbit_decoder_init, tt_face_load_sbix_image): Map strike index. * src/truetype/ttdriver.c (tt_size_select): Revert change.
Werner Lemberg d609b7c1 2016-09-09T22:11:07 [sfnt] Don't provide (completely) broken strike data. FreeType tries to sanitize strike header data; we now reject completely broken ones. * include/freetype/internal/tttypes.h (TT_FaceRec): New `sbit_strike_map' array pointer. * src/base/ftobjs.c (FT_Match_Size): Reject matches where either width or height would be zero. Add tracing message in case of error. * src/sfnt/sfobjs.c (sfnt_load_face): Populate `sbit_strike_map', only using (more or less) valid strike header data for FT_Face's `available_sizes' array. (sfnt_done_face): Updated. * src/sfnt/ttsbit.c (tt_face_set_sbit_strike): Use `sbit_strike_map'. (tt_face_load_strike_metrics): Improve tracing. * src/truetype/ttdriver.c (tt_size_select): Use `sbit_strike_map'.
Werner Lemberg b1e7b68e 2016-09-08T08:56:34 * src/truetype/ttinterp.c: Include `ttgxvar.h'. This fixes the `multi' build.
Werner Lemberg 4e659d7e 2016-09-03T18:14:00 [truetype] More fixes for handling of GX deltas. Problems reported by Bob Taylor <Bob.Taylor@monotype.com>. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix rough sanity test for glyph variation array header size. Always set stream position before reading packed x and y deltas. Fix thinko w.r.t. `localpoints' array.
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.
Werner Lemberg cf4224ad 2016-08-16T06:44:23 [truetype] Fix compiler warning. * src/truetype/ttgload.c (load_truetype_glyph): Add cast.
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.
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 053943a7 2016-07-30T00:27:48 [truetype] Comment.
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.
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 7f63105c 2016-07-19T21:35:58 [truetype] Sanitizer fix, second try. * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary tests and use only one slot more.
Werner Lemberg 9f6426eb 2016-07-19T07:23:17 Thinko; fix previous commit.
Werner Lemberg e69f34b1 2016-07-19T07:06:19 [truetype] Sanitizer fix. * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Increase array to fix nested loops.
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.
Behdad Esfahbod 69446ddc 2016-07-16T10:52:38 [truetype] Make all glyphs in `Zycon' GX font work. * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Fix boundary tests.
Werner Lemberg a3b61253 2016-07-16T08:16:16 [truetype] Fix GX delta tracing. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Trace relative point movements.
Werner Lemberg f147fb28 2016-07-16T07:06:21 [truetype] More fixes for GX. This finally fixes the rendering of the cyclist and the lizard in the `Zycon' font. * src/truetype/ttgxvar.c (ft_var_readpackedpoints): `first' point index is always cumulative. (tt_handle_deltas): Rename to... (tt_interpolate_deltas): ... This. Add new parameter for output point array. Update caller. (TT_Vary_Apply_Glyph_Deltas): Add `points_out' array; it now holds the intermediate results of `tt_interpolate_deltas' that are to be added to `outline->points'.
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 631e2181 2016-07-14T06:25:05 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix tracing.
Behdad Esfahbod 0f9ddf20 2016-07-14T06:08:39 [truetype] Fix gxvar delta interpolation. The coordinates of the base font should be used for interpolation purposes, NOT the current points (i.e., the result of accumulation of previous deltas). * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize `points_org' before looping over all tuples.
Werner Lemberg 605946af 2016-07-11T16:14:36 Conditionally compile environment support. * include/freetype/internal/ftobjs.h, src/autofit/afmodule.c, src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c: Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where necessary.
Werner Lemberg 8f8ae8c5 2016-07-11T15:11:38 Handle properties in `FREETYPE_PROPERTIES' environment variable. This commit covers the most important one. * src/autofit/afmodule.c (af_property_set): Handle `warping', `darkening-parameters', and `no-stem-darkening'. * src/cff/cffdrivr.c (cff_property_set): Handle `darkening-parameters', `hinting-engine', and `no-stem-darkening'. * src/truetype/ttdriver.c (tt_property_set): Handle `interpreter-version'.
Werner Lemberg c3beb30a 2016-07-10T07:11:45 Add function `ft_property_string_set'. This is a preparation for handling an `FREETYPE_PROPERTIES' environment variable to control (some) driver properties. No change in functionality. * src/base/ftobjs.c (ft_property_do): Add `value_is_string' parameter. (ft_property_string_set): New function. (FT_Property_Set, FT_Property_Get): Updated. * include/freetype/internal/ftobjs.h: Updated. * include/freetype/internal/services/svprop.h (FT_Properties_SetFunc): Add `value_is_string' parameter. * src/autofit/afmodule.c (af_property_set), src/cff/cffdrivr.c (cff_property_set), src/truetype/ttdriver.c (tt_property_set): Updated, emitting an error currently if `value_is_string' is set.
Werner Lemberg 474682ff 2016-07-06T08:54:35 * src/truetype/ttinterp.c (TInstruction_Function): Removed, unused.
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 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 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 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.
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.