src/truetype

Branch


Log

Author Commit Date CI Message
Alexei Podtelezhnikov f238830d 2025-10-16T22:35:53 * src/truetype/ttgload.c (tt_loader_init): Reset compatibility. This may fix #1262, credits to Honnesh Ramachandra. https://lists.nongnu.org/archive/html/freetype-devel/2025-10/msg00004.html
Alexei Podtelezhnikov 36f917cc 2025-09-08T11:03:24 * src/truetype/ttinterp.c (TT_Run_Context): Fix IUP tracking bits. Correctly fixes #1353 and #1349.
Alexei Podtelezhnikov 3ac49075 2025-09-08T10:45:16 Typo!
Alexei Podtelezhnikov 89eba38e 2025-09-08T10:43:35 * src/truetype/ttinterp.c (TT_Run_Context): Reset IUP tracking bits. Fixes #1353.
Werner Lemberg 32cb5390 2025-09-06T06:14:03 Update all copyright notices.
Alexei Podtelezhnikov c0851258 2025-08-25T12:35:50 * src/truetype/ttinterp.c: Fix some builds.
Werner Lemberg 23fa1e35 2025-08-21T07:09:15 Updating `CHANGES` file; minor fixes elsewhere (mostly formatting).
Alexei Podtelezhnikov ca0247af 2025-08-19T23:39:02 [truetype] Fix compilation without bytecode. Fixes #1351 and various warnings about unused variables. * src/truetype/ttinterp.c: Put the entire body under #ifdef. * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Relocate some declarations. * src/truetype/ttinterp.h: Remove some #ifdef conditions. * src/truetype/ttobjs.c (tt_size_done): Modified.
Alexei Podtelezhnikov cff66748 2025-08-14T12:39:57 [truetype] Small fix in the incremental interface (again). Fixes #1299, last [-Wdangling-pointer=] warning. * src/truetype/ttgload.c (load_truetype_glyph): Restore original stream on exit unconditionally.
Alexei Podtelezhnikov 6bd5a8cc 2025-08-14T12:23:03 [truetype] Small fix in the incremental interface. Fixes #1299, last [-Wdangling-pointer=] warning. * src/truetype/ttgload.c (load_truetype_glyph): Restore original stream on exit.
Behdad Esfahbod 670d0b21 2025-08-08T01:34:30 [ttgxvar] Fix caching of scalars when there are intermediate tuples. For example, with `GoogleSansFlex-Regular.ttf` at ROND=100, the 'Q' glyph was misrendering. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reset `tupleScalars` earlier.
Alexei Podtelezhnikov 08805be5 2025-08-01T11:01:16 [truetype/v40] Fix ROUND_XY_TO_GRID handling. Fixes #1346. * src/truetype/ttgload.c (TT_Process_Composite_Component): Round the x-position unless in backward_compatibility mode.
Alexei Podtelezhnikov 6c18a397 2025-07-30T09:45:53 * src/truetype/ttinterp.c (Ins_MDRP,MIRP): Small tweak.
Alexei Podtelezhnikov 64a0c64a 2025-07-29T22:21:42 [truetype] Tweak size management. * include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func): Update typedef, do not return error. * src/truetype/ttobjs.c (tt_size_reset_height): Move the PPem error handling from here... (tt_size_reset): ... to here to improve readability. src/truetype/ttobjs.h (tt_size_reset_height): Update prototype.
Alexei Podtelezhnikov 8ceba9bb 2025-07-29T19:06:27 [truetype] Relocate color compensation (cont'd). * src/truetype/ttinterp.c (Inc_MDAR,MIAP,MDRP,MIRP): Fix forgotten rounding.
Alexei Podtelezhnikov 47d80cf2 2025-07-29T07:12:24 [truetype] Fix EVEN and ODD instructions. It is possible to have a fractional part after rounding when rounding to half-grid or super-rounding. The specs call to ignore the fractional part in that case. ^ src/truetype/ttinterp.c (Ins_EVEN, Ins_ODD): Fix mask.
Alexei Podtelezhnikov ac662dcd 2025-07-27T19:24:36 * src/truetype/ttinterp.c: Fix comments.
Alexei Podtelezhnikov 63e2c058 2025-07-27T18:33:14 * src/truetype/ttinterp.h (TT_Round_Func): Fix argument. Fixes #1347: function type mismatch.
Alexei Podtelezhnikov 62ca1fd2 2025-07-27T09:40:39 [truetype] Clean up size validation. Rely on non-zero ppem to validate the size object. * src/truetype/ttobjs.h (TT_Size_Merics): Remove the `valid` flag. * src/truetype/ttobjs.c (tt_size_init,done,reset,reset_height): Updated. * src/truetype/ttgload.c (TT_Load_Glyph): Check for non-zero ppem.
Alexei Podtelezhnikov 9e9d539f 2025-07-27T09:28:17 [truetype] Relocate color compensation. The rounding color compensation, which is not used by FreeType, belongs to GS. This is a more logical place for it, next to round_state. * src/truetype/ttobjs.h (TT_GraphicsState): Move compensations here... (TT_Size_Metrics): ... from here. * src/truetype/ttobjs.c (tt_size_init_bytecode): Updated. * src/truetype/ttinterp.c (tt_default_graphics_state): Updated. (Ins_ROUND,NROUND,EVEN,ODD): Updated. (Round_*): Updated.
Werner Lemberg b04db387 2025-07-04T19:52:53 [sfnt] Rewrite GPOS kerning support. (2/2) The previous code had a fundamental flaw: it didn't validate the necessary parts of the 'GPOS' table before accessing it, causing crashes with malformed data (since `TT_CONFIG_OPTION_GPOS_KERNING` is off by default, standard fuzzers don't catch these problems). Additionally, it did a lot of parsing while accessing kerning data, making it rather slow. The new implementation fixes this. After validation, offsets to the 'GPOS' lookup subtables used in the 'kern' feature that correspond to 'simple' kerning (i.e., similar to 'kern' table kerning) are stored in `TT_Face`; this greatly simplifies and accelerates access to the kerning data. Testing with font `SF-Pro.ttf` version '1.00', the validation time for the 'GPOS' table increases the start-up time of `FT_New_Face` by less than 1%, while calls to `FT_Get_Kerning` become about 3.5 times faster. * include/freetype/internal (gpos_kerning_available): Replace with... (gpos_lookups_kerning, num_gpos_lookups_kerning): ... these new fields. Update callers. * src/ttgpos.c [TT_CONFIG_OPTION_GPOS_KERNING]: A new implementation.
Werner Lemberg fb6a7426 2025-07-04T06:03:37 * src/sfnt/ttkern.h (TT_FACE_HAS_KERNING): Remove macro. Given that we also support (limited) 'GPOS' table kerning if `TT_CONFIG_OPTION_GPOS_KERNING` is defined, the name of this macro is misleading since it only is true for 'kern' table kerning. * src/sfnt/sfobjs.c (sfn_load_face): Replace `TT_FACE_HAS_KERNING` with plain code.
Werner Lemberg f1cd6dbf 2025-07-01T21:32:47 * src/truetype/ttobjs.c (tt_size_init_bytecode): Correct previous fix. `FT_NEW_ARRAY` expects a signed value, not an unsigned one.
Werner Lemberg 01695ea7 2025-07-01T18:06:17 Various minor fixes. As reported by clang 19. * src/autofit/afadjust.c (adjustment_database): Make it static. * src/base/ftdbgmem.c (FT_MEM_SIZE_MIN): Remove unused macro. * src/psaux/psobjs.c (skip_procedure), src/truetype/ttinterp.c (Ins_IF, Ins_ELSE, Ins_FDEF, Ins_IDEF): Add `default` clause.
Werner Lemberg f1be7392 2025-07-01T18:00:12 More signedness fixes. As reported by clang 19. * src/autofit/afadjust.c (add_substitute): Make first argument unsigned. Update all callers. Other minor signedness fixes. (af_reverse_character_map_new): Minor signedness fixes. * src/autofit/afgsub.c (af_hash_insert): Minor signedness fixes. * src/autofit/aflatin.c (af_glyph_hints_apply_vertical_separation_adjustments): Make third argument unsigned. Update all callers. Other minor signedness fixes. (af_latin_hints_apply): Minor signedness fixes. * src/bdf/bdflib.c (bdf_parse_bitmap_): Minor signedness fix. * src/truetype/ttobjs.c (tt_size_init_bytecode): Minor signedness fix.
Werner Lemberg 8d82c9fa 2025-07-01T17:08:37 */*: Fix trivial signedness issues with format strings in trace messages. As reported with clang 19's `-Wformat` option.
Werner Lemberg d7e640b9 2025-06-29T07:45:09 [doc] Revise font variation API.
Werner Lemberg 58be4879 2025-06-24T13:31:10 [truetype] Add comment to explain heuristic limit for twilight points.
Alexei Podtelezhnikov 43940e4c 2025-06-23T11:04:43 [truetype] Restore non-persistent CVT and storage. According to specifications, CVT and storage area may or may not be persistent after modifications by a glyf program. FreeType had always reset them, which was broken by the last commit. * src/truetype/ttinterp.c (TT_Load_Context): Set CVT and storage here. * src/truetype.ttobjs.c (tt_size_run_prep): Prioritize TT_Load_Context. (tt_size_init_bytecode): Allocate but not set CVT and storage area.
Alexei Podtelezhnikov 36ddd0cb 2025-06-22T12:13:48 [truetype] Deduplicate 'codeRangeTable'. * src/truetype/ttinterp.c (TT_Load_Context, TT_Save_Context): Do not copy 'codeRangeTable'. * src/truetype/ttobjs.h (TT_Size): Remove 'codeRangeTable'. (TT_CodeRange_Tag, TT_CodeRange, TT_DefArray): Moved to... * src/truetype/ttinterp.h: ... this header.1
Alexei Podtelezhnikov c9cbfacb 2025-06-21T23:30:24 [truetype] Simplify bytecode allocations. To avoid repeated synchronization, some TT_Size allocations are moved TT_ExecContext for good. The memory blocks are also consolidated. * src/truetype/ttinterp.c (TT_{Load,Save,Done}_Context): Remove synchronization and stack management. * src/truetype/ttobjs.c (tt_size_{init,done}_bytecode): Manage allocations and assign them to the execution context. (tt_size_run_prep): Updated.
Alexei Podtelezhnikov 4c2437ef 2025-06-21T22:59:29 [truetype] Rework handling of rendering mode in bytecode. This replaces a large number of confusing boolean constructs that describe the target rendering mode in the execution context with the straight mode variable. It might fix some hidden bugs when FT_LOAD_TARGET_XXX were used as flags, which they are not. The condition that triggers the CV program re-execution is simplified. These events due the rendering mode change are rather rare and unexpected and, therefore, should not be over-analyzed. In v40, all mode changes now trigger the CV program. In v35, only switches to/from mono do. * src/truetype/ttinterp.h (TT_ExecContext): Replace 'grayscale', 'grayscale_cleartype', 'subpixel_hinting_lean', and 'vertical_lcd_lean' with the rendering 'mode'. * src/truetype/ttinterp.c (Ins_GETINFO): Updated. * src/truetype/ttgload.c (tt_loader_init): Replace 'prep' re-execution trigger and update 'backward_compatibility' condition. (tt_loader_set_pp): Updated.
Alexei Podtelezhnikov 0e38fa75 2025-06-20T22:22:05 * src/truetype/{ttinterp.c,ttobjs.c}: Minor.
Alexei Podtelezhnikov 19770604 2025-06-20T21:48:14 [truetype] Clean up bytecode execution triggers. This avoids executing the CV program twice and cleans up the use of 'fpgm' and 'prep' triggers * src/truetype/ttgload.c (tt_loader_init): Call 'tt_size_init_bytecode' and 'tt_size_run_prep' explicitly and avoid the call repetition. * src/truetype/ttobjs.c (tt_size_ready_bytecode): Removed as unused. (tt_size_init, tt_size_init_bytecode, tt_size_done_bytecode): Remove some 'fpgm' and 'prep' triggers and update. (tt_size_run_fpgm, tt_size_run_prep): Do not set the pedantic flag here. * src/truetype/ttobjs.h: Update signatures.
Alexei Podtelezhnikov b647de09 2025-06-20T20:34:10 * src/truetype/ttgload.c (tt_loader_init, load_sbit_image): Clean up.
Alexei Podtelezhnikov 2041c65c 2025-06-20T20:20:54 [truetype] Simplify twilight zone management. * include/freetype/internal/tttypes.h (TT_GlyphZone): Remove 'memory'. * src/truetype/ttobjs.c (tt_glyphzone_done): Use 'memory' as argument. (tt_glyphzone_new, tt_glyphzone_done): Allocate/free as a single block. (tt_size_init_bytecode, tt_size_done_bytecode): Updated. * src/truetype/ttobjs.h (tt_glyphzone_done): Updated signature.
Alexei Podtelezhnikov 738905b3 2025-06-14T20:18:48 [truetype] Revise twilight zone initiation. This assures that twilight zone is reset before each CV program execution, including after the rendering mode switch. Fixes #1344. * src/truetype/ttobjs.c (tt_size_ready_bytecode): Relocate the GS the twilight zone initiation from here... (tt_size_run_prep): ... to this function, sho that it is always done prior to the CV program execution. * src/truetype/ttobjs.c (TT_Run_Context): Set twilight zone here... (TT_Load_Context): ... rather than here, as it used to be.
Alexei Podtelezhnikov 3c14c525 2025-06-11T15:32:11 [truetype] Clean up TT_GlyphZone. * include/freetype/internal/tttypes.h (TT_GlyphZone): Delete fields. * src/truetype/ttobjs.c (tt_glyphzone_new, tt_glyphzone_done, tt_size_init_bytecode): Updated.
Alexei Podtelezhnikov 1529bc6e 2025-06-11T07:41:01 [truetype] Use FT_ARRAY_ZERO. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Updated. * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids, tt_size_ready_bytecode): Updated.
Alexei Podtelezhnikov 5ab9e5c5 2025-06-08T07:51:08 [truetype] Rearrange bytecode run. This is a minor change with large code rearrangements. * src/truetype/ttinterp.c (TT_RunIns): Just loop through instructions and move all setup to... (TT_Run_Context): ... here; relocated. (Compute_Round): Replaced by simple assignment, removed.
Alexei Podtelezhnikov 68c62e19 2025-06-07T22:15:18 [truetype] Relocate the interpreter pointer. This reduces dereferencing when calling the interpreter. * include/freetype/internal/tttypes.h (TT_Face): Move it from here... * src/truetype/ttinterp.h (TT_ExecContext): ... to here. * src/truetype/ttobjs.c (tt_size_init_bytecode): Move its initialization * src/truetype/ttinterp.c (TT_New_Context): ... to here. (TT_Run_Context): Updated.
Alexei Podtelezhnikov ecfefd8c 2025-06-07T22:12:45 [truetype] Clean up the loader initiation. * include/freetype/internal/tttypes.h (TT_LoaderRec): Remove unused field. * src/truetype/ttgload.c (tt_loader_init): Refactor.
Alexei Podtelezhnikov 5631650b 2025-06-07T22:09:28 [truetype] Modify bytecode initiation. This reduces the number of function calls and data copying events. * src/truetype/ttinterp.c (TT_Goto_CodeRange): Merge into... (TT_Set_CodeRange): ... this function. (TT_Load_Context): Do not set up any zones, copy GS, or prepare the execution... (TT_Run_Context): ... do this here instead.. * src/truetype/ttinterp.c (TT_Set_CodeRange): Update signature. * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Call TT_Run_Context. * src/truetype/ttgload.c (TT_Hint_Glyph, tt_loader_init): Updated.
Alexei Podtelezhnikov 70281e0f 2025-06-07T21:59:50 [truetype] Modify the graphics state management. Instead of restoring persistent GS variables, we only save modifications permitted by the CVT program. This reduces the context manipulations. * src/truetype/ttobjs.h (TT_GraphicsState): Reorder fields. * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do not alter the context. * src/truetype/ttgload.c (TT_Hint_Glyph): Do not reset GS. (tt_loader_init): Fix potential issue in 'instruct_control' handling. * src/truetype/ttinterp.c (TT_Run_Context): Fully reset GS. (TT_Load_Conext): Rearrange and remove the 'size' check, already performed in FT_Load_Glyph. (TT_Save_Context): Save only modifiable GS parts. (tt_default_graphics_state): Updated. * src/truetype/ttinterp.h (TT_Run_Context): Update signature.
Werner Lemberg a67b2bab 2025-06-10T12:11:41 [gxvar] Really fix setting of named-instance to Regular. This fixes an ommission in commit cf06661c51. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Initialize `error`.
Behdad Esfahbod cf06661c 2025-05-31T15:57:41 Fix setting of named-instance to Regular Fixes https://gitlab.freedesktop.org/freetype/freetype/-/issues/1341 And more elaborate avoidance of loading face->blend if all coords are zero.
Behdad Esfahbod f7fba637 2025-05-24T02:47:23 [gxvar] Optimize out more bounds checking. Big win, ~20% in measured mega-var font, HarfBuzz's `benchmark-font` 'glyph_h_advances' benchmark. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Implement it in loops.
Behdad Esfahbod c0625140 2025-05-22T22:21:18 * src/truetype/ttgload.c (load_truetype_glyph): Use `IS_DEFAULT_INSTANCE`.
Behdad Esfahbod f64c7db2 2025-05-27T06:59:16 [gxvar] Set `doblend` to `FALSE` if at default location. * src/truetype/ttgxvar.c (tt_set_mm_blend, TT_Get_Var_Design): Do it.
Behdad Esfahbod fa412cf5 2025-05-23T15:41:26 [mm/gxvar] Always detect default instance and use optimized codepath. Even if it was explicitly set by either design or normalized APIs. Also update documentation. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): Use value -2 of `error` to indicate that we have a non-default instance. (TT_Set_Named_Instance): Updated. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_Var_Blend_Coordinates): Updated.
Alexei Podtelezhnikov deef6d2a 2025-05-26T23:16:30 Typo.
Alexei Podtelezhnikov 31d05d08 2025-05-26T23:13:52 * src/truetype/ttinterp.c (TT_Load_Context): Clean up.
Behdad Esfahbod 86ab14e0 2025-05-26T08:20:21 [gxvar] Speed up handling of deltas in `ItemVariationStore`. (2/3) Do all math in fixed integer and do a single divide at the end. Also don't use an array to read deltas; just read them as we go, and skip (branch-free) when scalar is 0. 30% speedup in measured mega-var font, HarfBuzz's `benchmark-font` 'glyph_h_advances' benchmark.
Behdad Esfahbod fe6854ba 2025-05-26T08:18:00 [gxvar] Speed up handling of deltas in `ItemVariationStore`. (1/3) * src/truetype/ttgxvar.c (ft_mul_add_delta_scalar, ft_round_and_shift16): New functions, reusing code from `ftcalc.c`.
Behdad Esfahbod b8444f2f 2025-05-26T07:47:10 [gxvar] Move scalar computation into its own function. * src/truetype/ttgxvar.c (tt_var_get_item_delta): Split off affected code into... (tt_calculate_scalar): ...this new function.
Alexei Podtelezhnikov 87501e2e 2025-05-25T22:21:21 [trueetype] Remove useless assignments. * src/truetype/ttobjs.c (tt_size_run_fpgm): Remove assignment that is ignored and overridden later in 'Compute_Funcs'. * src/truetype/ttinterp.c (TT_RunIns): Ditto. (Ins_MIAP): Formatting.
Behdad Esfahbod 75b84313 2025-05-23T08:03:59 [gxvar] Optimize loading of 'gvar' table. * src/truetype/ttgxvar.c (tt_var_load_item_variation_store, tt_var_load_delta_set_index_mapping, ft_var_load_gvar): Use frames to reduce bounds checking. (TT_Vary_Apply_Glyph_Deltas): Better macro usage.
Behdad Esfahbod 702e4a1d 2025-05-21T14:55:25 * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Fix allocation. Bug was introduced in commit 582de1a4b6f.
Werner Lemberg 013adc82 2025-05-21T17:28:52 * src/truetype/ttgxvar.c (ft_var_apply_tuple): Remove redundant test. This was erroneously added in commit e6e9110a8.
Behdad Esfahbod (بهداد اسفهبد) d7b6e947 2025-05-21T01:34:08 [gxvar] Cache shared-tuple scalar values. GoogleSansFlex HB benchmark-font draw results: Before: 2.13ms After: 1.65ms Speedup: 22% * src/truetype/ttgxvar.h (GX_BlendRec): Add `tuplescalars` field. * src/truetype/ttgxvar.c (ft_var_load_gvar): Allocate `tuplescalars` array. (tt_set_mm_blend): Set its values. (TT_Vary_Apply_Glyph_Deltas): Use it. (tt_done_blend): Deallocate it.
Behdad Esfahbod (بهداد اسفهبد) 582de1a4 2025-05-20T23:09:16 [gxvar] Reduce number of mallocs. 8% speed up in drawing GoogleSansFlex variable in HB benchmark-font. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Use an allocation pool instead of individual allocations.
Behdad Esfahbod (بهداد اسفهبد) fd92af79 2025-05-20T16:55:38 [gxvar] Another optimization in computing scalar. Another ~6% speedup in GoogleSansFlex var drawing. * src/truetype/ttgxvar.c (ft_var_apply_tuple): Test `ncv` for being zero.
Behdad Esfahbod (بهداد اسفهبد) e7cc14ba 2025-05-21T01:33:22 [gxvar] Remove stale comment. The code *does* check against start/end!
Behdad Esfahbod (بهداد اسفهبد) e6e9110a 2025-05-20T16:51:25 * src/truetype/ttgxvar.c (ft_var_apply_tuple): Micro-optimize.
Behdad Esfahbod (بهداد اسفهبد) 14399c73 2025-05-20T16:17:00 [gxvar] Inline two USHORT reads. Speeds up GoogleSansFlex variable glyph drawing by ~13%. Before: 2.95ms After: 2.57ms * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Do it.
Behdad Esfahbod (بهداد اسفهبد) 0a574d50 2025-05-20T15:56:05 [gxvar] Micro-optimize loop end condition. * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Do it.
Behdad Esfahbod dc8efeff 2025-05-20T19:33:34 [truetype] Don't process `mvar` metrics if default instance. GoogleSansFlex default-instance HarfBuzz benchmark-font draw: Before: 0.610ms After: 0.435ms Speedup: 28% * src/truetype/ttobjs.c (tt_face_init) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Check `instance_index`.
Alexei Podtelezhnikov 22511643 2025-05-20T22:18:19 * src/truetype/ttinterp.c (Ins_MIRP,DELTAP,DELTAC): Minor.
Alexei Podtelezhnikov 8b4dcd93 2025-05-20T17:27:43 [truetype] Update bytecode error handling. * src/truetype/ttinterp.c (Ins_SHP,SHPIX,ALIGNRP): Return appropriate error in case of stack underflow. (Ins_IP): Ditto and remove redundant check.
Alexei Podtelezhnikov 89e3e98e 2025-05-16T13:19:26 * src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN.
Alexei Podtelezhnikov 8082aba5 2025-05-15T22:27:52 * src/truetype/ttinterp.c (Ins_DELTAP): Flip if-else.
Alexei Podtelezhnikov 7172bd11 2025-05-14T23:17:23 [truetype] Optimize DELTAP and DELTAC. * src/truetype/ttinterp.c (Ins_DELTAP,DELTAC): Perform PPEM range- checking and manipulations outside the loop.
Alexei Podtelezhnikov 8a152c82 2025-05-14T14:56:21 * src/truetype/ttinterp.c (Compute_Funcs): Replace shifts.
Alexei Podtelezhnikov 82891652 2025-05-14T12:45:53 [truetype] Tighten code overflow checks. Fixes #1336. * src/truetype/ttinterp.c (Ins_NPUSHB,NPUSHW,PUSHB, PUSHW): Tighten conditions.
Alexei Podtelezhnikov 408957dc 2025-05-13T17:07:31 [truetype] Finalize bytecode changes. * src/truetype/ttinterp.c: Formatting, minor. (TT_Goto_CodeRange): Initialize 'iniRange' here... (TT_RunIns): ... instead of here. * docs/CHANGES: Updated.
Alexei Podtelezhnikov 2f2dfad5 2025-05-13T09:15:06 [truetype] Streamline backward compatibility. The 'backward_compatibility' is only set in v40: no need to check the interpreter version again and again. In addition, we now track IUP in its lower bits. After both IUPx and IUPy have been called, 'backward_compatibility' becomes equal to 0x7. * src/truetype/ttinterp.h (TT_ExecContextRec): Wrap 'iup?_called' into 'backward_compatibility'. * src/truetype/ttinterp.c (Ins_INSTCTRL): Sync 'backward_compatibility'. (Direct_Move, Direct_Move_X/Y, Move_Zp2_Point, Ins_FLIPPT,FLIPRGON,FLIPRGOFF,SHPIX,DELTAP): Updated. (TT_RunIns): Do not mess with IUP flags. * src/truetype/ttgload.c (tt_loader_init): Set 'backward_compatibility'. (TT_Hint_Glyph): Updated.
Alexei Podtelezhnikov 4792cff5 2025-05-08T20:41:00 [truetype] Optimize bytecode movements. Replacing FT_MulDiv with FT_MulFix gives large performance gains. * src/truetype/ttinterp.h (TT_ExecContextRec): Store "projected" freedom vector. * src/truetype/ttinterp.c (Compute_Funcs): Compute "projected" freedom vector. (Direct_Move, Direct_Move_Orig, Compute_Point_displacement): Use it.
Alexei Podtelezhnikov 55e60b9f 2025-05-08T20:39:29 [truetype] Simplify stack access. * src/truetype/ttinterp.c (Ins_MINDEX,CINDEX): Use local stack pointers. (Ins_DELTAP,DELTAC): Ditto; limit the number of pairs before looping.
Alexei Podtelezhnikov c71b9dad 2025-05-07T22:41:25 [truetype] Tweak bytecode looping. * src/truetype/ttinterp.c (Ins_FLIPPT,SHP,SHPIX,IP,ALIGNRP): Handle counters and stack locally. (TT_RunIns): Updated.
Alexei Podtelezhnikov 8c04ecd8 2025-05-02T21:10:08 [truetype] Tweak bytecode initiation. * src/truetype/ttinterp.c (TT_Load_Context): Init stack tops. * src/truetype/ttinterp.h (TT_ExecContextRec): Document it and clean. * src/truetype/ttobjs.c (tt_size_run_prep,fpgm): Updated. * src/truetype/ttgload.c (tt_loader_init): Minor.
Alexei Podtelezhnikov c3a55135 2025-05-02T20:15:50 [truetype] Modify stack handling. * src/truetype/ttinterp.c (Ins_GETVARIATION): Increment stack. (Ins_NPUSHB,NPUSHW,PUSHB,PUSHW): Handle the code stack here, ... (TT_RunIns): ... instead of here. Consolidate error handling. (SkipCode): Remove preemptive check.
Alexei Podtelezhnikov b0febf5d 2025-05-02T19:45:14 [truetype] Modify bytecode steps. * src/truetype/ttinterp.h (TT_Exec_ContextRec): Remove 'step_ins'. * src/truetype/ttinterp.c (TT_RunIns, Ins_Goto_CodeRange, Ins_JMPR,ENDF,PUSHW,NPUSHW): Set and use zero increment 'length' instead. (Ins_CALL,LOOPCALL,UNKNOWN): Updated.
Alexei Podtelezhnikov 35513a4d 2025-05-07T18:53:21 * src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN.
Alexei Podtelezhnikov 66e0d25e 2025-04-17T15:37:27 * src/truetype/ttinterp.c (TT_MulFix14,TT_DotFix14)[!FT_INT64]: Sync.
Alexei Podtelezhnikov 9eecaa07 2025-04-17T12:44:37 * src/truetype/ttinterp.c (TT_DotFix14): Silence UBSAN.
Alexei Podtelezhnikov ccabe7ac 2025-04-15T18:49:36 [base, truetype] Silence UBSAN (cont'd). * src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14): Use MUL_INT64. * include/freetype/internal/ftcalc.c (FT_MulFix): Ditto.
Alexei Podtelezhnikov 58b3598c 2025-04-12T09:18:16 Typos in macros. * include/freetype/internal/ftcalc.h: s/_M_X86/_M_IX86/. * src/truetype/ttinterp.c: s/_M_X86/_M_IX86/.
Alexei Podtelezhnikov c88bf8a2 2025-04-11T22:58:26 [base, truetype] Silence UBSAN. * src/truetype/ttinterp.c (TT_MulFix14_64): Use unsigned multiplication. * include/freetype/internal/ftcalc.h (FT_MulFix_64): Ditto.
Alexei Podtelezhnikov fb99fd63 2025-04-11T22:57:27 [base, truetype] Synchronize MulFix assembly. * include/freetype/internal/ftcalc.h (FT_MulFix_*), src/truetype/ttinterp.c (TT_MulFix14_*): Synchronize routines.
Alexei Podtelezhnikov 91753736 2025-04-10T19:58:48 [truetype] Modernize bytecode projections. With 64-bit platforms widely available, it is more efficient to use 64-bit variables readily. It results in noticeable 10% improvement in glyph loading speed. * src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14) [FT_INT64]: Prioritize available implementation with arguments adjusted based on the use cases.
Chad Brokaw a059b237 2025-01-19T22:39:17 * src/truetype/ttgxvar.c (tt_face_vary_cvt): Fix all shared values. Applying cvar deltas to all shared points was incorrectly omitted. Fixes #1314.
Alexei Podtelezhnikov 81330e1f 2025-01-03T22:54:20 * src/truetype/ttgload.c (TT_Load_Glyph): Consolidate flag setting.
Alexei Podtelezhnikov 5245fd69 2025-01-03T21:26:10 Delay FT_GLYPH_FORMAT_OUTLINE assignmets. This assignmets used to be done prematurely before errors were checked and outlines were actually loaded. Delaying the assignment provides certain protection against careless usage of malformed input that should now remain FT_GLYPH_FORMAT_NONE. * src/cff/cffgload.c (cff_slot_load): Ditto. * src/cid/cidgload.c (cid_slot_load_glyph): Ditto. * src/pfr/pfrobjs.c (pfr_slot_load): Ditto. * src/truetype/ttgload.c (TT_Load_Glyph): Ditto. * src/type1/t1gload.c (T1_Load_Glyph): Ditto.
Alexei Podtelezhnikov 64f8b7fb 2025-01-02T18:22:24 Remove superfluous outline zeroing. This is already done by `ft_glyphslot_clear`. * src/cff/cffgload.c (cff_slot_load): Do not zero outline fields. * src/cid/cidgload.c (cid_slot_load_glyph: Ditto. * src/pfr/pfrobjs.c (pfr_slot_load): Ditto. * src/truetype/ttgload.c (load_sbit_image): Ditto. * src/type1/t1gload.c (T1_Load_Glyph): Ditto.
Alexei Podtelezhnikov 10b3b14d 2025-01-01T23:04:14 * src/truetype/ttobjs.c: Abbreviate tracing.
Alexei Podtelezhnikov abed051e 2025-01-01T14:40:58 [truetype] Consolidate bitmap strike handling. * src/truetype/ttgload.c (TT_Load_Glyph): Relocate omitted whitespace strike handling from here... (load_sbit_image): ... to here.
Alexei Podtelezhnikov 4ef8eed1 2024-12-31T16:25:50 [truetype] Ingnore FT_LOAD_NO_BITMAP in bitmap-only fonts. For consistency with other bitmap-only fonts, we should ignore this flag of the font is not scalable. * src/truetype/ttgload.c (TT_Load_Glyph): Check if face is scalable when checking for FT_LOAD_NO_BITMAP. * docs/CHANGES: Start new chapter wtith this change.
Alexei Podtelezhnikov f02bffad 2024-10-14T11:47:31 * src/truetype/ttgload.c (load_truetype_glyph): Rearrange.
Werner Lemberg ed8b82ba 2024-08-08T10:28:05 Various minor documentation or formatting fixes.
Alexei Podtelezhnikov 1f72a120 2024-08-05T13:05:51 * src/truetype/ttgxvar.c (ft_var_readpacked*): Minor.