Page MenuHome

Freetype 2.11.0 with woff2 support
ClosedPublic

Authored by Ray Molenkamp (LazyDodo) on Dec 2 2021, 3:03 AM.

Details

Summary

The UI team requested adding woff2 support to freetype.

This requires one new extra compression library (brotli)

These are the builder changes, for windows this requires
one small tweak in platform_win32.cmake which I will land
when I land the SVN libraries.

Builds and links with blender on windows, freetype builds
on linux with woff2 support (but may need small tweaks on
linux for linking) have not tested with blender, have not
tested mac.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D13448 (branched from master)
Build Status
Buildable 19943
Build 19943: arc lint + arc unit

Event Timeline

Ray Molenkamp (LazyDodo) requested review of this revision.Dec 2 2021, 3:03 AM
Ray Molenkamp (LazyDodo) created this revision.

i'd like to still get this in before the end of bcon2, if you two could find some time, that be great

you can find a sample font over at https://fonts.googleapis.com/css?family=Karla

Harvest libraries for macOS and Linux.

Shall we treat this similar to e.g. FFMPEG dependencies?

  • For precompiled libraries, put dependencies in FREETYPE_LIBRARIES
  • For system libraries, assumed it's a shared library and nothing needs to be done

1diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
2index 2bfdc84..443e416 100644
3--- a/build_files/cmake/platform/platform_apple.cmake
4+++ b/build_files/cmake/platform/platform_apple.cmake
5@@ -167,6 +167,10 @@ if(WITH_FFTW3)
6 endif()
7
8 find_package(Freetype REQUIRED)
9+set(FREETYPE_LIBRARIES
10+ ${FREETYPE_LIBRARIES}
11+ ${LIBDIR}/brotli/lib/libbrotlicommon-static.a
12+ ${LIBDIR}/brotli/lib/libbrotlidec-static.a)
13
14 if(WITH_IMAGE_OPENEXR)
15 find_package(OpenEXR)
16diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
17index e83eba7..77a519c 100644
18--- a/build_files/cmake/platform/platform_win32.cmake
19+++ b/build_files/cmake/platform/platform_win32.cmake
20@@ -347,7 +347,7 @@ set(FREETYPE_INCLUDE_DIRS
21 ${LIBDIR}/freetype/include
22 ${LIBDIR}/freetype/include/freetype2
23 )
24-set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
25+set(FREETYPE_LIBRARIES ${LIBDIR}/freetype/lib/freetype2ST.lib)
26 windows_find_package(freetype REQUIRED)
27
28 if(WITH_FFTW3)
29diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt
30index 37bb003..acd0da8 100644
31--- a/intern/ghost/test/CMakeLists.txt
32+++ b/intern/ghost/test/CMakeLists.txt
33@@ -292,7 +292,7 @@ target_link_libraries(multitest_c
34 guardedalloc_lib
35 wcwidth_lib
36 ${OPENGL_gl_LIBRARY}
37- ${FREETYPE_LIBRARY}
38+ ${FREETYPE_LIBRARIES}
39 ${ZLIB_LIBRARIES}
40 ${CMAKE_DL_LIBS}
41 ${PLATFORM_LINKLIBS}
42diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
43index cc6e298..b1453b2 100644
44--- a/source/blender/blenfont/CMakeLists.txt
45+++ b/source/blender/blenfont/CMakeLists.txt
46@@ -54,7 +54,7 @@ set(LIB
47 bf_gpu
48 bf_intern_guardedalloc
49
50- ${FREETYPE_LIBRARY}
51+ ${FREETYPE_LIBRARIES}
52 )
53
54 if(WIN32)
55diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
56index c7e3a99..2d79d923 100644
57--- a/source/blender/blenkernel/CMakeLists.txt
58+++ b/source/blender/blenkernel/CMakeLists.txt
59@@ -513,7 +513,7 @@ set(LIB
60 bf_simulation
61
62 # For `vfontdata_freetype.c`.
63- ${FREETYPE_LIBRARY}
64+ ${FREETYPE_LIBRARIES}
65 )
66
67 if(WITH_BINRELOC)

Also, I had to open that example font link in Chrome for it give me a .woff2 file, in Firefox it was a .woff file.

This revision is now accepted and ready to land.Jan 12 2022, 6:00 PM

Shall we treat this similar to e.g. FFMPEG dependencies?

  • For precompiled libraries, put dependencies in FREETYPE_LIBRARIES
  • For system libraries, assumed it's a shared library and nothing needs to be done

Sounds good, but lets land a change first that changes it from FREETYPE_LIBRARY -> FREETYPE_LIBRARIES with no further changes (ie not adding the brotli libs just yet) that way we don't have the coordinate 3 platforms landing simultaneously and platform devs can just update their platform file when they land the svn libs.

Use FREETYPE_LIBRARIES instead of FREETYPE_LIBRARY.

phab won't let me accept my own review, but LGTM , this can land as far as i'm concerned

  • Merge remote-tracking branch 'origin/master' into arcpatch-D13448