372 Commits

Author SHA1 Message Date
Cosimo Lupo
17b89d9dde
Merge pull request #1035 from bamidei/split_g_l_y_f_to_one_per_file
Add ability to split glyphs to 1 glyph per ttx file.  Issue #153
2017-11-23 18:30:54 +01:00
Bill Amidei
de94613e08 Updates based upon review feedback for glyf to individual files; include table name in contentOnly file; Remove unnecessary parameters from toXML - leaving only the splitGlyphs optional additional parameter 2017-11-23 07:17:35 -08:00
Jens Kutilek
a35707560c
Merge pull request #1101 from fonttools/beziertools
Move arc length calculations from pens.perimeterPen to misc.bezierTools
2017-11-14 13:38:10 +01:00
Jens Kutilek
dd558f5df8 Move arc length calculations from pens.perimeterPen to misc.bezierTools 2017-11-14 13:03:58 +01:00
Cosimo Lupo
f1049dcaa5 [arrayTools] fix undefined name in Vector._unaryOp
Thanks Miguel
ab02ce49d3 (commitcomment-25599266)
2017-11-14 11:23:12 +00:00
Cosimo Lupo
350b73363b [py23] must define redirect_stderr for py3.4 2017-11-07 12:08:04 +00:00
Cosimo Lupo
d3251241be [py23] Add backports for redirect_stdout/stderr context managers 2017-11-07 11:54:28 +00:00
ReadRoberts
508e0e3770 [psCharstring] Simpler version of test for CFF2Charstring vs T2Charstring. 2017-11-05 19:36:41 -08:00
ReadRoberts
4d8f1546d2 [psCharstrings] Whoops. Debug code that escaped review. 2017-11-05 19:34:17 -08:00
ReadRoberts
83379be568 CFF2 Subr items can have values on the stack after the last operator. These were not getting written to XML. Added new class CFFSubr so that we can make an assertion error in this case if the item is not a CFF2 Subr, and otherwise write the last values on the stack to the XML file 2017-11-02 11:36:10 -07:00
ReadRoberts
8b02b5a294 Fixed issue with reading/writing PrivateDict BlueValues to ttx file. To date, BlueValue arguments have been written as absolute coordinate values, reflecting the history of the CFF ttx table format. However, Behdad Esfahbod pointed out that it is not always possible to roundtrip between the absolute values in the ttx file and the CFF2 default font value and the delta list. This update changes the ttx format so that in PrivateDict BlueValues, the default font values are written as absolute coordinates, preserving continuity with how CFF tables are written, but the region values are written as the deltas from the VariationStore delta list.
This also fixes fonttools/fonttools/issues/1030.

Although the roundtrip is generally possible when a VariationStore is built from source font data using the Superpolator model, it is possible to  build  region definitions that do not follow this model. Behdad cited the Skia "Q" example, where the tail of the Q is affected by two regions defined as:
min=0 peak=0.5 max=0.51 delta=+10
min=0.49 peak=0.5 max=0.51 delta=-10
2017-11-02 11:31:47 -07:00
Cosimo Lupo
94c79e4cbd [fixedTools] add floatToFixedToFloat to __all__ 2017-10-22 12:22:56 +01:00
Cosimo Lupo
28bb992c1f replace int(round(...)) with round(...)
We don't need to cast to int when using the round function from py23,
as this is a backport of python3's built-in round and thus it returns
an int when called with a single argument.
2017-10-22 12:03:52 +01:00
Behdad Esfahbod
117f8f0eb3 [varLib.mutator] Quantize normalized location to F2Dot14 2017-10-20 20:13:14 -04:00
Cosimo Lupo
3a97f425b8 [sstruct] handle format strings with unicode_literals
properly fixes issue with struct module in python < 2.7.7

