Update to 2.10.1
This commit is contained in:
parent
c37eacefc5
commit
095c0c5a53
3
.gitignore
vendored
3
.gitignore
vendored
@ -82,3 +82,6 @@ ft2demos-2.4.2.tar.bz2
|
||||
/freetype-2.10.0.tar.bz2
|
||||
/freetype-doc-2.10.0.tar.bz2
|
||||
/ft2demos-2.10.0.tar.bz2
|
||||
/freetype-2.10.1.tar.xz
|
||||
/freetype-doc-2.10.1.tar.xz
|
||||
/ft2demos-2.10.1.tar.xz
|
||||
|
@ -1,324 +0,0 @@
|
||||
From c149f7397e484c97f45fb75fa1c7fdda2fc646cd Mon Sep 17 00:00:00 2001
|
||||
From: Werner Lemberg <wl@gnu.org>
|
||||
Date: Wed, 17 Apr 2019 07:49:17 +0200
|
||||
Subject: [PATCH] [pcf] Fix handling of undefined glyph (#56067).
|
||||
|
||||
This commit fixes the changes from 2018-07-21, which broke charmap
|
||||
iteration. We now add the default character as a new glyph with
|
||||
index 0, thus increasing the number of glyphs by one (as before).
|
||||
|
||||
* src/pcf/pcfread.c (pcf_get_metrics): Adjust to new artificial
|
||||
glyph with index 0.
|
||||
Limit number of elements to 65534.
|
||||
(pcf_get_bitmaps): Ditto.
|
||||
Unify two loops into one; this avoids allocation of an intermediate
|
||||
array.
|
||||
(pcf_get_encodings): Don't flip indices but copy glyph metrics of
|
||||
default character to index 0.
|
||||
Also handle invalid default character.
|
||||
|
||||
* docs/CHANGES: Updated.
|
||||
---
|
||||
src/pcf/pcf.h | 3 +-
|
||||
src/pcf/pcfdrivr.c | 12 ++--
|
||||
src/pcf/pcfread.c | 161 ++++++++++++++++++++++++---------------------
|
||||
3 files changed, 93 insertions(+), 83 deletions(-)
|
||||
|
||||
diff --git a/src/pcf/pcf.h b/src/pcf/pcf.h
|
||||
index 529dd3adf..33be4bcd8 100644
|
||||
--- a/src/pcf/pcf.h
|
||||
+++ b/src/pcf/pcf.h
|
||||
@@ -99,7 +99,8 @@ FT_BEGIN_HEADER
|
||||
FT_Short ascent;
|
||||
FT_Short descent;
|
||||
FT_Short attributes;
|
||||
- FT_ULong bits;
|
||||
+
|
||||
+ FT_ULong bits; /* offset into the PCF_BITMAPS table */
|
||||
|
||||
} PCF_MetricRec, *PCF_Metric;
|
||||
|
||||
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
|
||||
index 54bbb9d11..b39592c79 100644
|
||||
--- a/src/pcf/pcfdrivr.c
|
||||
+++ b/src/pcf/pcfdrivr.c
|
||||
@@ -122,9 +122,9 @@ THE SOFTWARE.
|
||||
charcodeCol > enc->lastCol )
|
||||
return 0;
|
||||
|
||||
- return (FT_UInt)enc->offset[ ( charcodeRow - enc->firstRow ) *
|
||||
- ( enc->lastCol - enc->firstCol + 1 ) +
|
||||
- charcodeCol - enc->firstCol ];
|
||||
+ return (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) *
|
||||
+ ( enc->lastCol - enc->firstCol + 1 ) +
|
||||
+ charcodeCol - enc->firstCol];
|
||||
}
|
||||
|
||||
|
||||
@@ -160,9 +160,9 @@ THE SOFTWARE.
|
||||
|
||||
charcode = (FT_UInt32)( charcodeRow * 256 + charcodeCol );
|
||||
|
||||
- result = (FT_UInt)enc->offset[ ( charcodeRow - enc->firstRow ) *
|
||||
- ( enc->lastCol - enc->firstCol + 1 ) +
|
||||
- charcodeCol - enc->firstCol ];
|
||||
+ result = (FT_UInt)enc->offset[( charcodeRow - enc->firstRow ) *
|
||||
+ ( enc->lastCol - enc->firstCol + 1 ) +
|
||||
+ charcodeCol - enc->firstCol];
|
||||
if ( result != 0xFFFFU )
|
||||
break;
|
||||
}
|
||||
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
|
||||
index 71143ecfb..3692eeff1 100644
|
||||
--- a/src/pcf/pcfread.c
|
||||
+++ b/src/pcf/pcfread.c
|
||||
@@ -743,33 +743,39 @@ THE SOFTWARE.
|
||||
if ( !orig_nmetrics )
|
||||
return FT_THROW( Invalid_Table );
|
||||
|
||||
- /* PCF is a format from ancient times; Unicode was in its */
|
||||
- /* infancy, and widely used two-byte character sets for CJK */
|
||||
- /* scripts (Big 5, GB 2312, JIS X 0208, etc.) did have at most */
|
||||
- /* 15000 characters. Even the more exotic CNS 11643 and CCCII */
|
||||
- /* standards, which were essentially three-byte character sets, */
|
||||
- /* provided less then 65536 assigned characters. */
|
||||
- /* */
|
||||
- /* While technically possible to have a larger number of glyphs */
|
||||
- /* in PCF files, we thus limit the number to 65536. */
|
||||
- if ( orig_nmetrics > 65536 )
|
||||
+ /*
|
||||
+ * PCF is a format from ancient times; Unicode was in its infancy, and
|
||||
+ * widely used two-byte character sets for CJK scripts (Big 5, GB 2312,
|
||||
+ * JIS X 0208, etc.) did have at most 15000 characters. Even the more
|
||||
+ * exotic CNS 11643 and CCCII standards, which were essentially
|
||||
+ * three-byte character sets, provided less then 65536 assigned
|
||||
+ * characters.
|
||||
+ *
|
||||
+ * While technically possible to have a larger number of glyphs in PCF
|
||||
+ * files, we thus limit the number to 65535, taking into account that we
|
||||
+ * synthesize the metrics of glyph 0 to be a copy of the `default
|
||||
+ * character', and that 0xFFFF in the encodings array indicates a
|
||||
+ * missing glyph.
|
||||
+ */
|
||||
+ if ( orig_nmetrics > 65534 )
|
||||
{
|
||||
FT_TRACE0(( "pcf_get_metrics:"
|
||||
- " only loading first 65536 metrics\n" ));
|
||||
- nmetrics = 65536;
|
||||
+ " only loading first 65534 metrics\n" ));
|
||||
+ nmetrics = 65534;
|
||||
}
|
||||
else
|
||||
nmetrics = orig_nmetrics;
|
||||
|
||||
- face->nmetrics = nmetrics;
|
||||
+ face->nmetrics = nmetrics + 1;
|
||||
|
||||
- if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )
|
||||
+ if ( FT_NEW_ARRAY( face->metrics, face->nmetrics ) )
|
||||
return error;
|
||||
|
||||
- metrics = face->metrics;
|
||||
+ /* we handle glyph index 0 later on */
|
||||
+ metrics = face->metrics + 1;
|
||||
|
||||
FT_TRACE4(( "\n" ));
|
||||
- for ( i = 0; i < nmetrics; i++, metrics++ )
|
||||
+ for ( i = 1; i < face->nmetrics; i++, metrics++ )
|
||||
{
|
||||
FT_TRACE5(( " idx %ld:", i ));
|
||||
error = pcf_get_metric( stream, format, metrics );
|
||||
@@ -808,12 +814,10 @@ THE SOFTWARE.
|
||||
pcf_get_bitmaps( FT_Stream stream,
|
||||
PCF_Face face )
|
||||
{
|
||||
- FT_Error error;
|
||||
- FT_Memory memory = FT_FACE( face )->memory;
|
||||
- FT_ULong* offsets = NULL;
|
||||
- FT_ULong bitmapSizes[GLYPHPADOPTIONS];
|
||||
- FT_ULong format, size;
|
||||
- FT_ULong nbitmaps, orig_nbitmaps, i, sizebitmaps = 0;
|
||||
+ FT_Error error;
|
||||
+ FT_ULong bitmapSizes[GLYPHPADOPTIONS];
|
||||
+ FT_ULong format, size, pos;
|
||||
+ FT_ULong nbitmaps, orig_nbitmaps, i, sizebitmaps = 0;
|
||||
|
||||
|
||||
error = pcf_seek_to_table_type( stream,
|
||||
@@ -859,31 +863,46 @@ THE SOFTWARE.
|
||||
FT_TRACE4(( " number of bitmaps: %ld\n", orig_nbitmaps ));
|
||||
|
||||
/* see comment in `pcf_get_metrics' */
|
||||
- if ( orig_nbitmaps > 65536 )
|
||||
+ if ( orig_nbitmaps > 65534 )
|
||||
{
|
||||
FT_TRACE0(( "pcf_get_bitmaps:"
|
||||
- " only loading first 65536 bitmaps\n" ));
|
||||
- nbitmaps = 65536;
|
||||
+ " only loading first 65534 bitmaps\n" ));
|
||||
+ nbitmaps = 65534;
|
||||
}
|
||||
else
|
||||
nbitmaps = orig_nbitmaps;
|
||||
|
||||
- if ( nbitmaps != face->nmetrics )
|
||||
+ /* no extra bitmap for glyph 0 */
|
||||
+ if ( nbitmaps != face->nmetrics - 1 )
|
||||
return FT_THROW( Invalid_File_Format );
|
||||
|
||||
- if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
|
||||
- return error;
|
||||
+ /* start position of bitmap data */
|
||||
+ pos = stream->pos + nbitmaps * 4 + 4 * 4;
|
||||
|
||||
FT_TRACE5(( "\n" ));
|
||||
- for ( i = 0; i < nbitmaps; i++ )
|
||||
+ for ( i = 1; i <= nbitmaps; i++ )
|
||||
{
|
||||
+ FT_ULong offset;
|
||||
+
|
||||
+
|
||||
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
|
||||
- (void)FT_READ_ULONG( offsets[i] );
|
||||
+ (void)FT_READ_ULONG( offset );
|
||||
else
|
||||
- (void)FT_READ_ULONG_LE( offsets[i] );
|
||||
+ (void)FT_READ_ULONG_LE( offset );
|
||||
|
||||
FT_TRACE5(( " bitmap %lu: offset %lu (0x%lX)\n",
|
||||
- i, offsets[i], offsets[i] ));
|
||||
+ i, offset, offset ));
|
||||
+
|
||||
+ /* right now, we only check the offset with a rough estimate; */
|
||||
+ /* actual bitmaps are only loaded on demand */
|
||||
+ if ( offset > size )
|
||||
+ {
|
||||
+ FT_TRACE0(( "pcf_get_bitmaps:"
|
||||
+ " invalid offset to bitmap data of glyph %lu\n", i ));
|
||||
+ face->metrics[i].bits = pos;
|
||||
+ }
|
||||
+ else
|
||||
+ face->metrics[i].bits = pos + offset;
|
||||
}
|
||||
if ( error )
|
||||
goto Bail;
|
||||
@@ -910,24 +929,9 @@ THE SOFTWARE.
|
||||
|
||||
FT_UNUSED( sizebitmaps ); /* only used for debugging */
|
||||
|
||||
- /* right now, we only check the bitmap offsets; */
|
||||
- /* actual bitmaps are only loaded on demand */
|
||||
- for ( i = 0; i < nbitmaps; i++ )
|
||||
- {
|
||||
- /* rough estimate */
|
||||
- if ( offsets[i] > size )
|
||||
- {
|
||||
- FT_TRACE0(( "pcf_get_bitmaps:"
|
||||
- " invalid offset to bitmap data of glyph %lu\n", i ));
|
||||
- }
|
||||
- else
|
||||
- face->metrics[i].bits = stream->pos + offsets[i];
|
||||
- }
|
||||
-
|
||||
face->bitmapsFormat = format;
|
||||
|
||||
Bail:
|
||||
- FT_FREE( offsets );
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1062,41 +1066,52 @@ THE SOFTWARE.
|
||||
defaultCharCol = enc->firstCol;
|
||||
}
|
||||
|
||||
- /* FreeType mandates that glyph index 0 is the `undefined glyph', */
|
||||
- /* which PCF calls the `default character'. For this reason, we */
|
||||
- /* swap the positions of glyph index 0 and the index corresponding */
|
||||
- /* to `defaultChar' in case they are different. */
|
||||
-
|
||||
- /* `stream->cursor' still points at the beginning of the frame; */
|
||||
- /* we can thus easily get the offset to the default character */
|
||||
+ /*
|
||||
+ * FreeType mandates that glyph index 0 is the `undefined glyph', which
|
||||
+ * PCF calls the `default character'. However, FreeType needs glyph
|
||||
+ * index 0 to be used for the undefined glyph only, which is is not the
|
||||
+ * case for PCF. For this reason, we add one slot for glyph index 0 and
|
||||
+ * simply copy the default character to it.
|
||||
+ *
|
||||
+ * `stream->cursor' still points to the beginning of the frame; we can
|
||||
+ * thus easily get the offset to the default character.
|
||||
+ */
|
||||
pos = stream->cursor +
|
||||
2 * ( ( defaultCharRow - enc->firstRow ) *
|
||||
- ( enc->lastCol - enc->firstCol + 1 ) +
|
||||
- defaultCharCol - enc->firstCol );
|
||||
+ ( enc->lastCol - enc->firstCol + 1 ) +
|
||||
+ defaultCharCol - enc->firstCol );
|
||||
|
||||
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
|
||||
defaultCharEncodingOffset = FT_PEEK_USHORT( pos );
|
||||
else
|
||||
defaultCharEncodingOffset = FT_PEEK_USHORT_LE( pos );
|
||||
|
||||
- if ( defaultCharEncodingOffset >= face->nmetrics )
|
||||
+ if ( defaultCharEncodingOffset == 0xFFFF )
|
||||
{
|
||||
FT_TRACE0(( "pcf_get_encodings:"
|
||||
- " Invalid glyph index for default character,"
|
||||
- " setting to zero\n" ));
|
||||
- defaultCharEncodingOffset = 0;
|
||||
+ " No glyph for default character,\n"
|
||||
+ " "
|
||||
+ " setting it to the first glyph of the font\n" ));
|
||||
+ defaultCharEncodingOffset = 1;
|
||||
}
|
||||
-
|
||||
- if ( defaultCharEncodingOffset )
|
||||
+ else
|
||||
{
|
||||
- /* do the swapping */
|
||||
- PCF_MetricRec tmp = face->metrics[defaultCharEncodingOffset];
|
||||
-
|
||||
+ defaultCharEncodingOffset++;
|
||||
|
||||
- face->metrics[defaultCharEncodingOffset] = face->metrics[0];
|
||||
- face->metrics[0] = tmp;
|
||||
+ if ( defaultCharEncodingOffset >= face->nmetrics )
|
||||
+ {
|
||||
+ FT_TRACE0(( "pcf_get_encodings:"
|
||||
+ " Invalid glyph index for default character,\n"
|
||||
+ " "
|
||||
+ " setting it to the first glyph of the font\n" ));
|
||||
+ defaultCharEncodingOffset = 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
+ /* copy metrics of default character to index 0 */
|
||||
+ face->metrics[0] = face->metrics[defaultCharEncodingOffset];
|
||||
+
|
||||
+ /* now loop over all values */
|
||||
offset = enc->offset;
|
||||
for ( i = enc->firstRow; i <= enc->lastRow; i++ )
|
||||
{
|
||||
@@ -1111,15 +1126,9 @@ THE SOFTWARE.
|
||||
else
|
||||
encodingOffset = FT_GET_USHORT_LE();
|
||||
|
||||
- if ( encodingOffset != 0xFFFFU )
|
||||
- {
|
||||
- if ( encodingOffset == defaultCharEncodingOffset )
|
||||
- encodingOffset = 0;
|
||||
- else if ( encodingOffset == 0 )
|
||||
- encodingOffset = defaultCharEncodingOffset;
|
||||
- }
|
||||
-
|
||||
- *offset++ = encodingOffset;
|
||||
+ /* everything is off by 1 due to the artificial glyph 0 */
|
||||
+ *offset++ = encodingOffset == 0xFFFF ? 0xFFFF
|
||||
+ : encodingOffset + 1;
|
||||
}
|
||||
}
|
||||
FT_Stream_ExitFrame( stream );
|
||||
--
|
||||
2.22.0
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
Summary: A free and portable font rendering engine
|
||||
Name: freetype
|
||||
Version: 2.10.0
|
||||
Release: 3%{?dist}
|
||||
Version: 2.10.1
|
||||
Release: 1%{?dist}
|
||||
License: (FTL or GPLv2+) and BSD and MIT and Public Domain and zlib with acknowledgement
|
||||
URL: http://www.freetype.org
|
||||
Source: http://download.savannah.gnu.org/releases/freetype/freetype-%{version}.tar.bz2
|
||||
Source1: http://download.savannah.gnu.org/releases/freetype/freetype-doc-%{version}.tar.bz2
|
||||
Source2: http://download.savannah.gnu.org/releases/freetype/ft2demos-%{version}.tar.bz2
|
||||
Source: http://download.savannah.gnu.org/releases/freetype/freetype-%{version}.tar.xz
|
||||
Source1: http://download.savannah.gnu.org/releases/freetype/freetype-doc-%{version}.tar.xz
|
||||
Source2: http://download.savannah.gnu.org/releases/freetype/ft2demos-%{version}.tar.xz
|
||||
Source3: ftconfig.h
|
||||
|
||||
# Enable subpixel rendering (ClearType)
|
||||
@ -24,10 +24,6 @@ Patch4: freetype-2.8-multilib.patch
|
||||
|
||||
Patch5: freetype-2.10.0-internal-outline.patch
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1719132
|
||||
# https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=c149f7397e484c97f45fb75fa1c7fdda2fc646cd
|
||||
Patch6: 0001-pcf-Fix-handling-of-undefined-glyph-56067.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libX11-devel
|
||||
BuildRequires: libpng-devel
|
||||
@ -85,8 +81,6 @@ popd
|
||||
%patch4 -p1 -b .multilib
|
||||
%patch5 -p1 -b .internal-outline
|
||||
|
||||
%patch6 -p1 -b .undefined-pcf-glyph
|
||||
|
||||
%build
|
||||
|
||||
%configure --disable-static \
|
||||
@ -198,6 +192,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la}
|
||||
%{_mandir}/man1/*
|
||||
|
||||
%changelog
|
||||
* Sat Oct 12 2019 Michael Kuhn <suraia@fedoraproject.org> - 2.10.1-1
|
||||
- Update to 2.10.1
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.10.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
|
6
sources
6
sources
@ -1,3 +1,3 @@
|
||||
SHA512 (freetype-2.10.0.tar.bz2) = dfad66f419ea9577f09932e0730c0c887bdcbdbc8152fa7477a0c39d69a5b68476761deed6864ddcc5cf18d100a7a3f728049768e24afcb04b1a74b25b6acf7e
|
||||
SHA512 (freetype-doc-2.10.0.tar.bz2) = e0902983030b7b67443ca88f29a8bb72662de706ddff81309c66b6738b26c5d11dbd00eb75795851ddcd9f93ce05981623884afad096c0defd08bd544f5266d6
|
||||
SHA512 (ft2demos-2.10.0.tar.bz2) = d48cbabd5cc673e0af2e0c4056dba95cee8e08092f881958c6908ea2d4da7104ca81b701d47a17640ac36cbdfd8aa274cc26353bb43f026f55c00d565f2ad641
|
||||
SHA512 (freetype-2.10.1.tar.xz) = c7a565b0ab3dce81927008a6965d5c7540f0dc973fcefdc1677c2e65add8668b4701c2958d25593cb41f706f4488765365d40b93da71dbfa72907394f28b2650
|
||||
SHA512 (freetype-doc-2.10.1.tar.xz) = 7260d0d6b1bd04f9940b456b20d8d8157fc528f5b6a5c2028fe57008bee3e8d0434bdf89589e2e521b04e3e2c43627155549091d3aaf06384b654f795458991e
|
||||
SHA512 (ft2demos-2.10.1.tar.xz) = f1c06fae3d5653d6d8f8d630e531d47b7be4429b122dc826c80791953e61df7374dfc151f90519fe110f78fcbf592d9dbd9e96c83200730a6f04e42760cc3142
|
||||
|
Loading…
Reference in New Issue
Block a user