diff --git a/.cvsignore b/.cvsignore index e69de29..72aea90 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +fonttools-2005-03-15.210812.tar.bz2 diff --git a/fonttools-20050315-20050624.patch b/fonttools-20050315-20050624.patch new file mode 100644 index 0000000..31ba5e9 --- /dev/null +++ b/fonttools-20050315-20050624.patch @@ -0,0 +1,279 @@ +diff -urN fonttools-20050315/Lib/fontTools/fondLib.py fonttools-20050624/Lib/fontTools/fondLib.py +--- fonttools-20050315/Lib/fontTools/fondLib.py 2002-10-29 19:19:25.000000000 +0330 ++++ fonttools-20050624/Lib/fontTools/fondLib.py 2005-06-24 14:05:16.000000000 +0430 +@@ -12,6 +12,7 @@ + DEBUG = 0 + + headerformat = """ ++ > + ffFlags: h + ffFamID: h + ffFirstChar: h +@@ -127,9 +128,9 @@ + def _getheader(self): + data = self.FOND.data + sstruct.unpack(headerformat, data[:28], self) +- self.ffProperty = struct.unpack("9h", data[28:46]) +- self.ffIntl = struct.unpack("hh", data[46:50]) +- self.ffVersion, = struct.unpack("h", data[50:FONDheadersize]) ++ self.ffProperty = struct.unpack(">9h", data[28:46]) ++ self.ffIntl = struct.unpack(">hh", data[46:50]) ++ self.ffVersion, = struct.unpack(">h", data[50:FONDheadersize]) + + if DEBUG: + self._rawheader = data[:FONDheadersize] +@@ -137,9 +138,9 @@ + + def _buildheader(self): + header = sstruct.pack(headerformat, self) +- header = header + apply(struct.pack, ("9h",) + self.ffProperty) +- header = header + apply(struct.pack, ("hh",) + self.ffIntl) +- header = header + struct.pack("h", self.ffVersion) ++ header = header + apply(struct.pack, (">9h",) + self.ffProperty) ++ header = header + apply(struct.pack, (">hh",) + self.ffIntl) ++ header = header + struct.pack(">h", self.ffVersion) + if DEBUG: + print "header is the same?", self._rawheader == header and 'yes.' or 'no.' + if self._rawheader <> header: +@@ -149,12 +150,12 @@ + def _getfontassociationtable(self): + data = self.FOND.data + offset = FONDheadersize +- numberofentries, = struct.unpack("h", data[offset:offset+2]) ++ numberofentries, = struct.unpack(">h", data[offset:offset+2]) + numberofentries = numberofentries + 1 + size = numberofentries * 6 + self.fontAssoc = [] + for i in range(offset + 2, offset + size, 6): +- self.fontAssoc.append(struct.unpack("3h", data[i:i+6])) ++ self.fontAssoc.append(struct.unpack(">3h", data[i:i+6])) + + self._endoffontassociationtable = offset + size + 2 + if DEBUG: +@@ -162,9 +163,9 @@ + self.parsedthings.append((offset, self._endoffontassociationtable, 'fontassociationtable')) + + def _buildfontassociationtable(self): +- data = struct.pack("h", len(self.fontAssoc) - 1) ++ data = struct.pack(">h", len(self.fontAssoc) - 1) + for size, stype, ID in self.fontAssoc: +- data = data + struct.pack("3h", size, stype, ID) ++ data = data + struct.pack(">3h", size, stype, ID) + + if DEBUG: + print "font association table is the same?", self._rawfontassociationtable == data and 'yes.' or 'no.' +@@ -194,10 +195,10 @@ + return + boxes = {} + data = self._rawoffsettable[6:] +- numstyles = struct.unpack("h", data[:2])[0] + 1 ++ numstyles = struct.unpack(">h", data[:2])[0] + 1 + data = data[2:] + for i in range(numstyles): +- style, l, b, r, t = struct.unpack("hhhhh", data[:10]) ++ style, l, b, r, t = struct.unpack(">hhhhh", data[:10]) + boxes[style] = (l, b, r, t) + data = data[10:] + self.boundingBoxes = boxes +@@ -206,9 +207,9 @@ + if self.boundingBoxes and self._rawoffsettable[:6] == '\0\0\0\0\0\6': + boxes = self.boundingBoxes.items() + boxes.sort() +- data = '\0\0\0\0\0\6' + struct.pack("h", len(boxes) - 1) ++ data = '\0\0\0\0\0\6' + struct.pack(">h", len(boxes) - 1) + for style, (l, b, r, t) in boxes: +- data = data + struct.pack("hhhhh", style, l, b, r, t) ++ data = data + struct.pack(">hhhhh", style, l, b, r, t) + self._rawoffsettable = data + + def _getglyphwidthtable(self): +@@ -217,15 +218,15 @@ + return + data = self.FOND.data + offset = self.ffWTabOff +- numberofentries, = struct.unpack("h", data[offset:offset+2]) ++ numberofentries, = struct.unpack(">h", data[offset:offset+2]) + numberofentries = numberofentries + 1 + count = offset + 2 + for i in range(numberofentries): +- stylecode, = struct.unpack("h", data[count:count+2]) ++ stylecode, = struct.unpack(">h", data[count:count+2]) + widthtable = self.widthTables[stylecode] = [] + count = count + 2 + for j in range(3 + self.ffLastChar - self.ffFirstChar): +- width, = struct.unpack("h", data[count:count+2]) ++ width, = struct.unpack(">h", data[count:count+2]) + widthtable.append(width) + count = count + 2 + +@@ -238,15 +239,15 @@ + self._rawglyphwidthtable = "" + return + numberofentries = len(self.widthTables) +- data = struct.pack('h', numberofentries - 1) ++ data = struct.pack('>h', numberofentries - 1) + tables = self.widthTables.items() + tables.sort() + for stylecode, table in tables: +- data = data + struct.pack('h', stylecode) ++ data = data + struct.pack('>h', stylecode) + if len(table) <> (3 + self.ffLastChar - self.ffFirstChar): + raise error, "width table has wrong length" + for width in table: +- data = data + struct.pack('h', width) ++ data = data + struct.pack('>h', width) + if DEBUG: + print "glyph width table is the same?", self._rawglyphwidthtable == data and 'yes.' or 'no.' + self._rawglyphwidthtable = data +@@ -257,17 +258,17 @@ + return + data = self.FOND.data + offset = self.ffKernOff +- numberofentries, = struct.unpack("h", data[offset:offset+2]) ++ numberofentries, = struct.unpack(">h", data[offset:offset+2]) + numberofentries = numberofentries + 1 + count = offset + 2 + for i in range(numberofentries): +- stylecode, = struct.unpack("h", data[count:count+2]) ++ stylecode, = struct.unpack(">h", data[count:count+2]) + count = count + 2 +- numberofpairs, = struct.unpack("h", data[count:count+2]) ++ numberofpairs, = struct.unpack(">h", data[count:count+2]) + count = count + 2 + kerntable = self.kernTables[stylecode] = [] + for j in range(numberofpairs): +- firstchar, secondchar, kerndistance = struct.unpack("cch", data[count:count+4]) ++ firstchar, secondchar, kerndistance = struct.unpack(">cch", data[count:count+4]) + kerntable.append((ord(firstchar), ord(secondchar), kerndistance)) + count = count + 4 + +@@ -281,14 +282,14 @@ + self.ffKernOff = 0 + return + numberofentries = len(self.kernTables) +- data = [struct.pack('h', numberofentries - 1)] ++ data = [struct.pack('>h', numberofentries - 1)] + tables = self.kernTables.items() + tables.sort() + for stylecode, table in tables: +- data.append(struct.pack('h', stylecode)) +- data.append(struct.pack('h', len(table))) # numberofpairs ++ data.append(struct.pack('>h', stylecode)) ++ data.append(struct.pack('>h', len(table))) # numberofpairs + for firstchar, secondchar, kerndistance in table: +- data.append(struct.pack("cch", chr(firstchar), chr(secondchar), kerndistance)) ++ data.append(struct.pack(">cch", chr(firstchar), chr(secondchar), kerndistance)) + + data = string.join(data, '') + +@@ -308,9 +309,9 @@ + return + data = self.FOND.data + self.fondClass, self.glyphTableOffset, self.styleMappingReserved, = \ +- struct.unpack("hll", data[offset:offset+10]) +- self.styleIndices = struct.unpack('48b', data[offset + 10:offset + 58]) +- stringcount, = struct.unpack('h', data[offset+58:offset+60]) ++ struct.unpack(">hll", data[offset:offset+10]) ++ self.styleIndices = struct.unpack('>48b', data[offset + 10:offset + 58]) ++ stringcount, = struct.unpack('>h', data[offset+58:offset+60]) + + count = offset + 60 + for i in range(stringcount): +@@ -331,14 +332,14 @@ + if not self.styleIndices: + self._rawstylemappingtable = "" + return +- data = struct.pack("hll", self.fondClass, self.glyphTableOffset, ++ data = struct.pack(">hll", self.fondClass, self.glyphTableOffset, + self.styleMappingReserved) + + self._packstylestrings() +- data = data + apply(struct.pack, ("48b",) + self.styleIndices) ++ data = data + apply(struct.pack, (">48b",) + self.styleIndices) + + stringcount = len(self.styleStrings) +- data = data + struct.pack("h", stringcount) ++ data = data + struct.pack(">h", stringcount) + for string in self.styleStrings: + data = data + chr(len(string)) + string + +@@ -401,7 +402,7 @@ + data = self._rawstylemappingtable + if not data: + return +- data = data[:2] + struct.pack("l", self.glyphTableOffset) + data[6:] ++ data = data[:2] + struct.pack(">l", self.glyphTableOffset) + data[6:] + self._rawstylemappingtable = data + + def _getglyphencodingsubtable(self): +@@ -410,7 +411,7 @@ + return + offset = self.ffStylOff + self.glyphTableOffset + data = self.FOND.data +- numberofentries, = struct.unpack("h", data[offset:offset+2]) ++ numberofentries, = struct.unpack(">h", data[offset:offset+2]) + count = offset + 2 + for i in range(numberofentries): + glyphcode = ord(data[count]) +@@ -430,7 +431,7 @@ + self._rawglyphencodingsubtable = "" + return + numberofentries = len(self.glyphEncoding) +- data = struct.pack("h", numberofentries) ++ data = struct.pack(">h", numberofentries) + items = self.glyphEncoding.items() + items.sort() + for glyphcode, glyphname in items: +diff -urN fonttools-20050315/Lib/fontTools/misc/psCharStrings.py fonttools-20050624/Lib/fontTools/misc/psCharStrings.py +--- fonttools-20050315/Lib/fontTools/misc/psCharStrings.py 2005-02-24 00:52:27.000000000 +0330 ++++ fonttools-20050624/Lib/fontTools/misc/psCharStrings.py 2005-05-07 13:11:12.000000000 +0430 +@@ -780,7 +780,8 @@ + # + def op_hflex(self, index): + dx1, dx2, dy2, dx3, dx4, dx5, dx6 = self.popall() +- dy1 = dy3 = dy4 = dy5 = dy6 = 0 ++ dy1 = dy3 = dy4 = dy6 = 0 ++ dy5 = -dy2 + self.rCurveTo((dx1, dy1), (dx2, dy2), (dx3, dy3)) + self.rCurveTo((dx4, dy4), (dx5, dy5), (dx6, dy6)) + def op_flex(self, index): +@@ -789,7 +790,9 @@ + self.rCurveTo((dx4, dy4), (dx5, dy5), (dx6, dy6)) + def op_hflex1(self, index): + dx1, dy1, dx2, dy2, dx3, dx4, dx5, dy5, dx6 = self.popall() +- dy3 = dy4 = dy6 = 0 ++ dy3 = dy4 = 0 ++ dy6 = -(dy1 + dy2 + dy3 + dy4 + dy5) ++ + self.rCurveTo((dx1, dy1), (dx2, dy2), (dx3, dy3)) + self.rCurveTo((dx4, dy4), (dx5, dy5), (dx6, dy6)) + def op_flex1(self, index): +@@ -798,9 +801,9 @@ + dy = dy1 + dy2 + dy3 + dy4 + dy5 + if abs(dx) > abs(dy): + dx6 = d6 +- dy6 = 0 ++ dy6 = -dy + else: +- dx6 = 0 ++ dx6 = -dx + dy6 = d6 + self.rCurveTo((dx1, dy1), (dx2, dy2), (dx3, dy3)) + self.rCurveTo((dx4, dy4), (dx5, dy5), (dx6, dy6)) +diff -urN fonttools-20050315/Lib/fontTools/pens/basePen.py fonttools-20050624/Lib/fontTools/pens/basePen.py +--- fonttools-20050315/Lib/fontTools/pens/basePen.py 2005-03-08 13:20:55.000000000 +0330 ++++ fonttools-20050624/Lib/fontTools/pens/basePen.py 2005-04-10 17:48:42.000000000 +0430 +@@ -162,8 +162,11 @@ + of the base glyph and draws it onto self. + """ + from fontTools.pens.transformPen import TransformPen +- glyph = self.glyphSet.get(glyphName) +- if glyph is not None: ++ try: ++ glyph = self.glyphSet[glyphName] ++ except KeyError: ++ pass ++ else: + tPen = TransformPen(self, transformation) + glyph.draw(tPen) + diff --git a/fonttools.spec b/fonttools.spec new file mode 100644 index 0000000..6d415c8 --- /dev/null +++ b/fonttools.spec @@ -0,0 +1,88 @@ +%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%define alphatag 20050624cvs + +Name: fonttools +Version: 2.0 +Release: 0.3.%{alphatag}%{?dist} +Summary: A tool to convert True/OpenType fonts to XML and back + +Group: Development/Tools +License: BSD +URL: http://sourceforge.net/projects/fonttools/ +Source0: http://fonttools.sourceforge.net/cvs-snapshots/bzip2/fonttools-2005-03-15.210812.tar.bz2 +Patch1: fonttools-20050315-20050624.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: python-devel python-numeric +Requires: python-abi = %(%{__python} -c "import sys ; print sys.version[:3]") +Requires: python-numeric + + +%description +TTX/FontTools is a tool for manipulating TrueType and OpenType fonts. It is +written in Python and has a BSD-style, open-source license. TTX can dump +TrueType and OpenType fonts to an XML-based text format and vice versa. + + +%prep +%setup -q -n %{name} +%patch1 -p1 -b .20050624 + +%{__sed} -i.nobang '1 d' Lib/fontTools/ttx.py +%{__chmod} a-x LICENSE.txt + + +%build +CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build + + +%install +rm -rf $RPM_BUILD_ROOT +%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +rm -rf $RPM_BUILD_ROOT%{python_sitearch}/FontTools/fontTools/ttLib/test + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%doc LICENSE.txt +%doc Doc/bugs.txt Doc/ChangeLog.txt Doc/changes.txt Doc/documentation.html +%{python_sitearch}/FontTools.pth +%dir %{python_sitearch}/FontTools +%dir %{python_sitearch}/FontTools/fontTools +%dir %{python_sitearch}/FontTools/fontTools/encodings +%dir %{python_sitearch}/FontTools/fontTools/misc +%dir %{python_sitearch}/FontTools/fontTools/pens +%dir %{python_sitearch}/FontTools/fontTools/ttLib +%dir %{python_sitearch}/FontTools/fontTools/ttLib/tables +%{python_sitearch}/FontTools/*.py +%{python_sitearch}/FontTools/*.pyc +%ghost %{python_sitearch}/FontTools/*.pyo +%{python_sitearch}/FontTools/fontTools/*.py +%{python_sitearch}/FontTools/fontTools/*.pyc +%ghost %{python_sitearch}/FontTools/fontTools/*.pyo +%{python_sitearch}/FontTools/fontTools/*/*.py +%{python_sitearch}/FontTools/fontTools/*/*.pyc +%ghost %{python_sitearch}/FontTools/fontTools/*/*.pyo +%{python_sitearch}/FontTools/fontTools/*/*/*.py +%{python_sitearch}/FontTools/fontTools/*/*/*.pyc +%ghost %{python_sitearch}/FontTools/fontTools/*/*/*.pyo +%{python_sitearch}/FontTools/fontTools/misc/eexecOp.so +%{_bindir}/ttx + + +%changelog +* Wed Feb 01 2006 Roozbeh Pournader - 2.0-0.3.20050624cvs +- Use upstream snapshots, moving the difference into a patch +- Change alphatag time to the latest change in CVS +- Use %%{python_sitearch} instead of %%{python_sitelib} (for x86_86) +- Use sed instead of a patch to remove shebang + +* Sun Jan 08 2006 Roozbeh Pournader - 2.0-0.2.20060103cvs +- Add %%{?dist} tag + +* Fri Jan 06 2006 Roozbeh Pournader - 2.0-0.1.20060103cvs +- Initial packaging diff --git a/sources b/sources index e69de29..d7dc398 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +b44a299a0530a2a4f65d1937aa99f734 fonttools-2005-03-15.210812.tar.bz2