Initialize for freetype2

This commit is contained in:
zyppe 2024-02-10 22:10:05 +08:00
commit ef315c0d66
18 changed files with 1766 additions and 0 deletions

2
.freetype2.metadata Normal file
View file

@ -0,0 +1,2 @@
d4538669f982c5de075d9f327b455c7bb54c8477a072bb1bc51cb5abc47b5876 freetype-2.10.4.tar.xz
e08e947eb3d6e58d8a6c7f8fbbb9fe78bc2a6cddd030da750b043e37b396c6eb freetype-doc-2.10.4.tar.xz

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
freetype-2.10.4.tar.xz
freetype-doc-2.10.4.tar.xz

22
CVE-2022-27404.patch Normal file
View file

@ -0,0 +1,22 @@
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -566,7 +566,7 @@
face_index = FT_ABS( face_instance_index ) & 0xFFFF;
/* value -(N+1) requests information on index N */
- if ( face_instance_index < 0 )
+ if ( face_instance_index < 0 && face_index > 0 )
face_index--;
if ( face_index >= face->ttc_header.count )
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -2085,7 +2085,7 @@
/* Validate requested face index. */
*num_faces = woff2.num_fonts;
/* value -(N+1) requests information on index N */
- if ( *face_instance_index < 0 )
+ if ( *face_instance_index < 0 && face_index > 0 )
face_index--;
if ( face_index >= woff2.num_fonts )

19
CVE-2022-27405.patch Normal file
View file

@ -0,0 +1,19 @@
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2527,6 +2527,16 @@
#endif
+ /* only use lower 31 bits together with sign bit */
+ if ( face_index > 0 )
+ face_index &= 0x7FFFFFFFL;
+ else
+ {
+ face_index = -face_index;
+ face_index &= 0x7FFFFFFFL;
+ face_index = -face_index;
+ }
+
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE3(( "FT_Open_Face: " ));
if ( face_index < 0 )

12
CVE-2022-27406.patch Normal file
View file

@ -0,0 +1,12 @@
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -3409,6 +3409,9 @@
if ( !face )
return FT_THROW( Invalid_Face_Handle );
+ if ( !face->size )
+ return FT_THROW( Invalid_Size_Handle );
+
if ( !req || req->width < 0 || req->height < 0 ||
req->type >= FT_SIZE_REQUEST_TYPE_MAX )
return FT_THROW( Invalid_Argument );

19
CVE-2023-2004.patch Normal file
View file

@ -0,0 +1,19 @@
--- freetype-2.10.4/src/truetype/ttgxvar.c 2020-08-27 08:17:20.000000000 +0200
+++ freetype-2.10.4/src/truetype/ttgxvar.c 2023-08-22 07:31:32.377121904 +0200
@@ -42,6 +42,7 @@
#include <ft2build.h>
#include <freetype/internal/ftdebug.h>
#include FT_CONFIG_CONFIG_H
+#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/sfnt.h>
#include <freetype/tttags.h>
@@ -1065,7 +1066,7 @@
delta == 1 ? "" : "s",
vertical ? "VVAR" : "HVAR" ));
- *avalue += delta;
+ *avalue = ADD_INT( *avalue, delta );
Exit:
return error;

8
baselibs.conf Normal file
View file

@ -0,0 +1,8 @@
libfreetype6
obsoletes "freetype2-<targettype> < <version>"
provides "freetype2-<targettype> = <version>"
freetype2-devel
requires -freetype2-<targettype>
requires "libfreetype6-<targettype>"
requires "zlib-devel-<targettype>"

View file

