Update the vendored FreeType version to 2.13.3#1543
Conversation
The existing version (2.7.1) is using an ancient zlib version, which fails to build with modern Xcode tools on macOS. Fixes solvespace#1539
e4b6b12 to
c3926d0
Compare
|
Had to force push because I didn't have a way to test this before pushing, and apparently the name of the configuration variables to disable dependencies changed between the versions (and Brotli was added as well). What's weird though, is that we were already using Because we build our vendored zlib and libpng anyway, there's no point in disabling their build, so I didn't include them in the list of dependencies to disable. Since they're included and found earlier, CMake picks our versions and statically links them. |
| WITH_HarfBuzz OFF | ||
| FT_DISABLE_BZIP2 ON | ||
| FT_DISABLE_HARFBUZZ ON | ||
| FT_DISABLE_BROTLI ON |
There was a problem hiding this comment.
| FT_DISABLE_BROTLI ON | |
| FT_DISABLE_BROTLI ON | |
| FT_DISABLE_PNG ON | |
| FT_DISABLE_ZLIB ON |
We should disable PNG - as it was before.
And I do not see why not to FT_DISABLE_ZLIB=ON - it disables the system ZLIB and uses the internal one anyway.
There was a problem hiding this comment.
I'm fine with disabling libpng (which disables support of PNG compressed OpenType embedded bitmaps), although we build it anyway as a direct dependency of SolveSpace, so I'm not sure why we would want to prevent FreeType from using it.
As for zlib, "system" is a bit confusing here. When disabling zlib it does not use the zlib that we build as a direct dependency of SolveSpace, but rather the copy of zlib vendored in FreeType, so we just end up with two copies of zlib in the binary, each from a different version. Without disabling it, CMake ends up using the SolveSpace zlib that we introduce into the build before adding FreeType, so we have only a single version of zlib in the binary.
There was a problem hiding this comment.
so I'm not sure why we would want to prevent FreeType from using it.
I'm not sure what "PNG compressed OpenType embedded bitmaps." are but I presume that since they are bitmaps they would be useless for the text feature of SolveSpace, which uses only the curves from the fonts.
However enabling the option causes the EXE (Windows 32 bit build with MSVC 2019 with LTO) size to decrease for me:
FT_DISABLE_PNG ON:
5.93 MB (6,218,752 bytes)
FT_DISABLE_PNG OFF:
5.92 MB (6,208,512 bytes)
WTF?!
The FT_DISABLE_ZLIB option does not influence the EXE size. So let us leave them as you configured them.
There was a problem hiding this comment.
Weird. On Linux I see the reverse (when forcing building with vendored zlib, libpng, and freetype, and with cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LTO=1 -DENABLE_SANITIZERS=0):
$ ls -ln --time-style=+"" bin/solvespace
-rwxr-xr-x 1 1000 1000 52871080 bin/solvespace
$ ls -ln --time-style=+"" ../solvespace-png
-rwxr-xr-x 1 1000 1000 52884800 ../solvespace-png
I'll try to boot into Windows and check what's happening there when I have some time.
There was a problem hiding this comment.
Same result, though to a bit lesser extent, with -DCMAKE_BUILD_TYPE=Release:
$ ls -ln --time-style=+"" bin/solvespace
-rwxr-xr-x 1 1000 1000 5290248 bin/solvespace
$ ls -ln --time-style=+"" ../solvespace-png
-rwxr-xr-x 1 1000 1000 5294640 ../solvespace-png
And after strip -g:
$ ls -ln --time-style=+"" bin/solvespace
-rwxr-xr-x 1 1000 1000 5287192 bin/solvespace
$ ls -ln --time-style=+"" ../solvespace-png
-rwxr-xr-x 1 1000 1000 5291592 ../solvespace-png
There was a problem hiding this comment.
@ruevs I'm having trouble reproducing your results on Windows (Visual Studio 2022, with -DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=1):
>dir /c bin\solvespace.exe ..\solvespace-png.exe
8,433,152 solvespace.exe
1 File(s) 8,433,152 bytes
8,436,224 solvespace-png.exe
1 File(s) 8,436,224 bytes
Given the fact that as you noted embedded bitmaps support is unneeded, and that on both Windows and Linux I see an increase in file size of 3-4KB, it's probably best if we disable libpng support in FreeType. Should I submit a PR?
It is a bit obscure, but it is used in the CMake loop here to find the package. |
|
Accidentally closed this. Sorry for the noise. |
Makes the executable a bit smaller and we have no use for them anyway. https://learn.microsoft.com/en-us/typography/opentype/spec/cbdt#compressed-color-bitmaps See #1543 for discussion.
Makes the executable a bit smaller and we have no use for them anyway. https://learn.microsoft.com/en-us/typography/opentype/spec/cbdt#compressed-color-bitmaps See solvespace#1543 for discussion.
Makes the executable a bit smaller and we have no use for them anyway. https://learn.microsoft.com/en-us/typography/opentype/spec/cbdt#compressed-color-bitmaps See solvespace#1543 for discussion.

The existing version (2.7.1) is using an ancient zlib version, which fails to build with modern Xcode tools on macOS.
Fixes #1539