https://github.com/fonttools/fonttools/issues/993
2017-10-20 11:09:04 +02:00
Cosimo Lupo
8afa763ad2 [arrayTools] fix mixed indentation
This particual file originally contained spaces, so we revert to that...
sorry.
2017-10-11 21:13:23 +01:00
Cosimo Lupo
558dad9028 [arrayTools] add function to iterate over pairs in iterable 2017-10-11 20:43:08 +01:00
Behdad Esfahbod
ab02ce49d3 Implement more ops for arrayTools.Vector
Would be nice to add tests for these...
2017-10-10 13:06:15 +02:00
Behdad Esfahbod
c91f0323db Rename CVTValues to arrayTools.Vector
This is generic, and useful in other cases.
2017-10-10 12:43:15 +02:00
Khaled Hosny
4b3a2eb1d9 Respect SOURCE_DATE_EPOCH for time stamp
For reproducible builds, check the presence of SOURCE_DATE_EPOCH
environment variable and use it for the time stamp. This affects the
head.modified (and head.created in merge.py).

See https://reproducible-builds.org/specs/source-date-epoch/
2017-10-02 11:37:00 +02:00
Bill Amidei
b5edc7e9f5 Add ability to split glyphs to 1 glyph per ttx file. Addresses Issue #153 2017-08-23 12:33:25 -07:00
Sascha Brawer
57f01b27cb [morx] Preliminary code for writing AATLookups
Needs more work.
2017-08-14 21:34:15 +02:00
Masaya Nakamura
3708f2c8d3 Don't cache charString bounds
https://github.com/fonttools/fonttools/pull/970#discussion_r117903692
2017-08-01 10:54:47 +09:00
Masaya Nakamura
a68bfc2458 [psCharStrings] Add recalcBounds() to T2CharString 2017-08-01 10:51:47 +09:00
Cosimo Lupo
25aad9041d minor: fix doctest failing on latest pypy
Expected:
    [-0.0, -0.0, -0.0]
Got:
    [0.0, 0.0, 0.0]
2017-07-24 16:47:07 +01:00
Cosimo Lupo
72baa5a7d5 [cffLib/psCharStrings] remove cffCtx, pass down isCFF2
* Removed `CFFContext`
* Added `isCFF2` argument to CFFFontSet.decompile/compile, used from
  respective ttLib classes
* Index classes get a `isCFF2` argument in constructor (used for
  decompiling); must be True/False if `file` argument is not None;
  it is stored as self._isCFF2 to support lazy loading
* Removed `TopDictData` class; reuse same `TopDictIndexCompiler` for
  both CFF and CFF2
* `CFFWriter` and all `*Compiler` classes get an `isCFF2` argument;
  defaults to the parent compiler's `isCFF2` attribute
* Removed `size` argument from `produceItem` method as unused and
  useless (`len(data)` is the same)
* psCharStrings: removed useless ByteCodeBase class
* A reference to the TopDict's VarStoreData is passed down to all
  the FontDicts' PrivateDict, so it can be used to get the number of
  regions while decompiling blend and vsindex operators

