Resolves:rh#1240265- fonttools 2.5 takes too much memory
This commit is contained in:
parent
489410a433
commit
3922000b6c
103
0001-EBLC-Decompile-and-release-copies-of-data-early.patch
Normal file
103
0001-EBLC-Decompile-and-release-copies-of-data-early.patch
Normal file
@ -0,0 +1,103 @@
|
||||
diff -urN fonttools-3.0/Lib/fontTools/ttLib/tables/E_B_L_C_.py fonttools-3.0.new/Lib/fontTools/ttLib/tables/E_B_L_C_.py
|
||||
--- fonttools-3.0/Lib/fontTools/ttLib/tables/E_B_L_C_.py 2015-08-31 23:27:15.000000000 +0530
|
||||
+++ fonttools-3.0.new/Lib/fontTools/ttLib/tables/E_B_L_C_.py 2016-03-06 14:03:58.406847533 +0530
|
||||
@@ -71,44 +71,46 @@
|
||||
|
||||
# Save the original data because offsets are from the start of the table.
|
||||
origData = data
|
||||
+ i=0
|
||||
|
||||
- dummy, data = sstruct.unpack2(eblcHeaderFormat, data, self)
|
||||
-
|
||||
+ dummy = sstruct.unpack(eblcHeaderFormat, data[:8], self)
|
||||
+ i += 8
|
||||
self.strikes = []
|
||||
for curStrikeIndex in range(self.numSizes):
|
||||
curStrike = Strike()
|
||||
self.strikes.append(curStrike)
|
||||
curTable = curStrike.bitmapSizeTable
|
||||
- dummy, data = sstruct.unpack2(bitmapSizeTableFormatPart1, data, curTable)
|
||||
+ dummy = sstruct.unpack2(bitmapSizeTableFormatPart1, data[i:i+16], curTable)
|
||||
+ i += 16
|
||||
for metric in ('hori', 'vert'):
|
||||
metricObj = SbitLineMetrics()
|
||||
vars(curTable)[metric] = metricObj
|
||||
- dummy, data = sstruct.unpack2(sbitLineMetricsFormat, data, metricObj)
|
||||
- dummy, data = sstruct.unpack2(bitmapSizeTableFormatPart2, data, curTable)
|
||||
+ dummy = sstruct.unpack2(sbitLineMetricsFormat, data[i:i+12], metricObj)
|
||||
+ i += 12
|
||||
+ dummy = sstruct.unpack(bitmapSizeTableFormatPart2, data[i:i+8], curTable)
|
||||
+ i += 8
|
||||
|
||||
for curStrike in self.strikes:
|
||||
curTable = curStrike.bitmapSizeTable
|
||||
for subtableIndex in range(curTable.numberOfIndexSubTables):
|
||||
- lowerBound = curTable.indexSubTableArrayOffset + subtableIndex * indexSubTableArraySize
|
||||
- upperBound = lowerBound + indexSubTableArraySize
|
||||
- data = origData[lowerBound:upperBound]
|
||||
+ i = curTable.indexSubTableArrayOffset + subtableIndex * indexSubTableArraySize
|
||||
|
||||
- tup = struct.unpack(indexSubTableArrayFormat, data)
|
||||
+ tup = struct.unpack(indexSubTableArrayFormat, data[i:i+indexSubTableArraySize])
|
||||
(firstGlyphIndex, lastGlyphIndex, additionalOffsetToIndexSubtable) = tup
|
||||
- offsetToIndexSubTable = curTable.indexSubTableArrayOffset + additionalOffsetToIndexSubtable
|
||||
- data = origData[offsetToIndexSubTable:]
|
||||
+ i = curTable.indexSubTableArrayOffset + additionalOffsetToIndexSubtable
|
||||
|
||||
- tup = struct.unpack(indexSubHeaderFormat, data[:indexSubHeaderSize])
|
||||
+ tup = struct.unpack(indexSubHeaderFormat, data[i:i+indexSubHeaderSize])
|
||||
(indexFormat, imageFormat, imageDataOffset) = tup
|
||||
|
||||
indexFormatClass = self.getIndexFormatClass(indexFormat)
|
||||
- indexSubTable = indexFormatClass(data[indexSubHeaderSize:], ttFont)
|
||||
+ indexSubTable = indexFormatClass(data[i+indexSubHeaderSize:], ttFont)
|
||||
indexSubTable.firstGlyphIndex = firstGlyphIndex
|
||||
indexSubTable.lastGlyphIndex = lastGlyphIndex
|
||||
indexSubTable.additionalOffsetToIndexSubtable = additionalOffsetToIndexSubtable
|
||||
indexSubTable.indexFormat = indexFormat
|
||||
indexSubTable.imageFormat = imageFormat
|
||||
indexSubTable.imageDataOffset = imageDataOffset
|
||||
+ indexSubTable.decompile() # https://github.com/behdad/fonttools/issues/317
|
||||
curStrike.indexSubTables.append(indexSubTable)
|
||||
|
||||
def compile(self, ttFont):
|
||||
@@ -336,7 +338,6 @@
|
||||
if not hasattr(self, "data"):
|
||||
raise AttributeError(attr)
|
||||
self.decompile()
|
||||
- del self.data, self.ttFont
|
||||
return getattr(self, attr)
|
||||
|
||||
# This method just takes care of the indexSubHeader. Implementing subclasses
|
||||
@@ -439,6 +440,7 @@
|
||||
|
||||
self.names = list(map(self.ttFont.getGlyphName, glyphIds))
|
||||
self.removeSkipGlyphs()
|
||||
+ del self.data, self.ttFont
|
||||
|
||||
def compile(self, ttFont):
|
||||
# First make sure that all the data lines up properly. Formats 1 and 3
|
||||
@@ -525,6 +527,7 @@
|
||||
offsets = [self.imageSize * i + self.imageDataOffset for i in range(len(glyphIds)+1)]
|
||||
self.locations = list(zip(offsets, offsets[1:]))
|
||||
self.names = list(map(self.ttFont.getGlyphName, glyphIds))
|
||||
+ del self.data, self.ttFont
|
||||
|
||||
def compile(self, ttFont):
|
||||
glyphIds = list(map(ttFont.getGlyphID, self.names))
|
||||
@@ -556,6 +559,7 @@
|
||||
offsets = [offset + self.imageDataOffset for offset in offsets]
|
||||
self.locations = list(zip(offsets, offsets[1:]))
|
||||
self.names = list(map(self.ttFont.getGlyphName, glyphIds))
|
||||
+ del self.data, self.ttFont
|
||||
|
||||
def compile(self, ttFont):
|
||||
# First make sure that all the data lines up properly. Format 4
|
||||
@@ -594,6 +598,7 @@
|
||||
offsets = [self.imageSize * i + self.imageDataOffset for i in range(len(glyphIds)+1)]
|
||||
self.locations = list(zip(offsets, offsets[1:]))
|
||||
self.names = list(map(self.ttFont.getGlyphName, glyphIds))
|
||||
+ del self.data, self.ttFont
|
||||
|
||||
def compile(self, ttFont):
|
||||
self.imageDataOffset = min(zip(*self.locations)[0])
|
@ -2,11 +2,12 @@
|
||||
|
||||
Name: fonttools
|
||||
Version: 3.0
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: A tool to convert True/OpenType fonts to XML and back
|
||||
License: BSD
|
||||
URL: https://github.com/behdad/%{name}/
|
||||
Source0: https://github.com/behdad/%{name}/archive/%{gittag0}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Patch0: 0001-EBLC-Decompile-and-release-copies-of-data-early.patch
|
||||
|
||||
Requires: python3-fonttools
|
||||
BuildArch: noarch
|
||||
@ -46,6 +47,7 @@ TrueType and OpenType fonts to an XML-based text format and vice versa.
|
||||
|
||||
%prep
|
||||
%setup -qc
|
||||
%patch0 -p0
|
||||
pushd %{name}-%{version}
|
||||
mv LICENSE.txt Doc/documentation.html Doc/changes.txt ../
|
||||
popd
|
||||
@ -97,6 +99,9 @@ popd
|
||||
%{python3_sitelib}/FontTools
|
||||
|
||||
%changelog
|
||||
* Sun Mar 06 2016 Parag Nemade <pnemade AT redhat DOT com> - 3.0-4
|
||||
- Resolves:rh#1240265- fonttools 2.5 takes too much memory
|
||||
|
||||
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user