summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-12-12 08:09:05 +0100
committerRemi Collet <remi@php.net>2025-12-12 08:09:05 +0100
commit6a87eb9500de767bd769800af992795a79ed7df4 (patch)
tree0b460caa78f7d333c427e46a923f5117213a5d67
parent793b44af9374542437f0a865e4b704668ffaae08 (diff)
Fedora only: use system fonts (unifont)HEADmaster
-rw-r--r--php-tecnickcom-tc-lib-pdf-font.spec38
1 files changed, 34 insertions, 4 deletions
diff --git a/php-tecnickcom-tc-lib-pdf-font.spec b/php-tecnickcom-tc-lib-pdf-font.spec
index 0005e1a..5fe88ae 100644
--- a/php-tecnickcom-tc-lib-pdf-font.spec
+++ b/php-tecnickcom-tc-lib-pdf-font.spec
@@ -12,12 +12,19 @@
%global gh_owner tecnickcom
%global gh_project tc-lib-pdf-font
%global php_project %{_datadir}/php/Com/Tecnick/Pdf/Font
-%global with_tests 0%{!?_without_tests:1}
%global font_version 2.1.0
+%bcond_without tests
+
+%if 0%{?fedora}
+%bcond_without unifont
+%else
+%bcond_with unifont
+%endif
+
Name: php-%{gh_owner}-%{gh_project}
Version: 2.6.22
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: PHP library containing PDF page formats and definitions
License: LGPL-3.0-or-later
@@ -29,7 +36,7 @@ Source1: https://github.com/tecnickcom/tc-font-mirror/archive/refs/tags/%
Patch0: %{name}-rpm.patch
BuildArch: noarch
-%if %{with_tests}
+%if %{with tests}
# For tests
%global phpunit %{_bindir}/phpunit10
BuildRequires: phpunit10 >= 10.5.58
@@ -50,6 +57,9 @@ BuildRequires: dejavu-sans-mono-fonts
BuildRequires: gnu-free-mono-fonts
BuildRequires: gnu-free-sans-fonts
BuildRequires: gnu-free-serif-fonts
+%if %{with unifont}
+BuildRequires: unifont-ttf-fonts
+%endif
# From composer.json, "require": {
# "php": ">=8.1",
@@ -77,6 +87,9 @@ Requires: dejavu-sans-mono-fonts
Requires: gnu-free-mono-fonts
Requires: gnu-free-sans-fonts
Requires: gnu-free-serif-fonts
+%if %{with unifont}
+Requires: unifont-ttf-fonts
+%endif
# Composer
Provides: php-composer(%{c_vendor}/%{gh_project}) = %{version}
@@ -119,12 +132,18 @@ install -Dpm 755 convert.php %{buildroot}%{_bindir}/%{name}-convert
# Remove TTF available in system fonts
mv ../tc-font-mirror-%{font_version}/{dejavu,freefont} .
+%if %{with unifont}
+mv ../tc-font-mirror-%{font_version}/unifont .
+%endif
mkdir -p %{buildroot}/%{_datadir}/%{name}
php bulk_convert.php --outpath=%{buildroot}%{_datadir}/%{name}/
# Restore TTF for tests
mv {dejavu,freefont} ../tc-font-mirror-%{font_version}
+%if %{with unifont}
+mv unifont ../tc-font-mirror-%{font_version}
+%endif
# Fix autoloader
sed -e 's:%{_datadir}:%{buildroot}%{_datadir}:' convert.php >_convert.php
@@ -141,12 +160,20 @@ for ttf in \
; do php -d memory_limit=1G _convert.php \
--fonts=$ttf --linked --outpath=%{buildroot}%{_datadir}/%{name}/freefont/
done
+%if %{with unifont}
+mkdir %{buildroot}%{_datadir}/%{name}/unifont
+for ttf in \
+ /usr/share/fonts/unifont/*ttf \
+; do php -d memory_limit=1G _convert.php \
+ --fonts=$ttf --linked --outpath=%{buildroot}%{_datadir}/%{name}/unifont/
+done
+%endif
# TODO fix absolute links to /usr/share/fonts
%check
-%if %{with_tests}
+%if %{with tests}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
@@ -181,6 +208,9 @@ exit $ret
%changelog
+* Fri Dec 12 2025 Remi Collet <remi@remirepo.net> - 2.6.22-3
+- Fedora only: use system fonts (unifont)
+
* Fri Dec 12 2025 Remi Collet <remi@remirepo.net> - 2.6.22-2
- use system fonts (dejavu and gnu-free)