See dicussion:
https://github.com/fonttools/fonttools/pull/968#issuecomment-309920007
2017-07-19 18:18:58 +01:00
Miguel Sousa
dbf78fe930 [psCharStrings] Fix assert 2017-07-12 22:50:06 -07:00
ReadRoberts
386f16a233 Fix formatting for init function. 2017-06-20 16:23:52 -07:00
ReadRoberts
38cde93a1c psCharStrings.py. Fix bug: allow T1 charstrings to not have private attribute. 2017-06-20 16:23:52 -07:00
ReadRoberts
7acfe1f6a8 Fix bug in changing class API’s while doing work to remove global state. Needed to make ‘private’ argument to SimpleT2Decompiler __init__() be optional. It is not needed by CFF decompilation. 2017-06-20 16:23:52 -07:00
ReadRoberts
af23a781e4 Removed global state from cffLib.py; introduced instance-specific context class instead. Also deprecated maxstack operator, per OpenType spec update 1.8.1, as this simplified some of the context passing logic. Still not thoroughly tested; convertCFFToCFF2() function has not yet been updated to work with new logic. 2017-06-20 16:23:52 -07:00
ReadRoberts
1c53437e39 Folded CFF2 classes into CFF classes. Removed:
TopDict2Decompiler
PrivateDict2Decompiler
PrivateDict2Compiler
Working towards using one set of classes for both CFF2 and CFF data.
2017-06-20 16:23:52 -07:00
ReadRoberts
c33ae5c96a Folded CFF2 classes into CFF classes. Removed:
SimpleCFF2DEcompiler
CFF2CharString
GlobalSubrsIndex2
SubrsIndex2
CharstringIndex2
Working towards using one set of classes for both CFF2 and CFF data.
2017-06-20 16:23:52 -07:00
ReadRoberts
5fb2688567 psCharstring.py. Added CFF2 specific operators to t2Operators list, removed cff2Operators list. Working towards using one set of classes for both CFF2 and CFF data. 2017-06-20 16:23:52 -07:00
ReadRoberts
88e72e2c56 psCharstrings.py. Fold CFF2CharString() logic into T2Charstring(). Working towards using one set of classes for both CFF2 and CFF data. 2017-06-20 16:23:52 -07:00
Behdad Esfahbod
f056c124e5 [misc.classifyTools] Make classification order stable
Sets don't have a welldefined comparison function, so sort them...

Not the most efficient implementation, but good enough.

Fixes https://github.com/fonttools/fonttools/issues/927
2017-04-18 15:57:14 -07:00
Sascha Brawer
e8530360bd [name] Add helper for building multi-lingual names
Fixes https://github.com/fonttools/fonttools/issues/921.
2017-04-19 02:26:32 +08:00
Behdad Esfahbod
e9eb1f3297 Fix __all__ entry
Fixes https://github.com/fonttools/fonttools/issues/920
2017-04-13 15:49:01 -07:00
Cosimo Lupo
1e31e55682
[loggingTools] add docstring to exemplify usage of LogMixin 2017-04-12 11:20:42 +01:00
Cosimo Lupo
cca1d20b0e
[loggingTools] added LogMixin class
This is useful to quickly add logging functionality to classes, and
to reduce boilerplate.

It adds a 'log' property to the class inheriting from it, which uses
logging.getLogger to get a logging.Logger (sigleton) object named after
<module>.<class> of self.
2017-04-11 18:40:52 +01:00
Cosimo Lupo
fab26fd5c1
[loggingTools] rename 'match' to 'assertRegex'
https://github.com/fonttools/fonttools/pull/913#discussion_r110820088

https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRegex
2017-04-11 09:34:39 +01:00
Cosimo Lupo
9528717f6e
[loggingTools] add 'match' method to CapturingLogHandler
Can be useful for writing tests:

>>> with CapturingLogHandler(log, "WARNING") as captor:
...     # do something with logging
>>> assert captor.match('some .* pattern')
2017-04-10 19:47:48 +01:00
Cosimo Lupo
a8442490dd
[py23] add backport for python 3's SimpleNamespace class
This can be useful sometimes. The code is taken from the docs:

https://docs.python.org/3/library/types.html#types.SimpleNamespace
2017-04-10 19:47:48 +01:00
Miguel Sousa
5e115c1d2a [CFF2] Report the correct number of regions in the font
This change also makes the processing of the blend operator to be as described at https://www.microsoft.com/typography/otspec/cff2charstr.htm#section4.5
2017-03-23 17:12:31 -07:00
Miguel Sousa
bba1d9f225 [CFF2] Support ‘maxstack’ 2017-03-13 00:02:13 -07:00
Miguel Sousa
64d5119642 whitespace 2017-03-09 21:30:28 -08:00
Cosimo Lupo
33b42f47b6
[cffLib/psCharStrings] fix IndexError with empty deltas
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
``
2017-03-09 14:21:38 +00:00
ReadRoberts
2b2aca1290
Add CFF2 support. 2017-03-05 22:53:04 +00:00
Behdad Esfahbod
69c11928a2 [interpolatable] Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
19e695775f [symfont] Minor 2017-02-21 12:01:10 -06:00