src/smooth


Log

Author Commit Date CI Message
Alexei Podtelezhnikov 34ed28d0 2023-02-20T16:33:45 [base] Clean up contour indexing. * src/base/ftoutln.c (FT_Outline_Reverse, FT_Outline_EmboldenXY, FT_Outline_Get_Orientation): Set the first and last indexes together. (FT_Outline_Decompose): Ditto and check them more stringently. * src/smooth/ftgrays.c (FT_Outline_Decompose)[STANDALONE_]: Ditto.
Werner Lemberg ac5babe8 2023-02-08T19:36:10 Fix 'fall-through' warning messages. Modern compilers get more insistent on that... * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Define. * src/*: Use it instead of `/* fall through */` comments.
Werner Lemberg 65f85237 2023-01-17T09:18:25 Update all copyright notices.
Alexei Podtelezhnikov 4fef1fce 2022-06-10T11:34:56 [smooth] Fix GCC LTO crashes on Windows. Fixes #1164 by using a volatile variable around `setjmp`. It is hard to say how this fixes crashes related to certain link-time optimizations. This does not decrease the rendering performance. * src/smooth/ftgrays.c (gray_convert_glyph_inner): Use volatile `error`.
bruvzg 9acefc4f 2022-06-09T10:51:07 * src/smooth/ftgrays.c [FT_STATIC_RASTER]: Fix compilation.
Werner Lemberg d0cfb4e1 2022-01-11T10:54:10 Update all copyright notices.
Alexander Borsuk 4eb6cb88 2021-12-25T09:23:58 Fix warnings for CMake Unity builds. * src/cache/ftcbasic.c (FT_COMPONENT): Undefine macro before redefinition. * src/smooth/ftgrays.c (TRUNC, FRACT): Ditto.
Werner Lemberg f5ce1824 2021-11-20T07:56:34 [smooth] Fix stand-alone compilation. * src/smooth/ftgrays.c (FT_Trace_Enable, FT_Trace_Disable)[STANDALONE_]: Define.
Werner Lemberg 8c8f51c5 2021-11-19T21:50:22 Avoid undefined left-shifts. We really have to use double casts to avoid issues with C's and C++'s signedness propagation rules in implicit casts. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41178 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41182 * include/freetype/config/public-macros.h (FT_STATIC_CAST, FT_REINTERPRET_CAST): Modify macro to take two arguments. Update all callers. (FT_STATIC_BYTE_CAST): New macro. * include/freetype/freetype.h (FT_ENC_TAG): Use `FT_STATIC_BYTE_CAST`. * include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto. * include/freetype/fttypes.h (FT_MAKE_TAG): Ditto. Use `FT_Tag` for casting. * src/ftraster/ftmisc.h (FT_MAKE_TAG): Removed, no longer needed. (FT_STATIC_BYTE_CAST): New macro. * src/smooth/ftgrays.c (FT_STATIC_CAST): Replace with... (FT_STATIC_BYTE_CAST): ... this.
Werner Lemberg 9079c5d9 2021-11-13T08:53:19 Provide C++ versions for public macros with casts. Many FreeType clients use C++. However `g++ -Wold-style-cast` warns for macros with C-style casts even for system header files; this also affects directories included with `-isystem`. While this could be seen as a problem with g++, the problem is more a philosophical one: Over the time, C and C++ diverged more and more, and some features of C are no longer the 'right' solution in C++. * include/freetype/config/public-macros.h (FT_STATIC_CAST, FT_REINTERPRET_CAST): New macros. * include/freetype/freetype.h (FT_ENC_TAG, FT_LOAD_TARGET_, FT_LOAD_TARGET_MODE): Use `FT_STATIC_CAST`. Correctly handle negative 'signed char' input. * include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto. * include/freetype/fttypes.h (FT_MAKE_TAG, FT_BOOL): Ditto. * include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): Use `FT_REINTERPRET_CAST`. * src/smooth/ftgrays.c (FT_STATIC_CAST)[STANDALONE_]: New macro. [!STANDALONE]: Include `FT_CONFIG_CONFIG_H`. Fixes #1116.
Werner Lemberg 238245cd 2021-11-16T22:07:28 Fix clang++ warnings. * src/*: Initialize some variables to NULL.
Werner Lemberg d31bafcb 2021-11-14T11:02:54 Fix clang warnings. * src/gxvalid/gxvcmmn.h (GXV_SET_ERR_IF_PARANOID): Use 'do' block. * src/gxvalid/gxvmod.c (GXV_TABLE_LOAD, GXV_TABLE_VALIDATE): Ditto. * src/smooth/ftgrays.c (gray_convert_glyph): Add cast. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Remove cast. * src/type1/t1load.c (read_binay_data): Use `FT_ULong` for `size` parameter. (parse_subrs, parse_charstrings, parse_dict): Ditto; also add some casts.
Alexei Podtelezhnikov 0f23ae2e 2021-10-05T16:28:40 * src/smooth/ftgrays.c (FT_DIV_MOD): Limit the ARM workaround.
Alexei Podtelezhnikov 61903609 2021-09-20T22:18:29 Minor.
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 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
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.
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 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.
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 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.
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.
Werner Lemberg c2fa51d9 2021-07-24T20:32:16 Fix some `cppcheck` warnings. * src/bzip2/ftbzip2.c (ft_bzip2_file_skip_output), src/gzip/ftgzip.c (ft_gzip_file_skip_output): Reduce scope of `delta`. * src/psaux/psintrp.c, src/psaux/psintrp.h (cf2_interpT2CharString): Add `const` to `buf` parameter. * src/raster/ftraster.c (DelOld): Add `const` to `profile` parameter. (Vertical_Sweep_Span): Reduce scope of `target`. (FT_Outline_Get_CBox): Reduce scope of `xMin`, `xMax`, `yMin`, `yMax`. * src/smooth/ftgrays.c (gray_render_conic): Reduce scope of `split`. (gray_sweep, gray_sweep_direct): Reduce scope of `area`. * src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Reduce scope of `temp`.
David Turner 357b353c 2021-07-16T11:12:13 * src/smooth/ftgrays.c: Fix compilation if `FT_LONG64` is undefined. The code assumed that if `__SSE2__` is defined, then 64-bit integer types are available. This is not the case apparently for certain multilib compiler targets like 'x86_32.x86' used by Gentoo. This patch fixes the issue by disabling the special code path when 64-bit integer types are not available. Fixes #1071.
Werner Lemberg 552fc97f 2021-07-16T07:49:20 [smooth] Minor fixes. * src/smooth/ftgrays.c (gray_render_conic): Move variable and structure declarations to beginning of function. Inspite of C99 compliance we still do this for the sake of backward compatibility. This also avoids a shadowing declaration of `count`. (gray_convert_glyph_inner): Fix typo.
Werner Lemberg 93771d61 2021-07-16T07:40:56 Formatting and ChangeLog additions for previous commits.
Ben Wagner c37c0873 2021-07-15T11:33:16 Guard inclusion of emmintrin.h Guard inclusion of emmintrin.h with "#ifdef __SSE2__". The gcc version of this header, xmmintrin.h, and mmintrin.h check that the appropriate defines are set before defining anything (are internally guarded). However the clang versions of these includes are not internally guarded. As a result of this, externally guard the inclusion of these headers.
David Turner 56cc2ad4 2021-06-19T10:26:53 [smooth] Implement Bezier quadratic arc flattenning with DDA Benchmarking shows that this provides a very slighty performance boost when rendering fonts with lots of quadratic bezier arcs, compared to the recursive arc splitting, but only when SSE2 is available, or on 64-bit CPUs. On a 2017 Core i5-7300U CPU on Linux/x86_64: ./ftbench -p -s10 -t5 -cb .../DroidSansFallbackFull.ttf Before: 4.033 us/op (best of 5 runs for all numbers) After: 3.876 us/op ./ftbench -p -s60 -t5 -cb .../DroidSansFallbackFull.ttf Before: 13.467 us/op After: 13.385 us/op
David Turner 86b9c934 2021-06-19T11:18:40 [smooth] Minor speedup to smooth rasterizer This speeds up the smooth rasterizer by avoiding a conditional branches in the hot path. Namely: - Define a fixed "null cell" which will be pointed to whenever the current cell is outside of the current target region. This avoids a "ras.cell != NULL" check in the FT_INTEGRATE() macro. - Also use the null cell as a sentinel at the end of all ycells[] linked-lists, by setting its x coordinate to INT_MAX. This avoids a 'if (!cell)' check in gray_set_cell() as well. - Slightly change the worker struct fields to perform a little less operations during rendering. Example results (on a 2013 Corei5-3337U CPU) out/ftbench -p -s10 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf Before: 5.472 us/op After: 5.275 us/op out/ftbench -p -s60 -t5 -bc /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf Before: 17.988 us/op After: 17.389 us/op
Alexei Podtelezhnikov 1e0cef9e 2021-06-24T00:19:50 [smooth, raster] Fix up and align error codes. FT_Render_Glyph picked up FAILURE or 1 returned from the raster function, which became a confusing error code. Instead, return Raster_Overflow in the unlikely event that banding does not help or another meaningful error. * src/smooth/ftgrays.c (gray_convert_glyph_inner, gray_convert_glyph): Use Raster_Overflow when the rendering pool is exhausted and return it if banding does not help. (gray_raster_render): Use Smooth_Err_Ok. * src/raster/ftraster.c (Render_Single_Pass): Return Raster_Overflow if banding does not help or another error code.
Alexei Podtelezhnikov d8ac180c 2021-06-23T23:32:02 [smooth, raster] Remove synonymous error macros. * src/smooth/ftgays.c [STANDALONE_]: s/ErrRaster_/Smooth_Err_/. (gray_convert_glyph_inner): Updated accordingly. * src/raster/ftraster.c [STANDALONE_]: Do not abbreviate error macros. (New_Profile, End_Profile, Insert_Y_Turn, Line_Up, Bezier_Up, Decompose_Curve, Draw_Sweep, Render_Single_Pass, ft_black_render): Updated accordingly.
Alexei Podtelezhnikov 2d3f5dd2 2021-05-12T17:24:35 * src/smooth/ftgrays.c (FT_MAX_GRAY_SPANS): Increase from 10 to 16. Ten was barely enough for two slanted stems. Sixteen can actually fit a bit more complicated scanlines.
Alexei Podtelezhnikov c653b8d2 2021-05-12T16:17:21 * src/smooth/ftgrays.c (FT_GRAY_SET): Adjust for better code.
Alexei Podtelezhnikov 8f43d324 2021-05-12T00:04:59 [smooth] Faster bitmap sweeping. Selecting the fill rule or checking the direct mode each time we call `gray_hline' is sub-optimal. This effectively splits the direct mode into a separate code path while inlining `gray_hline' and saving 5-7% of rendering time. * src/smooth/ftgrays.c (gray_hline): Eliminated in favor of... (FT_FILL_RULE, FT_GRAY_SET): ... these new macros... (gray_sweep): ... inlined here. (gray_sweep_direct): New function that handles the direct span buffer. (gray_TWorker): Remove the span buffer. (gray_raster_render, gray_convert_glyph): Updated.
Alexei Podtelezhnikov b0702645 2021-05-10T22:06:01 * src/smooth/ftgrays.c (gray_hline): Simplify even-odd computations. It is too bad the even-odd rule is not used much.
Alexei Podtelezhnikov fb9bf2ef 2021-03-15T22:33:17 * src/smooth/ftgrays.c (gray_set_cell): Refactor to fix VC++ warning.
Alexei Podtelezhnikov 80bda804 2021-03-11T22:40:19 [smooth] Reduce copying during integration phase. We now record `cover' and `area' directly into the linked list. This makes rendering faster by 10% or even more at larger sizes. * src/smooth/ftgrays.c (FT_INTEGRATE): Write directly. (gray_TWorker): Add direct cell reference and remove unused fields. (gray_set_cell): Consolidate the linked list management and pointers. (gray_convert_glyph, gray_convert_glyph_inner): Updated.
Alexei Podtelezhnikov d5b7de55 2021-03-11T22:08:45 * src/smooth/ftgrays.c (FT_INTEGRATE): New convenience macro. (gray_render_line, gray_render_scanline): Use it.
Alexei Podtelezhnikov 85168499 2021-03-09T22:14:44 * src/smooth/ftgrays.c (gray_render_line): Rearrange conditionals. These produce faster or more optimizable code.
Werner Lemberg b6e8a712 2021-01-17T07:18:48 Update all copyright notices.
Alexei Podtelezhnikov 16ee2a22 2020-08-28T23:08:42 [smooth] Don't set target in direct mode. * src/smooth/ftsmooth.c (ft_smooth_raster_overlap): Remove assignment. (ft_smooth_raster_lcd) [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Ditto.
Alexei Podtelezhnikov 6730854c 2020-08-25T23:16:27 * src/smooth/ftsmooth.c (ft_smooth_raster_overlap): Limit width. Segmentation fault reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24729
Priyesh Kumar 53be1753 2020-07-28T07:33:40 Fix `-Wformat' compiler warnings. * src/*: Fix format specifiers. * builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
Werner Lemberg 96fb73ef 2020-07-07T16:58:14 Fix clang warnings. * include/freetype/internal/autohint.h (FT_DECLARE_AUTOHINTER_INTERFACE): New macro. * src/autofit/afmodule.h: Use it to declare `af_autofitter_interface'. * include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH): New macro. * src/base/ftbase.h: Use it to declare `ft_bitmap_glyph_class' and `ft_outline_glyph_class'. * src/base/ftglyph.c: Include `ftbase.h'. * src/cff/cffparse.c (cff_parser_run): Fix type of `t2_size'. * src/pcf/pcfdrivr.c (pcf_cmap_char_next): Fix type of `result'. * src/psaux/psauxmod.c (psaux_module_class): Use `FT_DEFINE_MODULE'. * src/psaux/psauxmod.h: Declare `afm_parser_funcs', `t1_cmap_classes', `cff_decoder_funcs', and `psaux_module_class'. * src/pshinter/pshmod.c: Include `pshmod.h'. * src/sfnt/sfwoff2.c (ROUND4, WRITE_SHORT): Fix implicit sign conversion. (compute_ULong_sum): Fix return type. Fix implicit sign conversion. (store_points): Fix type of `last_flag', `repeat_count', and `flag'. Use casts to avoid warnings. (reconstruct_glyf): Fix implicit sign conversion. Use cast to avoid warning. (get_x_mins): Fix implicit sign conversion. * src/sfnt/ttcmap.c: Undef `TTCMAPCITEM'. * src/sfnt/ttcmap.h: Define `TTCMAPCITEM' and include `ttcmapc.h' to declare cmap classes. * src/smooth/ftsmooth.c (ft_smooth_overlap_spans): Use cast. * src/truetype/ttinterp.c (Ins_MIAP): Fix typo.
Alexei Podtelezhnikov 3bb512bc 2020-07-03T22:29:34 [smooth] Introduce direct oversampling for overlaps. This implements oversampling to metigate artifacts in pixels partially covered by overlapping contours. It turns out that the 4x4 oversampling is sufficient but, at least, quadruples the rendering time. The outline has to set FT_OUTLINE_OVERLAP to use this method. * include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): New flag. * src/smooth/ftsmooth.c (ft_smooth_render): Check it to... (ft_smooth_raster_overlap): ... inflate outline and set up direct rendering for oversampling with... (ft_smooth_overlap_spans): ... new span function that integrates them.
Alexei Podtelezhnikov 19d39f43 2020-07-03T09:17:22 [smooth] Use direct rendering mode in Harmony. Instead of rendering 3 bitmaps side by side and reshuffling, we use direct rendering to deliver the bitmaps on each third byte. * src/smooth/ftsmooth.c (ft_smooth_raster_lcd) [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Set up direct mode with... (ft_smooth_lcd_spans): ... new span function.
Alexei Podtelezhnikov 2d67511a 2020-07-03T09:02:09 [smooth] Separate LCD paths from gray rendering. This makes `ft_smooth_render' a lot smaller and easier to follow. It also cleanly separates Harmony and ClearType-style LCD rendering algorithms. Now I only wish to move LCD filtering and geometry from FT_Library to FT_Renderer. * src/smooth/ftsmooth.c (ft_smooth_render): Move LCD code from here... (ft_smooth_raster_lcd, ft_smooth_raster_lcdv): ... to here. [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Reorganize #ifdef's.
Werner Lemberg 16586859 2020-06-13T21:15:45 Remove redundant inclusion of `ft2build.h'. * */*: Remove `#include <ft2build.h>' where possible. * include/freetype/freetype.h: Remove cpp error about missing inclusion of `ft2build.h'.
David Turner e1339133 2020-06-08T13:31:55 Make macros for header file names optional. We no longer have to take care of the 8.3 file name limit; this allows us (a) to introduce longer, meaningful file names, and (b) to avoid macro names in `#include' lines altogether since some compilers (most notably Visual C++) doesn't support this properly. */*: Replace #include FOO_H with #include <freetype/foo.h> or something similar. Also update the documentation.
David Turner 4eee1340 2020-05-18T09:16:12 Remove Jamfile files from the tree. These have not been used in a very, very long time, so better remove them. A corresponding patch will be submitted to the `freetype2-demos' repository. * src/Jamfile, src/*/Jamfile, Jamrules: Delete.
Alexei Podtelezhnikov 3f70e6d2 2020-05-12T00:38:46 [smooth] Turn on LCD filtering during FreeType initialization. * src/smooth/ftsmooth.c (ft_smooth_init): Enable LCD filtering. * include/freetype/ftlcdfil.h: Document it, remove patent warnings. * include/freetype/freetype.h (FT_Render_Mode): Updated. * include/freetype/config/ftoption.h, devel/ftoption.h [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Do not mention patents.
Alexei Podtelezhnikov 652f8863 2020-05-11T23:30:37 [smooth] Stop using dedicated LCD modules and classes. The LCD modules were never truly independent. They mostly served as a way to disable patented LCD rendering, which is no longer necessary. The `smooth' module now handles LCD modes as well. * src/smooth/ftsmooth.c (ft_smooth_lcd_renderer_class. ft_smooth_lcdv_renderer_class): Deleted. (ft_render_smooth): Reworked from `ft_render_smooth_generic'. * src/smooth/ftsmooth.h: Remove dedicated LCD classes. * src/smooth/module.mk: Remove dedicated LCD modules. * include/freetype/config/ftmodule.h: Ditto. * builds/amiga/include/config/ftmodule.h: Ditto. * include/freetype/ftmodapi.h: Do not mention LCD modules.
Werner Lemberg e5038be7 2020-01-19T17:05:19 Update all copyright notices.
Werner Lemberg 2c9a2d58 2019-12-13T23:56:25 Another bunch of UBSan warnings on adding offsets to nullptr. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19427 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19433 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19441 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19451 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19452 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19457 * src/autofit/aflatin.c (af_latin_hints_compute_segments, af_latin_hints_compute_edges): Use `FT_OFFSET'. * src/base/ftstream.c (FT_Stream_EnterFrame): Use `FT_OFFSET'. * src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Exit early if there is no charstring. * src/psaux/psobjs.c (t1_decrypt): Use `FT_OFFSET'. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Exit early for zero bitmap dimensions.
Dominik Röttsches 11d4ce23 2019-12-09T12:40:42 Fix more UBSan warnings on adding offset to nullptr (#57384) * src/smooth/ftsmooth.c (ft_smooth_render_generic), src/psaux/psobjs.c (ps_table_add): Use `FT_OFFSET'.
Alexei Podtelezhnikov e7ac9288 2019-06-13T00:17:36 [smooth] Restore the span buffering for direct mode only. The buffer size FT_MAX_GRAY_SPANS is set to 10 spans, which should be enough to cover the entire scanline for simple glyphs in most cases: each slightly slanted edge needs up to two spans, plus a filling span in-between. This is not new, we used to do it before cb4388783cecc. * src/smooth/ftgrays.c (gray_TWorker): Add `spans' and `num_spans'. (gray_hline, gray_sweep): Implement the span buffering. (gray_raster_render): Use negative `num_spans' to avoid the direct mode.
Alexei Podtelezhnikov bdac4cbe 2019-06-12T21:58:35 Rendering considerations.
Werner Lemberg 9159128a 2019-05-29T07:45:54 Silence gcc 7's fall-through warnings in `switch' blocks. Instead of an intentionally missing `break' statement there must be a comment line containing `fall through' (and nothing else) right before the next `case' statement. See https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them
Alexei Podtelezhnikov 141e3173 2019-05-20T23:09:59 Rendering considerations.
Alexei Podtelezhnikov bc3b5281 2019-05-08T22:08:40 [smooth] Faster fractions. * src/smooth/ftgrays.c (SUBPIXELS): Replace with... (FRACT): A fractional coordinate macro to use in... (gray_render_line, gray_render_scanline): ... here.
Alexei Podtelezhnikov 81725773 2019-05-04T08:11:20 * src/smooth/ftgrays.c (gray_render_line): Small shortcut.
Alexei Podtelezhnikov 300458eb 2019-05-03T23:16:42 Miscellaneous macro updates. * src/base/ftoutln.c (SCALED): Updated. * src/smooth/ftgrays.c (SCALED): Ditto. (FLOOR, ROUND, CEILING): Removed. * src/psaux/psfixed.h (cf2_fracToFixed): Updated.
Alexei Podtelezhnikov 65f9516b 2019-05-02T23:06:55 Tweak LCD filtering. * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): Choose direction from bitmap's pixel_mode. * include/freetype/internal/ftobjs.c (FT_Bitmap_LcdFilterFunc): Updated. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated.
Alexei Podtelezhnikov 2ea511ee 2019-04-29T22:49:15 [smooth] Simplify cubic Bézier flattening. The previous implementation is correct but it is too complex. The revised algorithm is based on the fact that each split moves the control points closer to the trisection points on the chord. The corresponding distances are good surrogates for the curve deviation from the straight line. This cubic flattening algorithm is somewhat similar to the conic algorithm based the distance from the control point to the middle of the chord. The cubic distances, however, decrease less predictably but are easy enough to calculate on each step. * src/smooth/ftgrays.c (gray_render_cubic): Replace the split condition.
Alexei Podtelezhnikov 80475ede 2019-04-26T21:53:00 [smooth] Bithacks and cosmetics. * src/smooth/ftgrays.c (gray_record_cell, gray_set_cell, gray_hline, gray_render_conic, gray_convert_glyph_inner): Updated.
Alexei Podtelezhnikov 7a81b63a 2019-04-25T22:06:33 Optimize Bézier bisections. * src/raster/ftraster.c (Split_Conic, Split_Cubic): Use shifts and refactor. * src/smooth/ftgrays.c (gray_split_conic, gray_split_cubic): Ditto. * src/base/ftstroke.c (ft_conic_split, ft_cubic_split): Ditto. * src/base/ftbbox.c (cubic_peak): Use shifts.
Alexei Podtelezhnikov 1f271751 2019-04-11T23:48:21 [smooth] Fix segfault in direct mode (#56092). * src/base/ftoutln.c (FT_Outline_Render): Set missing clip_box for direct mode. * src/smooth/ftgrays.c (gray_raster_render): Use it.
Werner Lemberg 75859970 2019-02-23T10:07:09 Update all copyright notices.
Werner Lemberg f686ad46 2019-01-22T20:31:44 Update copyright years.
Werner Lemberg afa043de 2018-12-25T22:44:05 Fix links (mostly http -> https).
Alexei Podtelezhnikov 78db9eec 2018-11-10T15:39:19 [smooth] Placeholder only for library-enabled LCD filtering. * src/smooth/ftsmooth.c (ft_smooth_init): Add disabled `FT_Library_SetLcdFilter' call.
Werner Lemberg 9817571c 2018-10-03T08:04:55 [ftgrays] Fix typo in stand-alone mode (#54771). * src/smooth/ftgrays.c (FT_THROW) [STANDALONE_ && FT_DEBUG_LEVEL_TRACE]: Fix call to `FT_ERR_CAT'.
Alexei Podtelezhnikov 1dacbd89 2018-08-30T23:28:30 Consolidate bitmap presetting and size assessment. * include/freetype/internal/ftobjs.h (ft_glyphslot_preset_bitmap): Change return type. * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Return the bitmap size assessment. * src/raster/ftrend1.c (ft_raster1_render): Use it to refuse the rendering of enourmous or far-fetched outlines. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.
Werner Lemberg a3e842f9 2018-08-22T09:55:38 Minor formatting and documentation fixes.
Werner Lemberg a0dd16fb 2018-08-15T18:13:17 Don't use `trace_' prefix for FT_COMPONENT arguments. * include/freetype/internal/ftdebug.h (FT_TRACE_COMP, FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix. (FT_TRACE): Use `FT_TRACE_COMP'. */* (FT_COMPONENT): Updated.
Alexei Podtelezhnikov e16bfbec 2018-08-09T22:18:00 [raster, smooth] Reinstate bitmap size limits. This again moves outline and bitmap size checks one level up. * src/base/ftoutln.c (FT_Outline_Render): Explicitly reject enormous outlines. * src/raster/ftrend1.c (ft_raster1_render): Reject enormous bitmaps and, therefore, outlines that require them. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. * src/raster/ftraster.c (ft_black_render): Remove outline size checks. * src/smooth/ftgrays.c (gray_raster_render): Ditto. [STANDALONE]: Remove `FT_Outline_Get_CBox' copy.
Werner Lemberg f60c98fe 2018-08-08T18:15:53 [smooth] Improve tracing. * src/smooth/ftgrays.c (gray_convert_glyph_inner): Only use tracing if called the first time. (gray_convert_glyph): Updated.
Alexei Podtelezhnikov 2c3e895c 2018-07-28T22:00:59 [smooth] Fix Harmony memory management. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9501 * src/smooth/ftgrays.c (ft_smooth_render_generic): Restore buffer after each rendering in case of failure.
Werner Lemberg ca4e707a 2018-06-06T08:18:23 [smooth, raster] Limit bitmap size (#54019). * src/raster/ftraster.c [STANDALONE] (FT_Outline_Get_CBox): Add function. [!STANDALONE]: Include FT_OUTLINE_H. (ft_black_render): Compute CBox and reject glyphs larger than 0xFFFF x 0xFFFF. * src/smooth/ftgrays.c (gray_raster_render): Reject glyphs larger than 0xFFFF x 0xFFFF.
Armin Hasitzka 80ac3645 2018-06-03T18:31:58 * src/smooth/ftgrays.c (gray_convert_glyph): Remove unused variables.
Werner Lemberg 9ac9060d 2018-06-03T09:01:17 [GSoC] src/*.*: Convert block comments to `light' style. This monster commit was created by applying Nikhil's scripts `docconverter.py' and `markify.py' to all C header and source files, followed up by minor manual clean-up. No change in functionality, of course. I used commit f7419907bc6044b9b7057f9789866426c804ba82 from https://github.com/nikramakrishnan/freetype-docs.git.
Alexei Podtelezhnikov ae248034 2018-06-02T21:42:44 [smooth] Attempt to mitigate bug #54019. The robust rendering of estra large glyphs came with unbearable cost. The old way of bisecting should fail but fail faster. * src/smooth/ftgrays.c (gray_convert_glyph): Switch back to bisecting in y-direction.
Alexei Podtelezhnikov 7b73cb07 2018-05-24T22:38:24 [smooth] Formalize Harmony LCD rendering. This generalizes magic outline shifts that make Harmony LCD rendering work in terms of precise two-dimensional RGB subpixel positions. These coordinates are now set in time of the `smooth' module initialization and later used to shift a glyph outline for rendering. FT_RENDER_MODE_LCD and FT_RENDER_MODE_LCD_V use the same coordinates. The letter, however, rotates them before using. The LCD bitmap padding is also calculated using these coordinates. * include/freetype/internal/ftobjs.h (FT_LibraryRec): New array field `lcd_geometry'. * src/base/ftlcdfil.c (ft_lcd_padding): Reworked. * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Updated accordingly. * src/smooth/ftsmooth.c [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING] (ft_smooth_init): Initialize `lcd_geometry'. (ft_smooth_render_generic): Formalize outline shifts.
Werner Lemberg 95149592 2018-05-02T20:27:48 Remove FT_CONFIG_OPTION_PIC and related code. */* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this preprocessor symbol. */*: Replace `XXX_GET' macros (which could be either a function in PIC mode or an array in non-PIC mode) with `xxx' arrays. * include/freetype/internal/ftpic.h, src/autofit/afpic.c, src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h, src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h, src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c, src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h, src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c, src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h: Removed.
Werner Lemberg 63aaf89c 2018-02-17T10:34:47 s/sub-pixel/subpixel/.
Werner Lemberg 0a0c2256 2018-01-02T09:33:57 Update copyright year.
Werner Lemberg d21f995a 2017-12-07T14:49:03 Fix C++ compilation. * src/psaux/psauxmod.h: Use FT_CALLBACK_TABLE macro where necessary. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix warning.
Werner Lemberg 71fecc53 2017-12-05T12:06:29 Improve tracing messages by using singular and plural forms. * src/*/*.c: Implement it.
Werner Lemberg 87ddad20 2017-12-04T20:43:30 Update or fix links to use the https protocol instead of http.
Alexei Podtelezhnikov ab6fe076 2017-11-06T21:34:56 * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables.
Alexei Podtelezhnikov 81651636 2017-11-01T22:51:03 [smooth] Fix complex rendering at high ppem. We used to split large glyphs into horizontal bands and continue bisecting them still horizontally if that was not enough. This is guaranteed to fail when a single scanline cannot fit into the rendering memory pool. Now we bisect the bands vertically so that the smallest unit is a column of the band height, which is guranteed to fit into memory. * src/smooth/ftgrays.c (gray_convert_glyph): Implement it.
Alexei Podtelezhnikov 91015cb4 2017-10-21T22:57:43 [smooth] Improve complex rendering at high ppem. At large sizes almost but not exactly horizontal segments can quickly drain the rendering pool. This patch at least avoids filling the pool with trivial cells. Beyond this, we can only increase the pool size. Reported, analyzed, and tested by Colin Fahey. * src/smooth/ftgrays.c (gray_set_cell): Do not record trivial cells.
Alexei Podtelezhnikov 6bea49e0 2017-10-14T22:45:11 [base] Netpbm image tracing. * src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size. (FT_Render_Glyph_Internal): Trace bitmap in Netpbm format. * src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing.
Werner Lemberg 2e58808d 2017-10-05T14:26:33 Fix compiler warnings. * src/cff/cffdrivr.c (cff_ps_get_font_extra): Avoid code that relies on numeric overflow. Add cast. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix variable types, add cast.
Werner Lemberg af03d1ea 2017-10-01T09:23:42 [smooth,type1] Formatting, whitespace.
Alexei Podtelezhnikov c8d8e158 2017-09-30T14:28:58 Signedness fixes in bitmap presetting. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3514. * src/raster/ftrend1.c (ft_raster1_render): Exlicitly signed height. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto. * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Explicitly unsigned subtraction.
Alexei Podtelezhnikov ae7dc1f6 2017-09-28T22:59:31 [smooth, raster] Miscellaneous cleanups. * src/raster/ftrend1.c (ft_raster1_render): Clean up the exit. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Reduce translations and clean up the exit. (ft_smooth_render_lcd, ft_smooth_render_lcd): Remove unused `error'..