src


Log

Author Commit Date CI Message
Alexei Podtelezhnikov 793c0126 2021-10-27T22:36:11 [woff] Optimize table tagging. * include/freetype/internal/wofftypes.h (WOFF_TableRec): Use 32-bit tag. * src/sfnt/sfwoff.c (woff_open_font): Use 32-bit tag.
Alexei Podtelezhnikov a577bbcb 2021-10-27T22:24:27 [woff2] Optimize table tagging. Fixes #1107. * include/freetype/internal/wofftypes.h (WOFF2_TableRec): Use 32-bit tag. * src/sfnt/sfwoff2.c (compare_tags, find_table, woff2_open_font): Use 32-bit tag. * src/sfnt/woff2tags.[ch] (woff2_known_tags): Use static storage and return 32-bit tag.
Werner Lemberg 80b13f57 2021-10-26T10:57:17 Formatting.
Ben Wagner 535c67dd 2021-10-25T22:38:05 [mm] Tolerate missing Blend dictionary entries In a Multiple Master font, the Blend dictionary must contain valid Private, FontInfo, and FontBBox. The current code will error if any of these are present and invalid, but will not error and will provide uninitialized data if the Blend dictionary exists but does not contain one of these entries. This change reverts to the older behavior of treating any missing entries as containing all zero data and not returning an error. In the future it may be best to keep track of when these are actually initialized and error if they are not. * src/type1/t1load.c (t1_allocate_blend): Zero initiailize.
Ben Wagner 65be4b21 2021-10-21T09:55:28 [mm] Delay setting blend weight and design position. Previously the `blend->weight_vector`, `blend->default_weight_vector`, and `blend->design_pos` were set early to allocated but uninitialized memory under the assumption that the memory would eventually be initialized. However, it is possible that some of the required keywords may not actually be present, leaving the memory uninitialized. This is different from a present but invalid table, which would produce an error. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=1261762 * src/type1/t1load.c (t1_allocate_blend): Remove early allocation and initialization. (parse_blend_design_positions, parse_weight_vector): Parse into local and assign to blend if valid. (T1_Open_Face): Check that if a blend exists that it has the weight vector and design positions.
Ben Wagner b5e003f1 2021-10-21T09:48:38 [cff] Commit vstore data and regions on allocation. The vstore->regionCount and vstore->dataCount were read directly from the data. However, vstore->varRegionList and vstore->varData would still contain uninitialized entries with uninitialized pointers in the event of an error, leading to issues when attempting to clean up. Reportd as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40104 * src/cff/cffload.c (cff_vstore_load): Read the region and data counts into locals and update the vstore counts immediately after each entry becomes free-able.
Ben Wagner fde91ab8 2021-10-20T11:45:15 [sfnt] Delay setting gasp ranges and count until computed. Previously, the gasp.numRanges was set and gasp.gaspRanges was allocated and assigned before a possible early exit if the frame could not be entered. It is also possible that the gaspRanges allocation could fail but the numRanges still be set to non-zero. In such cases an error would be returned, but the face would have a gasp in an inconsistent state which may still be accessed. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=1261450 * src/sfnt/ttload.c (tt_face_load_gasp): Delay setting gasp.numRanges and gasp.gaspRanges until after the ranges are initialized.
Ben Wagner 6d12e3a0 2021-10-20T11:38:16 [sfnt] Delay setting names and langTags until computed. Previously, the table->names and table->langTags fields were created pointing to uninitialized memory and an early exit could happen if the frame could not be entered. The caller would then be unable to properly dispose of the memory as the string fields had not been initialized. Reported as https://bugs.chromium.org/p/chromium/issues/detail?id=1261343 * src/sfnt/ttload.c (tt_face_load_name): delay setting table->langTags and table->names until after the memory they will point to is fully initialized.
Werner Lemberg 8ef8072b 2021-10-19T22:59:46 [bdf, cid, pfr, winfonts] Improve rejection of other font formats. This is mainly for better diagnostics of malformed fonts. * src/bdf/bdflib.c (_bfd_readstream): Stop font format testing if the first input line is too long or doesn't end with `\r` or `\n`. * src/cid/cidparse.c (cid_parser_new): Don't handle too short input as an error but as an unknown format. * src/pfr/pfrobjs.c (pfr_face_init): Ditto. * src/winfonts/winfnt.c (fnt_font_load, fnt_face_get_dll_font): Ditto.
Alexei Podtelezhnikov 38b349c4 2021-10-18T20:35:28 [pcf] Zero out the allocated properties. Fallout reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40033 * src/pcf/pcfread.c (pcf_get_properties): Use FT_NEW_ARRAY and zero out `properties` in case of failure.
Alexei Podtelezhnikov 986d503f 2021-10-17T09:14:27 * src/sfnt/ttload.c (tt_face_load_name): NULL-initialize langTag. Another attempt to fix fallout reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40024
Alexei Podtelezhnikov 30ca63d4 2021-10-16T23:02:47 [bdf] Fix up user properties. Fallout reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40027 * src/bdf/bdflib.c (_bdf_add_property): Cosmetic NULL. (bdf_create_property): Limit allocations to customary signed FT_Long and NULL-initialize unused storage. (bdf_free_font): Do not free unused storage.
Alexei Podtelezhnikov afd1cb28 2021-10-16T20:25:11 * src/sfnt/ttload.c (tt_face_load_name): Accounting fix. Fallout reported as https://crbug.com/40024
Ben Wagner c71eb22d 2021-10-15T22:18:38 Fix typos in memory macros. FT_QNEW_ARRAY and FT_QRENEW_ARRAY were using the non-Q FT_MEM_NEW_ARRAY and FT_MEM_RENEW_ARRAY. Change these to use the Q versions. Also fix the one issue discovered in tt_face_load_name where table->names is created with FT_QNEW_ARRAY but the extra string member is not initialized to NULL. * include/freetype/internal/ftmemory.h (FT_Q(RE)NEW_ARRAY): Use FT_MEM_Q(RE)NEW_ARRAY as needed. * src/sfnt/ttload.c (tt_face_load_name): Initialize `entry->string`.
Ben Wagner 8406ae53 2021-10-15T14:16:30 [truetype] Reload context after re-executing `prep`. When a different hinting mode from the current is selected, the `prep` table must be re-executed with the new mode. After this happens the context must be re-loaded in preparation for the glyph program to be run. Fixes #1104. * truetype/ttgload.c (tt_loader_init): Add call to `TT_Load_Context`.
Werner Lemberg 0b92c56c 2021-10-15T19:02:41 [truetype] Minor documentation improvements.
Alexei Podtelezhnikov e294a95c 2021-10-11T23:25:29 * src/cid/cidload.c (parse_fd_array): Protect against trancation.
Alexei Podtelezhnikov 1029eb93 2021-10-11T22:25:14 [type1] Revert to signed size for binary data. Recently introduced and reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39838 * src/type1/t1load.c (read_binary_data): Reject negative size. (parse_subrs, parse_charstrings): Use customary signed size.
Alexei Podtelezhnikov 77bd46e9 2021-10-10T23:12:12 [psaux] Signedness revisions. Unsigned indexes are easier to check. * src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Updated. * src/psaux/psintrp.c (cf2_interpT2CharString): Ditto. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto. * src/type1/t1load.c (read_binary_data): Ditto.
Alexei Podtelezhnikov 3b036820 2021-10-10T23:11:10 [cid] Signedness revisions. Unsigned checks are simpler. * include/freetype/t1tables.h (CID_FaceInfoRec): Change to unsignd `num_dicts`. * src/cid/cidparse.h (CID_Parser): Change to unsigned `num_dict`. * src/cid/cidgload.c (cid_load_glyph): Updated. * src/cid/cidload.c (cid_load_keyword, parse_fd_array, parse_expansion_factor, parse_font_name, cid_read_subrs, cid_face_open): Updated. * src/cid/cidobjs.c (cid_face_done): Updated. * src/cid/cidparse.c (cid_parser_new): Updated.
Alexei Podtelezhnikov 012b4f2d 2021-10-08T22:14:12 * src/cid/cidload.c (cid_face_open): Streamline CIDCount check.
Alexei Podtelezhnikov 946df221 2021-10-07T22:44:53 * src/cid/cidload.c (cid_face_open): Streamline SubrCount check.
Alexei Podtelezhnikov 0313a11c 2021-10-07T22:43:12 * src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading.
Alexei Podtelezhnikov 22befeef 2021-10-07T22:41:56 Signedness revisions. This eliminates explicit casting by switching to unsigned fields. The revisions mostly impact the handling of CID fonts. * include/freetype/fttypes.h (FT_Data): Change to unsigned `length`. * include/freetype/t1tables.h (CID_FaceDictRec): Ditto for `sd_bytes`. (CID_FaceInfoRec): Ditto for `gd_bytes` and `gd_bytes`. * include/freetype/internal/tttypes.h (TT_LoaderRec): Ditto for `byte_len`. * src/cid/cidgload.c (cid_load_glyph): Updated. * src/cid/cidload.h (cid_get_offset): Update argument. * src/cid/cidload.c (cid_get_offset, cid_read_subrs, cid_face_open): Updated. * src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data): Updated. * src/psaux/psft.c (cf2_getT1SeacComponent): Updated. * src/truetype/ttgload.c (TT_Process_Composite_Glyph, load_truetype_glyph): Updated.
Alexei Podtelezhnikov 0f23ae2e 2021-10-05T16:28:40 * src/smooth/ftgrays.c (FT_DIV_MOD): Limit the ARM workaround.
Alexei Podtelezhnikov ec6a4588 2021-10-04T23:10:59 [pshinter] Additional clean-ups. * src/pshinter/pshalgo.h (psh_hint_table_find_strong_points): Streamline code. * src/pshinter/pshalgo.h (PSH_Glyph): Remove unused fields.
Alexei Podtelezhnikov 227445f6 2021-10-03T22:48:23 [pshinter] More convenient direction definition. It is easier to check directions using flags than integer values. * src/pshinter/pshalgo.h (PSH_Dir): Redefine directions. (PSH_PointRec): Use them as an enum type. * src/pshinter/pshalgo.c (psh_compute_dir): Modify return type. (psh_glyph_init, psh_hint_table_find_strong_points, psh_glyph_find_blue_points): Update users.
Alexei Podtelezhnikov d102a514 2021-10-03T22:45:42 [pshinter] Remove unnecessary check. * src/pshinter/pshalgo.c (psh_hint_table_find_strong_points): Do not check if direction is defined before checking how.
Alexei Podtelezhnikov 68fae526 2021-09-30T22:59:04 * src/autofit/afhints.c (af_glyph_hints_reload): Decrease casting.
Alexei Podtelezhnikov 1d79c892 2021-09-29T22:17:31 * src/tools/apinames.c: Facilitate OpenVMS linker options.
Alexei Podtelezhnikov dd0ccdc3 2021-09-28T22:57:58 * src/winfonts/winfnt.c (FNT_Face_Init): Correct reallocation.
Alexei Podtelezhnikov a69320a9 2021-09-24T22:06:44 [bdf] Simplify comment collection or lack thereof. BDF comments are neither actually collected nor retrieved. There is no need to be fancy with delimiters. * src/bdf/bdflib.c (_add_bdf_comment): Delimit comments with zeros... (bdf_load_font): ...and do not null-terminate comments additionally. (_bdf_parse_glyphs): Check if comments are kept, which they are not. (_bdf_parse_start): Minor clean up.
Alexei Podtelezhnikov a29e0200 2021-09-23T23:10:26 Use NULL for pointers only. * src/bdf/bdflib.c (*): Code changes. * include/freetype/freetype.h: Comments only. * src/cff/cffload.c, src/cff/cffobjs.c: Ditto. * src/winfonts/winfnt.c: Ditto.
Alexei Podtelezhnikov 90b14882 2021-09-22T20:20:04 [bdf, pcf] Minor optimization. * src/pcf/pcfread.c (pcf_load_font): Do not call `FT_MulDiv` for a small job. * src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto. * src/bdf/bdflib.c (_bdf_parse_glyphs): Fix a comment.
Alexei Podtelezhnikov b4dddd82 2021-09-22T00:30:03 [base] Initialize stream memory earlier. With Windows memory management tracking heap, it is important to use it during the stream opening fallback. In Unix, the argument is unused, but it is better to set it correctly. * src/base/ftobjs.c (FT_Stream_New): Set memory before calling `FT_Stream_Open`. * builds/windows/ftsystem.c, builds/unix/ftsystem.c (FT_Stream_Open, ft_close_stream_by_free): Call `ft_alloc` and `ft_free` with proper memory argumment.
Alexei Podtelezhnikov 892e7ead 2021-09-21T14:39:21 * src/bdf/bdflib.c (_bdf_parse_{start,glyphs}): Use appropriate scanner.
Alexei Podtelezhnikov 61903609 2021-09-20T22:18:29 Minor.
Alexei Podtelezhnikov 71969d1e 2021-09-20T14:31:45 * src/cff/cffdrivr.c (cff_ps_get_font_{info,extra}): Use FT_QNEW.
Alexei Podtelezhnikov 52915898 2021-09-18T07:05:55 [cache] Minor clean-ups. * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Remove parantheses. * src/cache/ftccache.c (FTC_Cache_Lookup): Ditto. (FTC_Cache_RemoveFaceID): Remove unnecessary variable.
Edwin Steiner 6e1ef98a 2021-09-16T23:08:46 [cff] Explicitly set StandardEncoding or ExpertEncoding offsets. Fixes #1097. * src/cff/cffload.c (cff_encoding_load): Set special offset values.
Alexei Podtelezhnikov fce74b73 2021-09-16T17:03:19 [cache] Miscellaneous clean-ups. * src/cache/ftccache.c (ftc_get_top_node_for_hash, FTC_Cache_Clear): Remove barely used variables. (ftc_cache_add): Adjust casting. * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Remove casting. * src/cache/ftcsbits.c (ftc_snode_load): Remove casting.
Alexei Podtelezhnikov 79d14cc2 2021-09-16T16:41:56 * src/cff/cffload.c (cff_fd_select_get): Remove casting.
Alexei Podtelezhnikov ae516e6a 2021-09-16T16:39:23 * src/pcf/pcfread.c (pcf_read_TOC): Remove casting.
Alexei Podtelezhnikov 801b7540 2021-09-14T22:55:50 Minor type adjustments. * src/cff/cffobjs.c (cff_face_init): Reduce casting. * src/truetype/ttobjs.c (tt_size_ready_bytecode): Ditto. * src/type1/t1load.c (T1_Set_MM_Design): Ditto.
Alexei Podtelezhnikov 49270c17 2021-09-14T21:32:43 Replace boolean allocation macros with MEM ones. * src/base/ftbitmap.c (FT_Bitmap_Copy): Use MEM-macro. * src/base/ftobjs.c (ft_glyphslot_alloc_bitmap): Ditto. * src/bzip2/ftbzip2.c (ft_bzip2_alloc): Ditto. * src/cache/ftccache.c (ftc_cache_init): Ditto * src/gzip/ftgzip.c (ft_gzip_alloc): Ditto. * src/psnames/psmodule.c (ps_unicodes_init): Ditto. * src/sfnt/sfobjs.c (sfnt_load_face): Ditto. * src/sfnt/ttload.c (tt_face_load_name): Ditto.
Alexei Podtelezhnikov 9a4c846e 2021-09-14T21:25:47 [cache] Revert to some zeroing. * src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Zero `buckets` again to fix some crashes.
Alexei Podtelezhnikov 0a8ee851 2021-09-14T10:26:37 * src/pshinter/pshrec.c (ps_mask_table_merge_all): Tweak loops. Fixes fallout from 731d0b685685 reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38685
Alexei Podtelezhnikov 731d0b68 2021-09-13T16:29:08 [cff, pshinter] Clean up unsigned counters. Loops with unsigned decrement can be reliably stopped when the counter wraps around after reaching zero. * src/cff/cffload.c (cff_charset_compute_cids): Use unsigned counter. * src/pshinter/pshalgo.c (psh_hint_table_activate_mask): Ditto. * src/pshinter/pshrec.c (ps_mask_table_merge): Ditto.
Alexei Podtelezhnikov 058f3f2d 2021-09-13T16:24:25 [bdf, psnames, sfnt] Avoid some memory zeroing. * src/bdf/bdfdrivr.c (BDF_Face_Init): Use Q-macro. * src/sfnt/sfobjs.c (sfnt_load_face): Ditto. * src/psnames/psmodule.c (src/psnames/psmodule.c): Remove zero.
Alexei Podtelezhnikov 59b43ae6 2021-09-13T16:16:18 * src/base/ftobjs.c (FT_CMap_New): Revert to zeroing. Fixes fallout from c1fa7aa2bc96, reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38641
Alexei Podtelezhnikov 073ff2d7 2021-09-13T00:04:45 [truetype] Clean up `exec` initialization. * src/truetype/ttinterp.c (Init_Context): Absorbed into... (TT_New_Context): ... this function.
Alexei Podtelezhnikov fab94f9f 2021-09-12T23:30:07 [truetype] Avoid some memory zeroing. * src/truetype/ttgload.c (load_truetype_glyph): Use Q-macro. * src/truetype/ttinterp.c (Update_Max): Ditto. * src/truetype/ttpload.c (src/truetype/ttpload.c): Ditto.
Alexei Podtelezhnikov c1fa7aa2 2021-09-12T23:25:46 [base] Avoid some memory zeroing. * src/base/ftobjs.c (FT_New_Size, FT_CMap_New, FT_CMap_Done, ft_open_face_internal, ft_open_face_internal): Use Q-macros.
Alexei Podtelezhnikov a8e8d9d7 2021-09-12T23:21:32 [cache, psaux] Remove zeros. * src/cache/ftcmru.c (FTC_MruList_New): Remove initialization. * src/psaux/psstack.c (cf2_stack_init): Ditto.
Alexei Podtelezhnikov 9870b6c0 2021-09-12T14:32:22 [cache] Avoid some memory zeroing. * src/cache/ftcmru.c (FTC_MruList_New): Use Q-macro. * src/cache/ftcmanag.c (FTC_Manager_RegisterCache): Ditto. * src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Ditto.
Alexei Podtelezhnikov 2d57b059 2021-09-11T10:38:08 * src/cache/ftcmanag.c (FTC_Manager_New): Add missing zero. Fixes fall out from a7b199d081e7.
Alexei Podtelezhnikov 5b626281 2021-09-10T10:19:07 [truetype] Tweak `hdmx` checking. Fixes #1096. * src/truetype/ttpload.c (tt_face_load_hdmx): Account for padding.
Alexei Podtelezhnikov e942a310 2021-09-09T22:17:46 [truetype] Tweak `loca` clamping. Fixes #1095. * src/truetype/ttpload.c (tt_face_load_loca): Fix up clamping. * include/freetype/internal/tttypes.h (TT_Face): Correct docs.
Alexei Podtelezhnikov c350aac0 2021-09-08T12:18:23 Fortify memory debugging (cont'd). * src/base/ftdbgmem.c (FT_DumpMemory): Check for active debugger. (ft_mem_table_destroy): Move `FT_DumpMemory` call from here... (ft_mem_debug_done): ... to here.
Alexei Podtelezhnikov 63806aad 2021-09-08T10:54:44 Fortify memory debugging. These changes are neccessary to properly recover `memory->user` that holds the Windows heap handle now. * src/base/ftdbgmem.c (ft_mem_debug_init): Handle all table allocations, initializations, and sizing instead of... (ft_mem_table_new): ... this function removed. (ft_mem_debug_done): Better check for the active debugger and free the debugger table here instead of... (ft_mem_table_destroy): ... here.
Werner Lemberg 77dcc5ed 2021-09-07T18:49:36 src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): Set to 600. This allows C99 compilation on Solaris. Problem reported by Mojca Miklavec.
Werner Lemberg 60a93ea2 2021-09-07T06:38:09 [dlg] Synchronize with upstream. * src/dlg/dlgwrap.c (_XOPEN_SOURCE): Set to 600. Fixes #1093.
Alexei Podtelezhnikov aee1fd3b 2021-09-03T22:13:22 Cosmetic zeros.
Alexei Podtelezhnikov 7bf655b2 2021-09-03T11:31:41 * src/bdf/bdflib.c (_bdf_parse_start): Keep parser memory.
Alexei Podtelezhnikov 7f8f0c1c 2021-09-02T23:30:31 [smooth, raster, sdf] Clean up initialization calls. * src/raster/ftraster.c (ft_black_init): Removed. (ft_black_new): Clean up. * src/sdf/ftbsdf.c (bsdf_raster_new): Ditto. * src/sdf/ftsdf.c (sdf_raster_new): Ditto. * src/smooth/ftgrays.c (gray_raster_new): Ditto.
Alexei Podtelezhnikov a7b199d0 2021-09-02T22:58:50 * src/cache/ftcmanag.c (FTC_Manager_New): Avoid some zeroing.
Alexei Podtelezhnikov 0a6f0f8f 2021-09-02T22:52:21 * src/bdf/bdflib.c (bdf_load_font): Remove memory shuffling.
Alexei Podtelezhnikov a81cf5aa 2021-09-02T22:10:57 Cosmetic zeros.
Alexei Podtelezhnikov 7482c98f 2021-09-01T22:18:29 [base] Clean up stream reading. * src/base/ftstream.c (FT_Stream_ReadUShort, FT_Stream_ReadUOffset, FT_Stream_ReadULong and their LE variants): Remove unnecessary initialization and slightly refactor. (FT_Stream_GetByte, FT_Stream_ReadByte): Rename to return unsigned value and align with sister functions. * include/freetype/internal/ftstream.h (FT_Stream_GetByte, FT_Stream_ReadByte): Update prototypes and caller macros.
Alexei Podtelezhnikov 612925ff 2021-09-01T21:37:21 s/0/NULL/ where appropriate.
Alexei Podtelezhnikov b6c11d49 2021-08-30T07:09:53 [smooth] Reduce shift in multiply-shift optimization. * src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): Reduce shift. Smaller shifts that keep the division operands of FT_UDIVPREP within 32 bits result in slightly faster divisions, which is noticeable in the overall performance. The loss of precision is tolerable until the divisors (the components dx and dy) approach 32 - PIXEL_BITS. With PIXEL_BITS = 8, this corresponds to 65,000 pixels or the bitmap size that we refuse to render anyway. Using `ftbench -p -s60 -t5 -bc timesi.ttf`, Before: 8.52 us/op After: 8.32 us/op
Werner Lemberg d1c20005 2021-08-28T07:29:05 [truetype] Fix compilation if !TT_CONFIG_OPTION_BYTECODE_INTERPRETER. * src/truetype/ttgxvar.c (tt_cvt_ready_iterator): Compile function conditionally. (tt_face_vary_cvt) [!TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Add code. Fixes #1091.
Ben Wagner a842a098 2021-08-26T16:12:22 [smooth] Detect SSE2 with MSVC for x86 MSVC does not set `__SSE2__`. Instead one must check whether `_M_IX86_FP` is defined and greater than or equal to 2. * src/smooth/ftgrays.c (FT_SSE2): New macro. Use it where appropriate.
Alexei Podtelezhnikov 3785393d 2021-08-26T15:31:11 Expand comment (cont'd).
Alexei Podtelezhnikov 686e2a5e 2021-08-25T23:18:43 Expand comment.
Alexei Podtelezhnikov f7f9cb0d 2021-08-24T15:29:06 * src/smooth/ftgrays.c (gray_render_conic): Refactor redundancy.
suzuki toshiya 50318357 2021-08-25T00:31:26 [truetype] Fix for the family name shorter than 8 characters. * src/truetype/ttobjs.c (tt_skip_pdffont_random_tag): If the family name to be checked is shorter than 8 characters, do not check its syntax.
suzuki toshiya c4fc0e69 2021-08-24T12:29:47 [truetype] Simplify `trick_names'. * src/truetype/ttobjs.c (tt_check_trickyness_family): For the case that the beginning part of a long tricky family name is already registered as another tricky family name, no need to double-check the longer one. Such long tricky family names are removed from the `trick_names'.
suzuki toshiya 992382ba 2021-08-24T12:11:46 [truetype] Add 2 tricky font names. Additional fix for the issue #1087. * src/truetype/ttobjs.c (tt_check_trickyness_family): Add 2 tricky font names reported in #1087.
suzuki toshiya 2b3ccd6e 2021-08-24T11:43:11 [truetype] New function to skip the randomization tag. * src/truetype/ttobjs.c (tt_skip_pdffont_random_tag): New function to skip the randomization tag in the names of the fonts embedded in a PDF. It is used by tt_check_trickyness_family(), to keep from mistaking "DLC" in the randomization tag as a tricky font name. See discussion in: https://lists.nongnu.org/archive/html/freetype-devel/2021-02/msg00002.html For technical detail about the randomization tag, please find PDF Reference 5.5.3 "Font Subsets". Thanks to Justyna Wawrzynska for pointing out the issue caused by the randomization tag.
suzuki toshiya 1c23982d 2021-08-24T10:25:22 [truetype] Add checksums for 2 tricky fonts. Thanks to Ting717 for providing sample PDF. Fixes #1087. * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): Add checksums for 2 tricky fonts `DFHei-Bd-WIN-HK-BF' and `DFMing-Md-WIN-HK-BF'.
Alexei Podtelezhnikov 78f2bd0b 2021-08-22T22:32:07 Whitespace formatting.
Alexei Podtelezhnikov d92aa23f 2021-08-22T13:12:45 Decorate const arguments. * src/base/ftglyph.c (FT_Glyph_Transform, FT_Glyph_To_Bitmap): Do it. * include/freetype/ftglyph.h (FT_Glyph_Transform, FT_Glyph_To_Bitmap): Do it.
Alexei Podtelezhnikov d62d583d 2021-08-20T23:40:49 [smooth] Clean up the null cell usage. Put the null cell at the end of the pool and store it explicitly so that we can use it as both the limit and the dumpster. * src/smooth/ftgrays.c (gray_TWorker): Store the last `cell_null` and remove unnecesary fields. (NULL_CELL_PTR, CELL_IS_NULL): Remove in favor of explicit `cell_null`. (gray_dump_cells, gray_set_cell, gray_sweep{,_direct}): Update callers. (gray_convert_glyph_inner): Trace remaining cells (oh well). (gray_convert_glyph): Set up `cell_null` and slightly improve the pool management.
Alexei Podtelezhnikov 6e9d8d31 2021-08-20T16:01:32 [base] Restore quiet no-op rendering of bitmap glyphs. Fixes #1076. * src/base/ftobjs.c (FT_Render_Glyph_Internal): Discard an error when rendering a bitmap glyph.
Alexei Podtelezhnikov de3b5c20 2021-08-20T13:51:40 [smooth] Fortify 64-bit algorithm. * src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): s/long/FT_Int64/ and s/unsigned long/FT_UInt64/. (gray_render_line): Adjust a critical variable type.
Dominik Röttsches 633fe087 2021-08-19T16:56:22 [sfnt] Fix format expectation for `COLR` v1 ClipList * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Change ClipList format expectation to 1 instead of 0 to make it compliant with the latest spec.
Alexei Podtelezhnikov 85703839 2021-08-18T23:05:51 Use FT_INT64 instead of FT_LONG64. * include/freetype/config/integer-types.h: Remove synonymous FT_LONG64. * include/freetype/internal/ftcalc.h: s/FT_LONG64/FT_INT64/. * src/base/ftcalc.c: Ditto. * src/base/fttrigon.c: Ditto. * src/smooth/ftgrays.c: Ditto.
Werner Lemberg f44c2d58 2021-08-18T08:52:21 * src/sdf/ftsdf.c (get_control_box): Fix compiler warning.
Werner Lemberg f11f3ed1 2021-08-18T06:54:34 [base] Fix ppem size overflow. Fixes #1086. * src/base/ftobjs.c (FT_Request_Metrics): Add return value. Check whether ppem values fit into unsigned short values. (FT_Request_Size): Updated. * include/freetype/internal/ftobjs.h: Updated. * src/cff/cffobjs.c (cff_size_request), src/cid/cidobjs.c (cid_size_request), src/truetype/ttdriver.c (tt_size_request), src/type1/t1objs.c (T1_Size_Request): Updated.
Werner Lemberg fed55210 2021-08-09T19:27:34 * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Minor fix.
Werner Lemberg 18fc64e6 2021-08-07T17:11:57 [smooth] Avoid integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36243 * src/smooth/ftgrays.c(ADD_LONG, SUB_LONG, MUL_LONG, NEG_LONG) [STANDALONE_]: Removed, unused. (ADD_INT) [STANDALONE_]: New macro. (FT_INTEGRATE): Use ADD_INT.
Dominik Röttsches 47cf8ebf 2021-07-28T17:36:57 [sfnt] Add API for retrieving a 'COLR' v1 'ClipBox' table. The optional 'COLR' v1 glyph-specific clip box helps upstream graphics libraries allocate a sufficiently large bitmap for a glyph without having to traverse the glyph graph for that. See https://github.com/googlefonts/colr-gradients-spec/issues/251 for background on the introduction of this specification change. * include/freetype/ftcolor.h (FT_ClipBox): New structure. (FT_Get_Color_Glyph_ClipBox): New function declaration. * include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_ClipBox_Func): New function type. (SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Use it. * src/base/ftobjs.c (FT_Get_Color_Glyph_ClipBox): New function to link API with SFNT implementation. * src/sfnt/sfdriver.c (sfnt_interface): Updated. * src/sfnt/ttcolr.c (Colr): New field `clip_list`. (tt_face_load_colr): Parse global clip list offset. (tt_face_get_color_glyph_clipbox): New function to find the clip box for a glyph id from the clip list array. * src/sfnt/ttcolr.h: Updated.
Werner Lemberg 6be8bfe4 2021-08-06T08:31:22 [smooth] Fix left shifts of negative numbers. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36241 * src/smooth/ftgrays.c (LEFT_SHIFT): New macro. (gray_render_conic) [BEZIER_USE_DDA]: Use it.
Anuj Verma be6ab319 2021-08-02T09:44:16 [sdf] Fix out-of-range-access. * src/sdf/ftbsdf.c (first_pass, second_pass): Fix range during forward pass. Otherwise the index goes out of range for the last column. Fixes issue #1077.
Anuj Verma ebcc96e5 2021-08-02T08:40:43 Fix invalid memory access in `bsdf` rasterizer. Do not generate SDF from bitmap if the `FT_GLYPH_OWN_BITMAP` flag is not set. In some cases the bitmap buffer is freed but still points to a valid address; to handle those cases check the flag before accessing the memory. * src/sdf/ftsdfrend.c (ft_bsdf_render): Handle the above case. Also, return an error message if the bitmap's rows/pitch is invalid, otherwise `slot->buffer` might be assigned to some invalid memory location. (ft_sdf_render): Same as above. Plus, move the outline back to original state after rasterization and not if any error occurs. Signed-off-by: Anuj Verma <anujv@iitbhilai.ac.in>
Werner Lemberg d2367aba 2021-07-29T08:16:25 src/sfnt/ttcolr.c: Minor formatting.
Dominik Röttsches 30a82e1e 2021-07-26T18:28:56 [sfnt] 'COLR' v1 PaintSweepGradient spec update * src/sfnt/ttcolr.c (read_paint): PaintSweepGradient follows other spec changes and now has the angles specified as F2DOT14, reflect that in the implementation. * include/freetype/ftcolor.h (FT_PaintSweepGradient): Update documentation.
Dominik Röttsches 5c0ac7a4 2021-07-26T17:32:09 [sfnt] Retrieve affine matrix from offset in 'COLR' v1 parsing. * src/sfnt/ttcolr.c (read_paint): Implement spec change where affine transform matrix is now referenced by offset instead of being placed inline in the PaintTransform table.
Dominik Röttsches 66189807 2021-07-26T17:32:22 [sfnt] 'COLR' v1 PaintSkew related spec updates * src/sfnt/ttcolr.c (read_paint): Implement spec changes around PaintSkew, PaintSkewAroundCenter. Update parsing to read shorter values as changed in the spec. * include/freetype/ftcolor.h (FT_PaintSkew): Update documentation.