homebrew-core/Formula/fontforge.rb

102 lines
3.6 KiB
Ruby

class Fontforge < Formula
desc "Command-line outline and bitmap font editor/converter"
homepage "https://fontforge.github.io"
url "https://github.com/fontforge/fontforge/releases/download/20220308/fontforge-20220308.tar.xz"
sha256 "01e4017f7a0ccecf436c74b8e1f6b374fc04a5283c1d68967996782e15618e59"
license "GPL-3.0-or-later"
revision 1
bottle do
rebuild 2
sha256 arm64_ventura: "072fc4af1b9c6b1fbcf32dbee28b8eb62f06dfd7153a25bfa9c1fe7042264d5d"
sha256 arm64_monterey: "a7031eb564d235e82213d442196924b91c11476e4a647db9c45d51d0726b0954"
sha256 arm64_big_sur: "beb4d356444abd866b702f45fe89f29968afe1ccf95813472fd9c5ad9fa335fd"
sha256 ventura: "706492e1dbe79ec3f96f9d0230f07a4edb76961116be298536ab038a70b35c38"
sha256 monterey: "06a77e255751a88fd8d7e0f48b6f19c5689aae22ad6570c0f6a9501f3ea2dcbe"
sha256 big_sur: "c81153b469fb6a7e5d55caa349702c7c80230e6f4dcd18867e36cbec9fc4332b"
sha256 x86_64_linux: "06fc685890e7c42b7150e1e20b314db18dac38270d7f8b9d5e54e9bdb0147769"
end
depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "cairo"
depends_on "fontconfig"
depends_on "freetype"
depends_on "gettext"
depends_on "giflib"
depends_on "glib"
depends_on "jpeg-turbo"
depends_on "libpng"
depends_on "libspiro"
depends_on "libtiff"
depends_on "libtool"
depends_on "libuninameslist"
depends_on "pango"
depends_on "python@3.11"
depends_on "readline"
depends_on "woff2"
uses_from_macos "libxml2"
resource "homebrew-testdata" do
url "https://raw.githubusercontent.com/fontforge/fontforge/1346ce6e4c004c312589fdb67e31d4b2c32a1656/tests/fonts/Ambrosia.sfd"
sha256 "6a22acf6be4ab9e5c5a3373dc878030b4b8dc4652323395388abe43679ceba81"
end
# Fix for rpath on ARM
# https://github.com/fontforge/fontforge/issues/4658
patch :DATA
def install
system "cmake", "-S", ".", "-B", "build", *std_cmake_args,
"-GNinja",
"-DENABLE_GUI=OFF",
"-DENABLE_FONTFORGE_EXTRAS=ON"
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
def caveats
on_macos do
<<~EOS
This formula only installs the command line utilities.
FontForge.app can be downloaded directly from the website:
https://fontforge.github.io
Alternatively, install with Homebrew Cask:
brew install --cask fontforge
EOS
end
end
test do
python = Formula["python@3.11"].opt_bin/"python3.11"
system bin/"fontforge", "-version"
system bin/"fontforge", "-lang=py", "-c", "import fontforge; fontforge.font()"
system python, "-c", "import fontforge; fontforge.font()"
resource("homebrew-testdata").stage do
ffscript = "fontforge.open('Ambrosia.sfd').generate('#{testpath}/Ambrosia.woff2')"
system bin/"fontforge", "-c", ffscript
end
assert_predicate testpath/"Ambrosia.woff2", :exist?
fileres = shell_output("/usr/bin/file #{testpath}/Ambrosia.woff2")
assert_match "Web Open Font Format (Version 2)", fileres
end
end
__END__
diff --git a/contrib/fonttools/CMakeLists.txt b/contrib/fonttools/CMakeLists.txt
index 0d3f464bc..b9f210cde 100644
--- a/contrib/fonttools/CMakeLists.txt
+++ b/contrib/fonttools/CMakeLists.txt
@@ -18,3 +18,5 @@ target_link_libraries(dewoff PRIVATE ZLIB::ZLIB)
target_link_libraries(pcl2ttf PRIVATE MathLib::MathLib)
target_link_libraries(ttf2eps PRIVATE fontforge)
target_link_libraries(woff PRIVATE ZLIB::ZLIB)
+
+install(TARGETS acorn2sfd dewoff findtable pcl2ttf pfadecrypt rmligamarks showttf stripttc ttf2eps woff RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})