@ -0,0 +1,20 @@
---
src/base/ftobjs.c | 5 +++++
1 file changed, 5 insertions(+)
Index: freetype-2.10.0/src/base/ftobjs.c
===================================================================
--- freetype-2.10.0.orig/src/base/ftobjs.c
+++ freetype-2.10.0/src/base/ftobjs.c
@@ -2584,6 +2584,11 @@
if ( FT_IS_SCALABLE( face ) )
{
+ if ( face->family_name && strncmp(face->family_name, "CMEX", 4 ) == 0){
+ face->underline_position = (FT_Short)( -face->units_per_EM / 10 );
+ face->underline_thickness = (FT_Short)( face->units_per_EM / 30 );
+ }
+
if ( face->height < 0 )
face->height = (FT_Short)-face->height;

View file

@ -0,0 +1,53 @@
--- freetype-2.10.4/builds/unix/configure 2020-10-20 07:15:01.000000000 +0200
+++ freetype-2.10.4/builds/unix/configure 2022-08-23 13:12:37.617165611 +0200
@@ -15014,7 +15014,6 @@
# entries in Requires.private are separated by commas
REQUIRES_PRIVATE="$zlib_reqpriv, \
$bzip2_reqpriv, \
- $libpng_reqpriv, \
$harfbuzz_reqpriv, \
$brotli_reqpriv"
# beautify
@@ -15029,7 +15028,6 @@
LIBS_PRIVATE="$zlib_libspriv \
$bzip2_libspriv \
- $libpng_libspriv \
$harfbuzz_libspriv \
$brotli_libspriv \
$ft2_extra_libs"
@@ -15042,7 +15040,6 @@
LIBSSTATIC_CONFIG="-lfreetype \
$zlib_libsstaticconf \
$bzip2_libsstaticconf \
- $libpng_libsstaticconf \
$harfbuzz_libsstaticconf \
$brotli_libsstaticconf \
$ft2_extra_libs"
diff -urEbwB freetype-2.10.4/builds/unix/configure.raw freetype-2.10.4.new/builds/unix/configure.raw
--- freetype-2.10.4/builds/unix/configure.raw 2020-10-20 07:08:40.000000000 +0200
+++ freetype-2.10.4.new/builds/unix/configure.raw 2022-08-23 13:12:59.697311562 +0200
@@ -1039,7 +1039,6 @@
# entries in Requires.private are separated by commas
REQUIRES_PRIVATE="$zlib_reqpriv, \
$bzip2_reqpriv, \
- $libpng_reqpriv, \
$harfbuzz_reqpriv, \
$brotli_reqpriv"
# beautify
@@ -1054,7 +1053,6 @@
LIBS_PRIVATE="$zlib_libspriv \
$bzip2_libspriv \
- $libpng_libspriv \
$harfbuzz_libspriv \
$brotli_libspriv \
$ft2_extra_libs"
@@ -1067,7 +1065,6 @@
LIBSSTATIC_CONFIG="-lfreetype \
$zlib_libsstaticconf \
$bzip2_libsstaticconf \
- $libpng_libsstaticconf \
$harfbuzz_libsstaticconf \
$brotli_libsstaticconf \
$ft2_extra_libs"

View file

@ -0,0 +1,15 @@
Index: freetype-2.10.0/include/freetype/config/ftoption.h
===================================================================
--- freetype-2.10.0.orig/include/freetype/config/ftoption.h
+++ freetype-2.10.0/include/freetype/config/ftoption.h
@@ -658,8 +658,8 @@ FT_BEGIN_HEADER
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
*/
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
-#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
+/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */
+#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 )
/**************************************************************************

View file

@ -0,0 +1,13 @@
Index: freetype-2.10.0/include/freetype/config/ftoption.h
===================================================================
--- freetype-2.10.0.orig/include/freetype/config/ftoption.h
+++ freetype-2.10.0/include/freetype/config/ftoption.h
@@ -847,7 +847,7 @@ FT_BEGIN_HEADER
* If this option is activated, it can be controlled with the
* `no-long-family-names` property of the 'pcf' driver module.
*/
-/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
+#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
/*************************************************************************/

View file

@ -0,0 +1,11 @@
--- freetype-2.10.4/include/freetype/config/ftoption.h 2020-08-31 09:26:12.000000000 +0200
+++ freetype-2.10.4/include/freetype/config/ftoption.h 2022-08-23 13:15:55.758475421 +0200
@@ -124,7 +124,7 @@
* When this macro is not defined, FreeType offers alternative LCD
* rendering technology that produces excellent output.
*/
-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
/**************************************************************************

View file

@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRY4MER459UCMXT7HbBpg6s5wf9pQUCX450LgAKCRDBpg6s5wf9
pZEVAKCDmRHm9r1pxCwXCBNQfFMe4d1NQgCcDm+RLoTDuc2y4jmjLFMAqfMhzvo=
=Pt2+
-----END PGP SIGNATURE-----

View file

@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRY4MER459UCMXT7HbBpg6s5wf9pQUCX450LwAKCRDBpg6s5wf9
pfbTAJ9Zuk7lUdVXP83dBZo2AOrO1cr8HgCfa+SE7B+ozJu8nyUItUDpcusQ64M=
=QhdQ
-----END PGP SIGNATURE-----

1426
freetype2.changes Normal file

File diff suppressed because it is too large Load diff

BIN
freetype2.keyring Normal file

Binary file not shown.

1
freetype2.sh Normal file
View file

@ -0,0 +1 @@
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"

131
freetype2.spec Normal file
View file

@ -0,0 +1,131 @@
#
# spec file for package freetype2
#
# Copyright (c) 2022-2023 ZhuningOS
#
%define doc_version 2.10.4
Name: freetype2
Version: 2.10.4
Release: 150000.4.15.1
Summary: A TrueType Font Library
License: SUSE-Freetype OR GPL-2.0-or-later
Group: System/Libraries
URL: https://www.freetype.org
Source0: https://downloads.sourceforge.net/project/freetype/freetype2/%{version}/freetype-%{version}.tar.xz
Source1: https://downloads.sourceforge.net/project/freetype/freetype-docs/%{version}/freetype-doc-%{version}.tar.xz
Source2: %{name}.sh
Source10: https://downloads.sourceforge.net/project/freetype/freetype2/%{version}/freetype-%{version}.tar.xz.sig
Source11: https://downloads.sourceforge.net/project/freetype/freetype-docs/%{version}/freetype-doc-%{version}.tar.xz.sig
Source12: freetype2.keyring
Source1000: baselibs.conf
Patch0: bugzilla-308961-cmex-workaround.patch
# PATCH-FIX-OPENSUSE don-t-mark-libpng-as-required-library.patch -- it is private in .pc
Patch1: don-t-mark-libpng-as-required-library.patch
Patch2: enable-long-family-names-by-default.patch
Patch3: enable-subpixel-rendering.patch
Patch4: enable-infinality-subpixel-hinting.patch
Patch5: CVE-2022-27404.patch
Patch6: CVE-2022-27405.patch
Patch7: CVE-2022-27406.patch
Patch8: CVE-2023-2004.patch
BuildRequires: gawk
BuildRequires: libbz2-devel
BuildRequires: libpng-devel
BuildRequires: pkgconfig
BuildRequires: zlib-devel
# needs an ECO to get added in SLE
# BuildRequires: pkgconfig(libbrotlidec)
%description
This library features TrueType fonts for open source projects. This
version also contains an autohinter for producing improved output.
%package -n libfreetype6
Summary: A TrueType Font Library
Group: System/Libraries
Obsoletes: freetype2 < %{version}
Provides: freetype2 = %{version}
%description -n libfreetype6
This library features TrueType fonts for open source projects. This
version also contains an autohinter for producing improved output.
%package profile-tti35
Summary: Set TrueType interpreter to version 35
Group: System/Shells
Requires: bash
Requires: freetype2
BuildArch: noarch
%description profile-tti35
System environment for set TrueType interpreter to version 35.
In release 2.6.4, a new hinting mode for TrueType fonts was added,
which enabled by default to activate sub-pixel hinting for TrueType.
This broke the work of full hinting. This optional package with a bash profile
that will switch the TrueType Interpreter to the old version 35.
%package devel
Summary: Development environment for the freetype2 TrueType font library
Group: Development/Libraries/C and C++
Requires: libfreetype6 = %{version}
Requires: zlib-devel
Requires: pkgconfig(libbrotlidec)
# there is no freetype-devel on suse:
Provides: freetype-devel
# Static library provides:
Provides: libfreetype6-devel-static
%description devel
This package contains all necessary include files, libraries and
documentation needed to develop applications that require the freetype2
TrueType font library.
It also contains a small tutorial for using that library.
%prep
%setup -q -n freetype-%{version} -a 1
%autopatch -p1
%build
export CFLAGS="%{optflags} -D_GNU_SOURCE $(getconf LFS_CFLAGS)"
%configure \
--with-bzip2 \
--with-png \
--with-zlib \
--enable-freetype-config \
--disable-static
make %{?_smp_mflags} ANSIFLAGS=
%install
%make_install
install -Dm 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
# remove documentation that does not belong in an rpm
rm docs/INSTALL*
rm %{buildroot}%{_libdir}/libfreetype.la
%post -n libfreetype6 -p /sbin/ldconfig
%postun -n libfreetype6 -p /sbin/ldconfig
%files -n libfreetype6
%{_libdir}/libfreetype.so.*
%doc ChangeLog README
%doc docs/{CHANGES,CUSTOMIZE,DEBUG,MAKEPP,PROBLEMS,TODO,*.txt}
%files profile-tti35
%config %{_sysconfdir}/profile.d/%{name}.sh
%files devel
%doc docs/reference/*
%{_bindir}/freetype-config
%{_includedir}/*
%{_libdir}/libfreetype.so
%{_libdir}/pkgconfig/freetype2.pc
%{_mandir}/man1/freetype-config.1%{?ext_man}
%{_datadir}/aclocal
%changelog