This reverts commit d83c2fb2090fa58f94fdf32d1aa2d2d8665cec05.
This is wrong. We should insert if and only iff there's at least one of the
fonts with a Format1. Yours doesn't look at all fonts. Since this one is not a
bugfix but improvement, I'll fix it separately.
Class2Record is mutable, hence doing `[rec2] * l.Class2Count` produces a list containing multiple references to the same instance. When later on we do the interpolation, modifying one would modify them all.
We need to instantiate distinct objects.
See 6f41c2ab53 (commitcomment-21310803)
b2825ff6b3 (commitcomment-21256990)
Note that the "Tests/varLib/__init__.py" file is necessary so that pytest can distinguish between same-named test modules (e.g. we have another "builder_test.py" file in Tests/feaLib).
The problem was that `break` statement: we stopped searching for SHORT columns in each delta set after finding the first, but rows can contain more than one in any order.
Fixes https://github.com/googlei18n/fontmake/issues/271
On some Python builds, Unicode characters above U+FFFF get escaped
to two question marks ?? instead of just one ?. This is not a real
problem, but for testing it is a nuisance when the results depend
on the platform.
This class had been added in the `morx` branch, and I wanted
to merge it into master. While writing tests for it, I noticed
that `otConverters` has meanwhile been extended by an `UInt8`
converter. Therefore, only adding a test for the existing
implementation.
I've got some changes in the `morx` branch which I'd like to merge
into master. So I'm writing this unit test as an example how to
test `otConverter` code.
The syntax tree representation now reflects the syntax of feature files.
Before this change, FeatureNames did not have their own `ast.Block`,
which had made the code quite messy.
$ ttx -t CFF "font.otf"
Dumping "font.otf" to "font.ttx"...
Dumping 'CFF ' table...
ERROR: Unhandled exception has occurred
Traceback (most recent call last):
File "fonttools/Lib/fontTools/ttx.py", line 384, in main
process(jobs, options)
File "fonttools/Lib/fontTools/ttx.py", line 358, in process
action(input, output, options)
File "fonttools/Lib/fontTools/misc/loggingTools.py", line 372, in wrapper
return func(*args, **kwds)
File "fonttools/Lib/fontTools/ttx.py", line 258, in ttDump
newlinestr=options.newlinestr)
File "fonttools/Lib/fontTools/ttLib/__init__.py", line 311, in saveXML
self._tableToXML(tableWriter, tag, progress)
File "fonttools/Lib/fontTools/ttLib/__init__.py", line 348, in _tableToXML
table.toXML(writer, self, progress)
File "fonttools/Lib/fontTools/ttLib/tables/C_F_F_.py", line 42, in toXML
self.cff.toXML(writer, progress)
File "fonttools/Lib/fontTools/cffLib.py", line 135, in toXML
font.toXML(xmlWriter, progress)
File "fonttools/Lib/fontTools/cffLib.py", line 2178, in toXML
BaseDict.toXML(self, xmlWriter, progress)
File "fonttools/Lib/fontTools/cffLib.py", line 2128, in toXML
conv.xmlWrite(xmlWriter, name, value, progress)
File "fonttools/Lib/fontTools/cffLib.py", line 1120, in xmlWrite
value.toXML(xmlWriter, progress)
File "fonttools/Lib/fontTools/cffLib.py", line 2128, in toXML
conv.xmlWrite(xmlWriter, name, value, progress)
File "fonttools/Lib/fontTools/cffLib.py", line 1089, in xmlWrite
if isinstance(value[0], list):
IndexError: list index out of range
After 2b2aca1, DictCompiler/Decompiler's `arg_delta` method unconditionally attempts to get the first item to check if it's a list, but this fails with `IndexError` when the value is empty.
```
Traceback (most recent call last):
[...]
File "/Users/cosimolupo/Documents/Github/ufo2ft/Lib/ufo2ft/otfPostProcessor.py", line 15, in __init__
otf.save(stream)
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/ttLib/__init__.py", line 219, in save
self._writeTable(tag, writer, done)
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/ttLib/__init__.py", line 658, in _writeTable
tabledata = self.getTableData(tag)
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/ttLib/__init__.py", line 669, in getTableData
return self.tables[tag].compile(self)
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/ttLib/tables/C_F_F_.py", line 20, in compile
self.cff.compile(f, otFont)
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/cffLib.py", line 124, in compile
writer.toFile(file)
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/cffLib.py", line 300, in toFile
endPos = pos + item.getDataLength()
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/cffLib.py", line 1858, in getDataLength
return len(self.compile("getDataLength"))
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/cffLib.py", line 1879, in compile
data.append(arghandler(value))
File "/Users/cosimolupo/Documents/Github/fonttools/Lib/fontTools/cffLib.py", line 1910, in arg_delta
val0 = value[0]
IndexError: list index out of range
``
Before this change, some table statements would allow empty statements
(just a semicolon) while others would not allow them. After this change,
we're more consistent.