Merge remote-tracking branch 'nckx/update-freetype' into staging
Closes #12600
This commit is contained in:
commit
b64ca73b81
|
@ -1,13 +1,18 @@
|
||||||
{ stdenv, fetchurl }:
|
{ stdenv, fetchFromGitHub }:
|
||||||
|
|
||||||
|
let version = "2015-12-06"; in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "fontconfig-ultimate-20141123";
|
name = "fontconfig-ultimate-${version}";
|
||||||
src = fetchurl {
|
|
||||||
url = "https://github.com/bohoomil/fontconfig-ultimate/archive/2014-11-23.tar.gz";
|
src = fetchFromGitHub {
|
||||||
sha256 = "0czfm3hxc41x5mscwrba7p1vhm2w62j1qg7z8kfdrf21z8fvgznw";
|
sha256 = "02a811szxkq4q088nxfpdzp6rv0brvgkdhwigk09qffygxd776g6";
|
||||||
|
rev = version;
|
||||||
|
repo = "fontconfig-ultimate";
|
||||||
|
owner = "bohoomil";
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = "$prePhases unpackPhase installPhase $postPhases";
|
phases = "$prePhases unpackPhase installPhase $postPhases";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/etc/fonts/conf.d
|
mkdir -p $out/etc/fonts/conf.d
|
||||||
cp conf.d.infinality/*.conf $out/etc/fonts/conf.d
|
cp conf.d.infinality/*.conf $out/etc/fonts/conf.d
|
||||||
|
@ -22,8 +27,8 @@ stdenv.mkDerivation {
|
||||||
rm $out/etc/fonts/conf.d/83-*.conf
|
rm $out/etc/fonts/conf.d/83-*.conf
|
||||||
|
|
||||||
# Inclusion of local and user configs handled by global configuration
|
# Inclusion of local and user configs handled by global configuration
|
||||||
rm $out/etc/fonts/conf.d/97-local.conf
|
rm $out/etc/fonts/conf.d/29-local.conf
|
||||||
rm $out/etc/fonts/conf.d/98-user.conf
|
rm $out/etc/fonts/conf.d/28-user.conf
|
||||||
|
|
||||||
cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d
|
cp fontconfig_patches/fonts-settings/*.conf $out/etc/fonts/conf.d
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
{ stdenv, fetchurl, fetchpatch, pkgconfig, which, zlib, bzip2, libpng, gnumake
|
{ stdenv, fetchurl, fetchpatch, pkgconfig, which, zlib, bzip2, libpng, gnumake
|
||||||
|
, glib /* passthru only */
|
||||||
|
|
||||||
# FreeType supports sub-pixel rendering. This is patented by
|
# FreeType supports sub-pixel rendering. This is patented by
|
||||||
# Microsoft, so it is disabled by default. This option allows it to
|
# Microsoft, so it is disabled by default. This option allows it to
|
||||||
# be enabled. See http://www.freetype.org/patents.html.
|
# be enabled. See http://www.freetype.org/patents.html.
|
||||||
, glib/*passthru only*/
|
|
||||||
, useEncumberedCode ? true
|
, useEncumberedCode ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "2.5.4";
|
version = "2.6.2";
|
||||||
|
|
||||||
fetch_bohoomil = name: sha256: fetchpatch {
|
# Don't use fetchpatch. It mangles them. That's an hour I'll never get back.
|
||||||
url = https://raw.githubusercontent.com/bohoomil/fontconfig-ultimate/e4c99bcf5ac9595e2c64393c0661377685c0ad24/01_freetype2-iu/ + name;
|
fetchbohoomil = name: sha256: fetchurl {
|
||||||
|
url = https://raw.githubusercontent.com/bohoomil/fontconfig-ultimate/254b688f96d4a37f78fb594303a43160fc15c7cd/freetype/ + name;
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -20,15 +22,17 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://sourceforge/freetype/${name}.tar.bz2";
|
url = "mirror://sourceforge/freetype/${name}.tar.bz2";
|
||||||
sha256 = "1fxsbk4lp6ymifldzrb86g3x6mz771jmrzphkz92mcrkddk2qkiv";
|
sha256 = "14mqrfgl18q2by1yzv6vcxi97zjy4kppcgsqf312mhfwgkpvvxms";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ ./enable-validation.patch ] # from Gentoo, bohoomil has the same patch as well
|
patches = []
|
||||||
++ [ ./fix-pcf.patch ]
|
|
||||||
++ optionals useEncumberedCode [
|
++ optionals useEncumberedCode [
|
||||||
(fetch_bohoomil "02-ftsmooth-2.5.4.patch" "11w4wb7gwgpijc788mpkxj92d7rfdwrdv7jzrpxwv5w5cgpx9iw9")
|
(fetchbohoomil "01-freetype-2.6.2-enable-valid.patch"
|
||||||
(fetch_bohoomil "03-upstream-2014.12.07.patch" "0gq7y63mg3gc5z69nfkv2kl7xad0bjzsvnl6j1j9q79jjbvaqdq0")
|
"1szq0zha7n41f4pq179wgfkam034mp2xn0xc36sdl5sjp9s9hv08")
|
||||||
(fetch_bohoomil "04-infinality-2.5.4-2014.12.07.patch" "1gph7z9s2221gy5dxn01v3lga0m9yib8yqsaqj5km74bqx1vlalh")
|
(fetchbohoomil "02-upstream-2015.12.05.patch"
|
||||||
|
"0781r9n35kpn8db8nma0l47cpkzh0hbp84ziii5sald90dnrqdj4")
|
||||||
|
(fetchbohoomil "03-infinality-2.6.2-2015.12.05.patch"
|
||||||
|
"0wcjf9hiymplgqm3szla633i417pb57vpzzs2dyl1dnmcxgqa2y8")
|
||||||
];
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
|
propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
|
||||||
|
@ -46,10 +50,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
# compat hacks
|
postInstall = glib.flattenInclude;
|
||||||
postInstall = glib.flattenInclude + ''
|
|
||||||
ln -s . "$out"/include/freetype
|
|
||||||
'';
|
|
||||||
|
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
# Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead
|
# Somehow it calls the unwrapped gcc, "i686-pc-linux-gnu-gcc", instead
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
Enables gxvalid and otvalid modules for use with ftvalid.
|
|
||||||
|
|
||||||
--- freetype-2.2.1/modules.cfg.orig 2006-07-07 21:01:09.000000000 -0400
|
|
||||||
+++ freetype-2.2.1/modules.cfg 2006-07-07 21:01:54.000000000 -0400
|
|
||||||
@@ -110,7 +110,7 @@
|
|
||||||
AUX_MODULES += cache
|
|
||||||
|
|
||||||
# TrueType GX/AAT table validation. Needs ftgxval.c below.
|
|
||||||
-# AUX_MODULES += gxvalid
|
|
||||||
+AUX_MODULES += gxvalid
|
|
||||||
|
|
||||||
# Support for streams compressed with gzip (files with suffix .gz).
|
|
||||||
#
|
|
||||||
@@ -124,7 +124,7 @@
|
|
||||||
|
|
||||||
# OpenType table validation. Needs ftotval.c below.
|
|
||||||
#
|
|
||||||
-# AUX_MODULES += otvalid
|
|
||||||
+AUX_MODULES += otvalid
|
|
||||||
|
|
||||||
# Auxiliary PostScript driver component to share common code.
|
|
||||||
#
|
|
|
@ -1,132 +0,0 @@
|
||||||
Upstream fixes for pcf fonts.
|
|
||||||
|
|
||||||
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=74af85c4b62b35e55b0ce9dec55ee10cbc4962a2
|
|
||||||
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=06842c7b49c21f13c0ab61201daab6ff5a358fcc
|
|
||||||
|
|
||||||
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
|
|
||||||
index 998cbed..e3caf82 100644
|
|
||||||
--- a/src/pcf/pcfread.c
|
|
||||||
+++ b/src/pcf/pcfread.c
|
|
||||||
@@ -2,7 +2,7 @@
|
|
||||||
|
|
||||||
FreeType font driver for pcf fonts
|
|
||||||
|
|
||||||
- Copyright 2000-2010, 2012, 2013 by
|
|
||||||
+ Copyright 2000-2010, 2012-2014 by
|
|
||||||
Francesco Zappa Nardelli
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
@@ -78,7 +78,7 @@ THE SOFTWARE.
|
|
||||||
FT_FRAME_START( 16 ),
|
|
||||||
FT_FRAME_ULONG_LE( type ),
|
|
||||||
FT_FRAME_ULONG_LE( format ),
|
|
||||||
- FT_FRAME_ULONG_LE( size ),
|
|
||||||
+ FT_FRAME_ULONG_LE( size ), /* rounded up to a multiple of 4 */
|
|
||||||
FT_FRAME_ULONG_LE( offset ),
|
|
||||||
FT_FRAME_END
|
|
||||||
};
|
|
||||||
@@ -95,9 +95,11 @@ THE SOFTWARE.
|
|
||||||
FT_Memory memory = FT_FACE( face )->memory;
|
|
||||||
FT_UInt n;
|
|
||||||
|
|
||||||
+ FT_ULong size;
|
|
||||||
|
|
||||||
- if ( FT_STREAM_SEEK ( 0 ) ||
|
|
||||||
- FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )
|
|
||||||
+
|
|
||||||
+ if ( FT_STREAM_SEEK( 0 ) ||
|
|
||||||
+ FT_STREAM_READ_FIELDS( pcf_toc_header, toc ) )
|
|
||||||
return FT_THROW( Cannot_Open_Resource );
|
|
||||||
|
|
||||||
if ( toc->version != PCF_FILE_VERSION ||
|
|
||||||
@@ -154,14 +156,35 @@ THE SOFTWARE.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* we now check whether the `size' and `offset' values are reasonable: */
|
|
||||||
- /* `offset' + `size' must not exceed the stream size */
|
|
||||||
+ /*
|
|
||||||
+ * We now check whether the `size' and `offset' values are reasonable:
|
|
||||||
+ * `offset' + `size' must not exceed the stream size.
|
|
||||||
+ *
|
|
||||||
+ * Note, however, that X11's `pcfWriteFont' routine (used by the
|
|
||||||
+ * `bdftopcf' program to create PDF font files) has two special
|
|
||||||
+ * features.
|
|
||||||
+ *
|
|
||||||
+ * - It always assigns the accelerator table a size of 100 bytes in the
|
|
||||||
+ * TOC, regardless of its real size, which can vary between 34 and 72
|
|
||||||
+ * bytes.
|
|
||||||
+ *
|
|
||||||
+ * - Due to the way the routine is designed, it ships out the last font
|
|
||||||
+ * table with its real size, ignoring the TOC's size value. Since
|
|
||||||
+ * the TOC size values are always rounded up to a multiple of 4, the
|
|
||||||
+ * difference can be up to three bytes for all tables except the
|
|
||||||
+ * accelerator table, for which the difference can be as large as 66
|
|
||||||
+ * bytes.
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
tables = face->toc.tables;
|
|
||||||
- for ( n = 0; n < toc->count; n++ )
|
|
||||||
+ size = stream->size;
|
|
||||||
+
|
|
||||||
+ for ( n = 0; n < toc->count - 1; n++ )
|
|
||||||
{
|
|
||||||
/* we need two checks to avoid overflow */
|
|
||||||
- if ( ( tables->size > stream->size ) ||
|
|
||||||
- ( tables->offset > stream->size - tables->size ) )
|
|
||||||
+ if ( ( tables->size > size ) ||
|
|
||||||
+ ( tables->offset > size - tables->size ) )
|
|
||||||
{
|
|
||||||
error = FT_THROW( Invalid_Table );
|
|
||||||
goto Exit;
|
|
||||||
@@ -169,6 +192,15 @@ THE SOFTWARE.
|
|
||||||
tables++;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* no check of `tables->size' for last table element ... */
|
|
||||||
+ if ( ( tables->offset > size ) )
|
|
||||||
+ {
|
|
||||||
+ error = FT_THROW( Invalid_Table );
|
|
||||||
+ goto Exit;
|
|
||||||
+ }
|
|
||||||
+ /* ... instead, we adjust `tables->size' to the real value */
|
|
||||||
+ tables->size = size - tables->offset;
|
|
||||||
+
|
|
||||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
||||||
|
|
||||||
{
|
|
||||||
@@ -733,8 +765,8 @@ THE SOFTWARE.
|
|
||||||
|
|
||||||
FT_TRACE4(( " number of bitmaps: %d\n", nbitmaps ));
|
|
||||||
|
|
||||||
- /* XXX: PCF_Face->nmetrics is singed FT_Long, see pcf.h */
|
|
||||||
- if ( face->nmetrics < 0 || nbitmaps != ( FT_ULong )face->nmetrics )
|
|
||||||
+ /* XXX: PCF_Face->nmetrics is signed FT_Long, see pcf.h */
|
|
||||||
+ if ( face->nmetrics < 0 || nbitmaps != (FT_ULong)face->nmetrics )
|
|
||||||
return FT_THROW( Invalid_File_Format );
|
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
|
|
||||||
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
|
|
||||||
index e3caf82..a29a9e3 100644
|
|
||||||
--- a/src/pcf/pcfread.c
|
|
||||||
+++ b/src/pcf/pcfread.c
|
|
||||||
@@ -192,14 +192,15 @@ THE SOFTWARE.
|
|
||||||
tables++;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* no check of `tables->size' for last table element ... */
|
|
||||||
+ /* only check `tables->offset' for last table element ... */
|
|
||||||
if ( ( tables->offset > size ) )
|
|
||||||
{
|
|
||||||
error = FT_THROW( Invalid_Table );
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
- /* ... instead, we adjust `tables->size' to the real value */
|
|
||||||
- tables->size = size - tables->offset;
|
|
||||||
+ /* ... and adjust `tables->size' to the real value if necessary */
|
|
||||||
+ if ( tables->size > size - tables->offset )
|
|
||||||
+ tables->size = size - tables->offset;
|
|
||||||
|
|
||||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
||||||
|
|
Loading…
Reference in New Issue