1. 16 Aug, 2021 1 commit
  2. 25 Jul, 2021 1 commit
    • Werner Lemberg's avatar
      ChangeLog housekeeping. · ba47af32
      Werner Lemberg authored
      Archive old `ChangeLog` file.
      We no longer write ChangeLog entries manually; instead, the file will be
      created from commit messages (which should be formatted in GNU's ChangeLog
      style) by a call to
        gitlog-to-changelog --format='%B%n'
      or something similar (this script is part of the 'gnulib' repository).
  3. 24 Jul, 2021 4 commits
    • Werner Lemberg's avatar
      Fix some `cppcheck` warnings. · c2fa51d9
      Werner Lemberg authored
      * 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
    • Anurag Thakur's avatar
      * .gitlab-ci.yml: Fixed cmake build, using correct options. · 28c2d7f3
      Anurag Thakur authored and Werner Lemberg's avatar Werner Lemberg committed
    • Anurag Thakur's avatar
      * CMakeLists.txt: Make `cmake` handle disabled dependencies correctly. · 1f742f05
      Anurag Thakur authored and Werner Lemberg's avatar Werner Lemberg committed
      Include 'CMakeDependentOption'.
      Replace `FT_WITH_XXX` options with `FT_DISABLE_XXX` and `FT_REQUIRE_XXX`
      pairs.  Update option logic accordingly.
      Fixes #1066.
    • Ben Wagner's avatar
      [autofit] Split `afwrtsys.h`. · 5bcaf51b
      Ben Wagner authored and Werner Lemberg's avatar Werner Lemberg committed
      The header file `afwrtsys.h` has two distinct functions: to include the
      required writing system headers and also to generate code for each writing
      system.  At each current use site only one or the other is used, with
      various macro trickery selecting one or the other.  Split this header into
      `afws-decl.h` for the required writing system declarations and `afws-iter.h`
      for iterating over the writing systems to generate code.
      The motivation for this change is that the Visual C++ compiler treats the
      standard include guard idiom like `#pragma once` 'if no non-comment code or
      preprocessor directive comes before or after the standard form of the
      idiom'.  It appears to check this after macro expansion, so if
      `WRITING_SYSTEM` expands to empty the bottom of `afwrtsys.h` is empty and
      looks like the standard include guard idiom which is treated like `#pragma
      once`, so subsequent inclusion of `afwrtsys.h` is elided.
      Fixes #1075.
      * src/autofit/afglobal.c (af_writing_system_classes), src/autofit/aftypes.h
      (AF_WritingSystem), src/autofit/rules.mk (AUTOF_DRV_H): Updated.
      * src/autofit/afwrtsys.h: Split into...
      * src/autofit/afws-decl.h, src/autofit/afws-iter.h: New files.
  4. 19 Jul, 2021 1 commit
    • Werner Lemberg's avatar
      * Version 2.11.0 released. · 801cd842
      Werner Lemberg authored
      Tag sources with `VER-2-11-0'.
      * docs/VERSION.TXT: Add entry for version 2.11.0.
      * docs/CHANGES: Updated.
      * README, src/base/ftver.rc, builds/windows/vc2010/index.html,
      builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
      s/2.10.4/2.11.0/, s/2104/2110/.
      * include/freetype/freetype.h (FREETYPE_MINOR): Set to 11.
      (FREETYPE_PATCH): Set to 0.
      * builds/unix/configure.raw (version_info): Set to 24:0:18.
      * CMakeLists.txt (VERSION_MINOR): Set to 11.
      (VERSION_PATCH): Set to 0.
      * builds/toplevel.mk (dist): Ignore more git-related files.
  5. 17 Jul, 2021 2 commits
    • Ben Wagner's avatar
      Document direct header inclusion valid since 2.6.1. · 4082b863
      Ben Wagner authored and Werner Lemberg's avatar Werner Lemberg committed
      Since commit e1339133 'Make macros for header file names optional.' the
      header file layout has become public and using the macro expansions for
      includes is no longer required.  While this happened in 2.10.3, the header
      file layout had not changed since commit 392cf22f 'Another adjustment to
      header locations.' in 2.6.1.  Retroactively make the header file layout
      public back to 2.6.1 to speed adoption.
    • David Turner's avatar
      * src/smooth/ftgrays.c: Fix compilation if `FT_LONG64` is undefined. · 357b353c
      David Turner authored and Werner Lemberg's avatar Werner Lemberg committed
      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.
  6. 16 Jul, 2021 5 commits
  7. 15 Jul, 2021 5 commits
    • Ben Wagner's avatar
      Guard inclusion of emmintrin.h · c37c0873
      Ben Wagner authored
      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's avatar
      [smooth] Implement Bezier quadratic arc flattenning with DDA · 56cc2ad4
      David Turner authored
      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's avatar
      [smooth] Minor speedup to smooth rasterizer · 86b9c934
      David Turner authored
      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
    • David Turner's avatar
      tests/scripts/download-test-fonts.sh rewrite in Python3 · 5ec7f588
      David Turner authored
      Replaces download-test-fonts.sh with download-test-fonts.py
      which does the same work, and also avoids downloading anything
      if the files are already installed with the right content.
      Now uses the first 8 byte of each file's sha256 hash for the
    • Alexander Richardson's avatar
      Support architectures where `long` is smaller than pointers. · f7c6a06c
      Alexander Richardson authored and Werner Lemberg's avatar Werner Lemberg committed
      I am currently trying to compile FreeType for CHERI-extended ISAs
      (CHERI-RISC-V and Arm's Morello), but I am getting compiler warnings
      from the `FT_UINT_TO_POINTER` macro.  When compiling with the CHERI
      Clang compiler, not using `uinptr_t` for casts between integers an
      pointers results in the following `-Werror` build failures:
      In file included from .../src/truetype/truetype.c:22:
        .../src/truetype/ttgload.c:1925:22: error:
          cast from provenance-free integer type to pointer type will
          give pointer that can not be dereferenced
        node->data = FT_UINT_TO_POINTER( glyph_index );
        .../include/freetype/internal/compiler-macros.h:79:34: note:
          expanded from macro 'FT_UINT_TO_POINTER'
      * include/freetype/internal/compiler-macros.h (FT_UINT_TO_POINTER):
      The ISO C standard compliant fix for this would be to use
      `uintptr_t` from `stdint.h`, but I am not sure if this is supported
      by the minimum compiler version.  Therefore, use the
      compiler-defined `__UINTPTR_TYPE__` macro (supported in GCC 4.6+ and
      Clang since about 3.0) before checking for `_WIN64` and falling back
      to `unsigned long`.
  8. 13 Jul, 2021 3 commits
    • Oleg Oshmyan's avatar
      [base] Fix `FT_Open_Face`'s handling of user-supplied streams. · 5d27b10f
      Oleg Oshmyan authored and Werner Lemberg's avatar Werner Lemberg committed
      This was already true (though undocumented) most of the time, but
      not if `FT_NEW` inside `FT_Stream_New` failed or if the
      `FT_OPEN_XXX` flags were bad.
      Normally, `FT_Open_Face` calls `FT_Stream_New`, which returns the
      user-supplied stream unchanged, and in case of any subsequent error
      in `FT_Open_Face`, the stream is closed via `FT_Stream_Free`.
      Up to now, however, `FT_Stream_New` allocates a new stream even if
      it is already given one by the user.  If this allocation fails, the
      user-supplied stream is not returned to `FT_Open_Face` and never
      closed.  Moreover, the user cannot detect this situation: all they
      see is that `FT_Open_Face` returns `FT_Err_Out_Of_Memory`, but that
      can also happen after a different allocation fails within the main
      body of `FT_Open_Face`, when the user's stream has already been
      closed by `FT_Open_Face`.  It is plausible that the user stream's
      `close` method frees memory allocated for the stream object itself,
      so the user cannot defensively free it upon `FT_Open_Face` failure
      lest it ends up doubly freed.  All in all, this ends up leaking the
      memory/resources used by user's stream.
      Furthermore, `FT_Stream_New` simply returns an error if the
      `FT_OPEN_XXX` flags are unsupported, which can mean either an
      invalid combination of flags or a perfectly innocent
      `FT_OPEN_STREAM` on a FreeType build that lacks stream support.
      With this patch, the user-supplied stream is closed even in these
      cases, so the user can be sure that if `FT_Open_Face` failed, the
      stream is definitely closed.
      * src/base/ftobjs.c (FT_Stream_New): Don't allocate a buffer
      Move error-handling code to make the control flow more obvious.
      Close user-supplied stream if the flags are unsupported.
      `FT_Stream_Open` always sets `pathname.pointer`, so remove the
      redundant (re)assignment.  None of the `FT_Stream_Open...` functions
      uses `stream->memory`, so keep just one assignment at the end,
      shared among all possible control flow paths.
      ('Unsupported flags' that may need a stream closure can be either an
      invalid combination of multiple `FT_OPEN_XXX` mode flags or a clean
      `FT_OPEN_STREAM` flag on a FreeType build that lacks stream
    • Oleg Oshmyan's avatar
      [base] Reject combinations of incompatible `FT_OPEN_XXX` flags. · a4c8f21a
      Oleg Oshmyan authored and Werner Lemberg's avatar Werner Lemberg committed
      The three modes are mutually exclusive, and the documentation of the
      `FT_OPEN_XXX` constants notes this.  However, there was no check to
      validate this in the code, and the documentation on `FT_Open_Args`
      claimed that the corresponding bits were checked in a well-defined
      order, implying it was valid (if useless) to specify more than one.
      Ironically, this documented order did not agree with the actual
      code, so it could not be relied upon; hopefully, nobody did this and
      nobody will be hurt by the new validation.
      Even if multiple mode bits were allowed, they could cause memory
      leaks: if both `FT_OPEN_STREAM` and `stream` are set along with
      either `FT_OPEN_MEMORY` or `FT_OPEN_PATHNAME`, then `FT_Stream_New`
      allocated a new stream but `FT_Open_Face` marked it as an 'external'
      stream, so the stream object was never released.
      * src/base/ftobjs.c (FT_Stream_New): Reject incompatible
      `FT_OPEN_XXX` flags.
    • Anuj Verma's avatar
      [sdf] Improve documentation. · e592982a
      Anuj Verma authored and Werner Lemberg's avatar Werner Lemberg committed
  9. 12 Jul, 2021 7 commits
  10. 05 Jul, 2021 2 commits
  11. 03 Jul, 2021 3 commits
  12. 01 Jul, 2021 3 commits
    • Ben Wagner's avatar
      * src/truetype/ttgxvar.c (tt_set_mm_blend): Test `coords`. · d3dc2da9
      Ben Wagner authored and Werner Lemberg's avatar Werner Lemberg committed
      It is undefined behavior to pass `NULL` to `memcpy`.  `coords' is
      passed to `memcpy` but `TT_Get_MM_Blend` and `TT_Get_Var_Design`
      explictly call `tt_set_mm_blend` with `coords` as `NULL`.  In
      addition, `TT_Set_MM_Blend` has a similar possible issue.
    • Dominik Röttsches's avatar
      [sfnt] Support PaintScale in 'COLR' v1 parsing. · 286da6c5
      Dominik Röttsches authored and Werner Lemberg's avatar Werner Lemberg committed
      * include/freetype/ftcolor.h (FT_PaintFormat): Renumber values, add
      (FT_PaintScale): New structure to represent 'PaintScale*' tables.
      (FT_COLR_Paint): Updated.
      * src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration.
      (read_paint): Parse 'PaintScale' and friends.
    • Dominik Röttsches's avatar
      [sfnt] Handle fonts without layer list in 'COLR' v1. · 0348c627
      Dominik Röttsches authored and Werner Lemberg's avatar Werner Lemberg committed
      'COLR' v1 fonts do not necessarily need to have a layer list; for
      this reason, 'fontTools' recently started generating fonts in a way
      that drops the layer list if there are no layers in it.  This
      results in the layer list offset becoming zero, which FreeType
      treated as an invalid table.  Fix that and handle the case for layer
      list offset being 0.  This slightly changes how we need to calculate
      the starting offset for paints.
      * src/sfnt/ttcolr.c (tt_face_load_colr): Handle case of layer list
      offset being zero without outright rejecting table.
  13. 30 Jun, 2021 3 commits