diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66a59375e4..2074c92a34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: fmt_ver: 7.1.0 pybind11_ver: v2.7.0 setenvs: export PUGIXML_VERSION=v1.9 WEBP_VERSION=v1.1.0 USE_OPENVDB=0 + FREETYPE_VERSION=VER-2-10-0 - desc: clang10/C++17 avx2 exr3.1 ocio2.0 nametag: linux-clang10-cpp14 runner: ubuntu-latest @@ -60,6 +61,7 @@ jobs: simd: "avx2,f16c" fmt_ver: 8.1.1 setenvs: export USE_OPENVDB=0 + FREETYPE_VERSION=VER-2-11-0 - desc: gcc9/C++17 py39 exr3.1 ocio2.1 nametag: linux-vfx2022 runner: ubuntu-latest @@ -70,6 +72,7 @@ jobs: simd: "avx2,f16c" fmt_ver: 8.1.1 pybind11_ver: v2.9.0 + setenvs: export FREETYPE_VERSION=VER-2-12-0 - desc: clang13/C++17 py39 avx2 exr3.1 ocio2.1 nametag: linux-vfx2022-clang13 runner: ubuntu-latest @@ -82,6 +85,7 @@ jobs: simd: "avx2,f16c" fmt_ver: 9.1.0 pybind11_ver: v2.8.1 + setenvs: export FREETYPE_VERSION=VER-2-12-0 - desc: icc/C++17 py3.9 exr3.1 ocio2.1 qt5.15 nametag: linux-vfx2022-icc runner: ubuntu-latest @@ -95,6 +99,7 @@ jobs: pybind11_ver: v2.9.0 setenvs: export USE_ICC=1 USE_OPENVDB=0 OIIO_EXTRA_CPP_ARGS="-fp-model=precise" + FREETYPE_VERSION=VER-2-13-0 # For icc, use fp-model precise to eliminate needless LSB errors # that make test results differ from other platforms. - desc: icx/C++17 py3.9 exr3.1 ocio2.1 qt5.15 @@ -163,6 +168,7 @@ jobs: USE_JPEGTURBO=0 USE_OPENCOLORIO=0 USE_OPENCV=0 + FREETYPE_VERSION=VER-2-10-0 depcmds: sudo rm -rf /usr/local/include/OpenEXR # Test ABI stability. `abi_check` is the version or commit that we @@ -183,7 +189,7 @@ jobs: # abi_check: v2.6.2.0 abi_check: e83cd7c44916105034f2d539a5e55a6c6f178a7f setenvs: export OIIO_CMAKE_FLAGS="-DOIIO_BUILD_TOOLS=0 -DOIIO_BUILD_TESTS=0 -DUSE_PYTHON=0" - USE_OPENCV=0 USE_FFMPEG=0 USE_PYTHON=0 + USE_OPENCV=0 USE_FFMPEG=0 USE_PYTHON=0 USE_FREETYPE=0 CMAKE_BUILD_TYPE=RelWithDebInfo runs-on: ${{ matrix.runner }} @@ -294,6 +300,7 @@ jobs: PUGIXML_VERSION=v1.14 USE_OPENVDB=0 WEBP_VERSION=v1.3.0 + FREETYPE_VERSION=VER-2-13-2 # The installed OpenVDB has a TLS conflict with Python 3.8 - desc: bleeding edge gcc14 C++20 py3.12 OCIO/libtiff/exr-master avx2 nametag: linux-bleeding-edge @@ -320,6 +327,7 @@ jobs: PIP_INSTALLS="none" USE_OPENVDB=0 SKIP_APT_GET_UPDATE=1 + FREETYPE_VERSION=master # The installed OpenVDB has a TLS conflict with Python 3.8 # Disabling the `apt-get update` in gh-installdeps.bash # addresses a job killing problem in the GHA Ubuntu diff --git a/CHANGES.md b/CHANGES.md index 4e467e8628..1969d5beb9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Release 2.6 (Fall 2024) -- compared to 2.5 * *OpenVDB*: Raise OpenVDB minimum to 9.0 [#4218](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4218) (2.6.2.0) * *LibRaw*: Raise minimum LibRaw to 0.20 (from 0.18) [#4217](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4217) (2.6.2.0) * *Boost*: Is no longer a dependency! [#4191](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4191) (by Christopher Kulla) [#4221](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4221) (by Christopher Kulla) [#4222](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4222) [#4233](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4233) (2.6.2.0) +* *Freetype*: minimum raised to 2.10 (from no previously stated minimum, but we had been testing as far back as 2.8). ### ⛰️ New features and public API changes: diff --git a/INSTALL.md b/INSTALL.md index 5413a51f1e..12d96bbd89 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -71,7 +71,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**. * If you want support for Ptex: * Ptex >= 2.3.1 (probably works for older; tested through 2.4.2) * If you want to be able to do font rendering into images: - * Freetype (minimum unknown, tested 2.8 through 2.13) + * **Freetype >= 2.10.0** (tested through 2.13) * We use PugiXML for XML parsing. There is a version embedded in the OIIO tree, but if you want to use an external, system-installed version (as may be required by some software distributions with policies against diff --git a/src/build-scripts/build_Freetype.bash b/src/build-scripts/build_Freetype.bash new file mode 100755 index 0000000000..f14c351051 --- /dev/null +++ b/src/build-scripts/build_Freetype.bash @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Utility script to download and build Freetype +# +# Copyright Contributors to the OpenImageIO project. +# SPDX-License-Identifier: Apache-2.0 +# https://github.com/AcademySoftwareFoundation/OpenImageIO + +# Exit the whole script if any command fails. +set -ex + +# Repo and branch/tag/commit of Freetype to download if we don't have it yet +FREETYPE_REPO=${FREETYPE_REPO:=https://github.com/freetype/freetype.git} +FREETYPE_VERSION=${FREETYPE_VERSION:=VER-2-13-2} + +# Where to put Freetype repo source (default to the ext area) +LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext} +FREETYPE_SRC_DIR=${FREETYPE_SRC_DIR:=${LOCAL_DEPS_DIR}/Freetype} +FREETYPE_BUILD_DIR=${FREETYPE_BUILD_DIR:=${FREETYPE_SRC_DIR}/build} +FREETYPE_INSTALL_DIR=${FREETYPE_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist} +FREETYPE_BUILD_TYPE=${FREETYPE_BUILD_TYPE:=Release} + +pwd +echo "Freetype install dir will be: ${FREETYPE_INSTALL_DIR}" + +mkdir -p ./ext +pushd ./ext + +# Clone Freetype project from GitHub and build +if [[ ! -e ${FREETYPE_SRC_DIR} ]] ; then + echo "git clone ${FREETYPE_REPO} ${FREETYPE_SRC_DIR}" + git clone ${FREETYPE_REPO} ${FREETYPE_SRC_DIR} +fi +cd ${FREETYPE_SRC_DIR} + +echo "git checkout ${FREETYPE_VERSION} --force" +git checkout ${FREETYPE_VERSION} --force + +if [[ -z $DEP_DOWNLOAD_ONLY ]]; then + time cmake -S . -B ${FREETYPE_BUILD_DIR} \ + -DCMAKE_BUILD_TYPE=${FREETYPE_BUILD_TYPE} \ + -DBUILD_SHARED_LIBS=${FREETYPE_BUILD_SHARED_LIBS:-ON} \ + -DCMAKE_INSTALL_PREFIX=${FREETYPE_INSTALL_DIR} \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + ${FREETYPE_CONFIG_OPTS} + time cmake --build ${FREETYPE_BUILD_DIR} --config ${FREETYPE_BUILD_TYPE} --target install +fi + +# ls -R ${FREETYPE_INSTALL_DIR} +popd + + +# Set up paths. These will only affect the caller if this script is +# run with 'source' rather than in a separate shell. +export Freetype_ROOT=$FREETYPE_INSTALL_DIR + diff --git a/src/build-scripts/gh-installdeps.bash b/src/build-scripts/gh-installdeps.bash index 011320e123..2ac6d6bce4 100755 --- a/src/build-scripts/gh-installdeps.bash +++ b/src/build-scripts/gh-installdeps.bash @@ -24,6 +24,9 @@ if [[ "$ASWF_ORG" != "" ]] ; then if [[ "${USE_FFMPEG}" != "0" ]] ; then sudo yum install -y ffmpeg ffmpeg-devel && true fi + if [[ "${USE_FREETYPE:-1}" != "0" ]] ; then + sudo yum install -y freetype freetype-devel && true + fi if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then time sudo yum install -y ${EXTRA_DEP_PACKAGES} fi @@ -204,6 +207,10 @@ if [[ "$LIBJPEGTURBO_VERSION" != "" ]] ; then source src/build-scripts/build_libjpeg-turbo.bash fi +if [[ "$FREETYPE_VERSION" != "" ]] ; then + source src/build-scripts/build_Freetype.bash +fi + if [[ "$USE_ICC" != "" ]] ; then # We used gcc for the prior dependency builds, but use icc for OIIO itself echo "which icpc:" $(which icpc) diff --git a/src/cmake/build_Freetype.cmake b/src/cmake/build_Freetype.cmake new file mode 100644 index 0000000000..ff70e7f18f --- /dev/null +++ b/src/cmake/build_Freetype.cmake @@ -0,0 +1,40 @@ +# Copyright Contributors to the OpenImageIO project. +# SPDX-License-Identifier: Apache-2.0 +# https://github.com/AcademySoftwareFoundation/OpenImageIO + +###################################################################### +# Freetype by hand! +###################################################################### + +set_cache (Freetype_BUILD_VERSION 2.13.2 "Freetype version for local builds") +set (Freetype_GIT_REPOSITORY "https://github.com/freetype/freetype") +set (Freetype_GIT_TAG "VER-2-13-2") +set_cache (Freetype_BUILD_SHARED_LIBS OFF + DOC "Should a local Freetype build, if necessary, build shared libraries" ADVANCED) +# We would prefer to build a static Freetype, but haven't figured out how to make +# it all work with the static dependencies, it just makes things complicated +# downstream. + +string (MAKE_C_IDENTIFIER ${Freetype_BUILD_VERSION} Freetype_VERSION_IDENT) + +build_dependency_with_cmake(Freetype + VERSION ${Freetype_BUILD_VERSION} + GIT_REPOSITORY ${Freetype_GIT_REPOSITORY} + GIT_TAG ${Freetype_GIT_TAG} + CMAKE_ARGS + -D BUILD_SHARED_LIBS=${Freetype_BUILD_SHARED_LIBS} + -D CMAKE_POSITION_INDEPENDENT_CODE=ON + -D CMAKE_INSTALL_LIBDIR=lib + ) + +# Set some things up that we'll need for a subsequent find_package to work + +set (Freetype_ROOT ${Freetype_LOCAL_INSTALL_DIR}) + +# Signal to caller that we need to find again at the installed location +set (Freetype_REFIND TRUE) +set (Freetype_REFIND_ARGS CONFIG) + +if (Freetype_BUILD_SHARED_LIBS) + install_local_dependency_libs (Freetype Freetype) +endif () diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake index c7bb4f1d0c..b741b045d9 100644 --- a/src/cmake/externalpackages.cmake +++ b/src/cmake/externalpackages.cmake @@ -122,7 +122,8 @@ if (NOT BZIP2_FOUND) endif () checked_find_package (Freetype - DEFINITIONS USE_FREETYPE=1 ) + VERSION_MIN 2.10.0 + DEFINITIONS USE_FREETYPE=1 ) checked_find_package (OpenColorIO VERSION_MIN 1.1 diff --git a/src/fonts/CMakeLists.txt b/src/fonts/CMakeLists.txt index e55c505e64..a74b47646c 100644 --- a/src/fonts/CMakeLists.txt +++ b/src/fonts/CMakeLists.txt @@ -4,7 +4,7 @@ file (GLOB public_fonts "*/*.ttf") -if (INSTALL_FONTS AND FREETYPE_FOUND) +if (INSTALL_FONTS AND (Freetype_FOUND OR FREETYPE_FOUND)) install (FILES ${public_fonts} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/fonts/OpenImageIO COMPONENT fonts) diff --git a/testsuite/oiiotool-subimage/ref/out-oldfreetype.txt b/testsuite/oiiotool-subimage/ref/out-oldfreetype.txt deleted file mode 100644 index 01adc8434e..0000000000 --- a/testsuite/oiiotool-subimage/ref/out-oldfreetype.txt +++ /dev/null @@ -1,100 +0,0 @@ -Reading gpgr.exr -gpgr.exr : 64 x 64, 3 channel, half openexr - 4 subimages: 64x64 [h,h,h], 64x64 [h,h,h], 64x64 [h,h,h], 64x64 [h,h,h] - subimage 0: 64 x 64, 3 channel, half openexr - SHA-1: 0C27059220A256F197900FB4EB8C7CF63349A26B - channel list: R, G, B - Beatle: "John" - compression: "zip" - name: "layerA" - PixelAspectRatio: 1 - screenWindowCenter: 0, 0 - screenWindowWidth: 1 - oiio:ColorSpace: "Linear" - oiio:subimagename: "layerA" - oiio:subimages: 4 - openexr:chunkCount: 4 - subimage 1: 64 x 64, 3 channel, half openexr - SHA-1: 0E19BEFEF868E356A6A4C6450DA9A7B17DD11E12 - channel list: R, G, B - Beatle: "Paul" - compression: "zip" - name: "layerB" - PixelAspectRatio: 1 - screenWindowCenter: 0, 0 - screenWindowWidth: 1 - oiio:ColorSpace: "Linear" - oiio:subimagename: "layerB" - oiio:subimages: 4 - openexr:chunkCount: 4 - subimage 2: 64 x 64, 3 channel, half openexr - SHA-1: CFAF4AFC253320AC35B8E9014C6D750768354059 - channel list: R, G, B - Beatle: "George" - compression: "zip" - name: "layerC" - PixelAspectRatio: 1 - screenWindowCenter: 0, 0 - screenWindowWidth: 1 - oiio:ColorSpace: "Linear" - oiio:subimagename: "layerC" - oiio:subimages: 4 - openexr:chunkCount: 4 - subimage 3: 64 x 64, 3 channel, half openexr - SHA-1: 5FFA4616F46509627873D2C53744E47E2F492719 - channel list: R, G, B - Beatle: "Ringo" - compression: "zip" - name: "layerD" - PixelAspectRatio: 1 - screenWindowCenter: 0, 0 - screenWindowWidth: 1 - oiio:ColorSpace: "Linear" - oiio:subimagename: "layerD" - oiio:subimages: 4 - openexr:chunkCount: 4 -Reading mip4.tif -mip4.tif : 64 x 64, 4 channel, uint8 tiff - SHA-1: 36CE573A20E682720B020FC689E2067579DE5B37 - channel list: R, G, B, A - tile size: 64 x 64 - compression: "zip" - DocumentName: "g.tif" - fovcot: 1 - Orientation: 1 (normal) - PixelAspectRatio: 1 - planarconfig: "contig" - ResolutionUnit: "in" - wrapmodes: "black,black" - XResolution: 72 - YResolution: 72 - oiio:BitsPerSample: 8 - tiff:Compression: 8 - tiff:PhotometricInterpretation: 2 - tiff:PlanarConfiguration: 1 -../common/textures/grid.tx : 1024 x 1024, 4 channel, uint8 tiff (+mipmap) - SHA-1: 7DB3F1E464C5F38CAAECE8ABC8684EC66FC9FA68 -unmip.tif : 1024 x 1024, 4 channel, uint8 tiff - SHA-1: 7DB3F1E464C5F38CAAECE8ABC8684EC66FC9FA68 -Select nonexistent subimage -oiiotool ERROR: --subimage : Invalid -subimage (13): subimages-4.exr has 4 subimages -Full command line was: -> oiiotool -echo "Select nonexistent subimage" subimages-4.exr --subimage 13 -o subimage13.exr -Select nonexistent MIP level -oiiotool ERROR: --selectmip : Selecting MIP level 14 of subimage 0, which has only 11 MIP levels -Full command line was: -> oiiotool -echo "Select nonexistent MIP level" ../common/textures/grid.tx --selectmip 14 -o mip14.tif -Comparing "subimages-2.exr" and "ref/subimages-2.exr" -PASS -Comparing "subimages-4.exr" and "ref/subimages-4-freetype2.7.exr" -PASS -Comparing "subimage1.exr" and "ref/subimage1.exr" -PASS -Comparing "subimage2.exr" and "ref/subimage2.exr" -PASS -Comparing "subimageD3.exr" and "ref/subimageD3-freetype2.7.exr" -PASS -Comparing "subimageB1.exr" and "ref/subimageB1-freetype2.7.exr" -PASS -Comparing "mip4.tif" and "ref/mip4.tif" -PASS diff --git a/testsuite/oiiotool-subimage/ref/subimageB1-freetype2.6.5.exr b/testsuite/oiiotool-subimage/ref/subimageB1-freetype2.6.5.exr deleted file mode 100644 index 8a474da08f..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimageB1-freetype2.6.5.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimageB1-freetype2.7.exr b/testsuite/oiiotool-subimage/ref/subimageB1-freetype2.7.exr deleted file mode 100644 index e80b9dbc59..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimageB1-freetype2.7.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimageB1-oldfreetype.exr b/testsuite/oiiotool-subimage/ref/subimageB1-oldfreetype.exr deleted file mode 100644 index 854c2a53b3..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimageB1-oldfreetype.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimageB1.exr b/testsuite/oiiotool-subimage/ref/subimageB1.exr index 814b5e3f3b..e80b9dbc59 100644 Binary files a/testsuite/oiiotool-subimage/ref/subimageB1.exr and b/testsuite/oiiotool-subimage/ref/subimageB1.exr differ diff --git a/testsuite/oiiotool-subimage/ref/subimageD3-freetype2.7.exr b/testsuite/oiiotool-subimage/ref/subimageD3-freetype2.7.exr deleted file mode 100644 index eb312e6152..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimageD3-freetype2.7.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimageD3-oldfreetype.exr b/testsuite/oiiotool-subimage/ref/subimageD3-oldfreetype.exr deleted file mode 100644 index a9247a0467..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimageD3-oldfreetype.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimageD3.exr b/testsuite/oiiotool-subimage/ref/subimageD3.exr index 9b7854fec7..eb312e6152 100644 Binary files a/testsuite/oiiotool-subimage/ref/subimageD3.exr and b/testsuite/oiiotool-subimage/ref/subimageD3.exr differ diff --git a/testsuite/oiiotool-subimage/ref/subimages-4-freetype2.6.5.exr b/testsuite/oiiotool-subimage/ref/subimages-4-freetype2.6.5.exr deleted file mode 100644 index d9c1436356..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimages-4-freetype2.6.5.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimages-4-freetype2.7.exr b/testsuite/oiiotool-subimage/ref/subimages-4-freetype2.7.exr deleted file mode 100644 index ef1e1ac69b..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimages-4-freetype2.7.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimages-4-oldfreetype.exr b/testsuite/oiiotool-subimage/ref/subimages-4-oldfreetype.exr deleted file mode 100644 index 0dda779ea4..0000000000 Binary files a/testsuite/oiiotool-subimage/ref/subimages-4-oldfreetype.exr and /dev/null differ diff --git a/testsuite/oiiotool-subimage/ref/subimages-4.exr b/testsuite/oiiotool-subimage/ref/subimages-4.exr index 868829cc28..ef1e1ac69b 100644 Binary files a/testsuite/oiiotool-subimage/ref/subimages-4.exr and b/testsuite/oiiotool-subimage/ref/subimages-4.exr differ diff --git a/testsuite/texture-udim/ref/out-oldfreetype.tif b/testsuite/texture-udim/ref/out-oldfreetype.tif deleted file mode 100644 index 5cd50d3aef..0000000000 Binary files a/testsuite/texture-udim/ref/out-oldfreetype.tif and /dev/null differ diff --git a/testsuite/texture-udim/ref/out2-oldfreetype.tif b/testsuite/texture-udim/ref/out2-oldfreetype.tif deleted file mode 100644 index 5cd50d3aef..0000000000 Binary files a/testsuite/texture-udim/ref/out2-oldfreetype.tif and /dev/null differ diff --git a/testsuite/texture-udim2/ref/out-oldfreetype.tif b/testsuite/texture-udim2/ref/out-oldfreetype.tif deleted file mode 100644 index 606021e46c..0000000000 Binary files a/testsuite/texture-udim2/ref/out-oldfreetype.tif and /dev/null differ diff --git a/testsuite/texture-udim2/ref/out2-oldfreetype.tif b/testsuite/texture-udim2/ref/out2-oldfreetype.tif deleted file mode 100644 index 606021e46c..0000000000 Binary files a/testsuite/texture-udim2/ref/out2-oldfreetype.tif and /dev/null differ diff --git a/testsuite/texture-udim2/ref/out3-oldfreetype.tif b/testsuite/texture-udim2/ref/out3-oldfreetype.tif deleted file mode 100644 index 606021e46c..0000000000 Binary files a/testsuite/texture-udim2/ref/out3-oldfreetype.tif and /dev/null differ diff --git a/testsuite/texture-udim2/ref/out4-oldfreetype.tif b/testsuite/texture-udim2/ref/out4-oldfreetype.tif deleted file mode 100644 index 606021e46c..0000000000 Binary files a/testsuite/texture-udim2/ref/out4-oldfreetype.tif and /dev/null differ diff --git a/testsuite/texture-udim2/ref/out5-oldfreetype.tif b/testsuite/texture-udim2/ref/out5-oldfreetype.tif deleted file mode 100644 index 606021e46c..0000000000 Binary files a/testsuite/texture-udim2/ref/out5-oldfreetype.tif and /dev/null differ