4619 Commits

Author SHA1 Message Date
Cosimo Lupo
8b50ed56d9 add auto-generated Blocks.py and ScriptsExtensions.py 2017-11-20 18:15:09 +01:00
Cosimo Lupo
541e7b92d3 [buildUCD] also parse Blocks.txt and ScriptExtensions.txt 2017-11-20 18:12:15 +01:00
Cosimo Lupo
6d8813c00a [Tests] move unicodedata/scripts_test to unicodedata_test 2017-11-20 18:09:56 +01:00
Cosimo Lupo
1ed78b12f5 [unicodedata] rename scripts.py to Scripts.py
let's use the same names as the original UCD data files for simplicity
2017-11-20 17:37:45 +01:00
Cosimo Lupo
203d1c6f89 [buildUCD] fix docstring 2017-11-20 15:40:56 +01:00
Cosimo Lupo
a50967d79b [Tests] add tests for 'Unknown' script 2017-11-20 15:39:07 +01:00
Cosimo Lupo
09f5f91769 [Tests] remove tests for old script impl 2017-11-20 13:40:25 +01:00
Cosimo Lupo
b53b878bdc [scripts] update auto-generated module
it now contains two list, one for the ranges and another for the script names
2017-11-20 13:38:49 +01:00
Cosimo Lupo
a17ccc47f3 [buildUCD] also write Unicode license URL to generated modules 2017-11-20 13:38:00 +01:00
Cosimo Lupo
3442da1529 [unicodedata] use bisect.bisect_right function
CPython comes with a fast C implementation of bisect module.
This gives 4 to 5 times speed-ups over my pure-python version.
2017-11-20 13:30:17 +01:00
Cosimo Lupo
5b3c189f6d [buildUCD] split generated ranges and names in two lists
to use the bisect built-in module we need to have two separate
tables, one with the ranges themselves (which we pass to bisect
to get an index) and the other containing the script name for
each range.

Also, allow the buildUCD.py script to load data files from a
local directory, e.g. to allow downstream maintainers to rebuild
the generated modules from local files instead of downloading
from Unicode website.
2017-11-20 13:25:45 +01:00
Cosimo Lupo
2eb59f163f [Tests] add tests for unicodedata.script function 2017-11-17 19:21:45 +00:00
Cosimo Lupo
52d6131525 [unicodedata] add new module and 'script' function
The new `fontTools.unicodedata` module re-exports all the public
functions from the built-in `unicodedata` module, and also adds
additional functions.

The `script` function takes a unicode character and returns the
script name as defined in the UCD "Script.txt" data file.

It's implemented as a simple binary search, plus a memoizing
decorator that caches the results to avoid search the same
character more than once.

The unicodedata2 backport is imported if present, otherwise
the unicodedata built-in is used.
2017-11-17 19:17:17 +00:00
Cosimo Lupo
96dafe4afc [unicodedata] add auto-generated 'scripts' module
containing the script ranges and names from Scripts.txt
2017-11-17 19:16:45 +00:00
Cosimo Lupo
26db10b5ab [MetaTools] add a script to download and parse UCD data files
The script currently only parses the Scripts.txt file and
generates a new python module `fontTools.unicodedata.scripts`
containing a `SCRIPT_RANGES` list of tuples, each containing
the range and the corresponding script name.
2017-11-17 19:15:42 +00:00
Cosimo Lupo
fdab63f0b6 [feaLib.ast] add __str__ to all AST elements
which calls the asFea() method,
so one can e.g. print(doc.statements[0])
2017-11-16 15:40:52 +00:00
Cosimo Lupo
0ff6be5ff8
Merge pull request #1104 from anthrotype/fealib-parser-glyphmap
[feaLib.parser] make Parser accept glyphNames iterable...
2017-11-16 15:02:54 +00:00
Cosimo Lupo
99aa8b0c66 [feaLib.parser] keep supporting (deprecated) glyphMap argument
so we don't break backward compatibility if user code has Parser(path, glyphMap=...)
2017-11-16 14:25:43 +00:00
Cosimo Lupo
e8535f2280 [feaLib.parser] make Parser accept glyphNames iterable...
... instead of a glyphMap dict.

The parser does not actually need a reverse glyph order mapping as
it is not interested in knowing the glyphID from the glyph name,
but only whether a glyph is in the font or not.

This makes it easier for client code (e.g. ufo2ft feature compiler)
to use the feaLib Parser, without having to first construct and pass
it a glyphMap argument.
2017-11-16 13:46:27 +00: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
Miguel Sousa
62df8ba108 [varLib_test] update expected results
The STAT table is now beginning to be generated after
8af430997d
2017-11-13 23:33:55 -08:00
Behdad Esfahbod
8af430997d [varLib] Start generating STAT table
Right now just reflects the axes, and even that with certain limitations:
- AxisOrdering is set to the order axes are defined,
- Name-table entries are not shared with fvar.

Towards https://github.com/LettError/designSpaceDocument/issues/8
2017-11-13 21:25:04 -08:00
Behdad Esfahbod
22f3b466b4 [varLib] Add TODO 2017-11-13 21:01:27 -08:00
Cosimo Lupo
06d1f64d40 requirements.txt: update brotli to 1.0.1 2017-11-13 11:28:44 +00:00
Cosimo Lupo
bb60cc4e2b
Merge pull request #1097 from anthrotype/py23-redirect-stream
[py23] Add backports for redirect_stdout/stderr context managers
2017-11-07 12:35:49 +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
Cosimo Lupo
f100754ffb
Merge pull request #1093 from silnrsi/graphite
Fix small graphite round trip bugs
2017-11-07 09:53:36 +00:00
Martin Hosken
eb003ea697 Fix old bugs 2017-11-06 21:16:16 +07:00
Cosimo Lupo
8bae54c072 Bump version: 3.19.0 → 3.19.1.dev0 2017-11-06 12:30:30 +00:00
Cosimo Lupo
d8170131a3 Release 3.19.0 2017-11-06 12:30:30 +00:00
Cosimo Lupo
939fece619 Updated NEWS.rst 2017-11-06 12:29:03 +00:00
Jens Kutilek
b9bca702f6
[varLib] Try a set of used points instead of all points (#1090)
* Try a set of used points instead of all points when testing whether to share points.
* Amend comment, remove unused variable
2017-11-06 11:49:26 +01:00
Cosimo Lupo
d91faeaf1a
Merge pull request #1091 from readroberts/master
[CFF2] Fixes for writing PrivateDict BlueValues and Subrs to XML.
2017-11-06 10:13:57 +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
Cosimo Lupo
34f06f41a9
Merge pull request #1094 from anthrotype/apple-kern
fix compilation of AAT kern tables
2017-11-04 16:41:53 +00:00
Cosimo Lupo
a12bfa160a [_k_e_r_n_test] test toXML/fromXML for unknown formats 2017-11-04 12:02:57 +00:00
Cosimo Lupo
0f16a790cd minor: fix comment and line length 2017-11-04 11:08:08 +00:00
Cosimo Lupo
d715575794 [_k_e_r_n] fix order of format/coverage bytes
In OT kern subtable header, the format is the high byte of 'coverage'
bit mask (bits 8-15), and the low byte (bits 0-7) is the actual coverage
bits.

In AAT kern, it's the opposite: the coverage flags are the high byte,
whereas the subtable format is the low byte.

Also adjusted the test data, and set coverage to 1 for OT kern subtable
(which means the usual horizontal kerning).
2017-11-04 10:56:07 +00:00
justvanrossum
7af33134a2 getBestCmap(): Expanded the list of cmap subtables to search for. Not sure how to implement the rest of Behdad's suggestions from #1092 2017-11-04 07:45:11 +01:00
Cosimo Lupo
5d16828031 fixup
had removed that fixture and squashed.. should have re-run the test
before pushing :-/
2017-11-03 20:07:09 +00:00
Cosimo Lupo
a2a4f45ef2 [_k_e_r_n_test] decompile/compile tests for unknown formats 2017-11-03 20:00:04 +00:00
Cosimo Lupo
982c956a08 [_k_e_r_n] add nocover for sys.byteorder check
as we don't run test on big endian systems so that check is always true anyway...
2017-11-03 19:59:42 +00:00
Martin Hosken
4a009d1eea Fix tests 2017-11-04 00:34:47 +07:00
Cosimo Lupo
604059305b
Merge pull request #1092 from fonttools/get-best-cmap
[ttLib] Add a convenience method to the cmap table to return the best available cmap
2017-11-03 16:58:24 +00:00
Cosimo Lupo
69d3bfadcc [_k_e_r_n] fix compilation of AAT kern tables
- When compiling kern subtables for version=1.0 kern tables (AAT)
  the subtable header was written incorrectly: there is no version,
  the length is a uint32 and there's an additional uint16 for
  tupleIndex
- Use the 'coverage' low byte to select subtable "format", instead
  of the 'version' field, only present in OT kern subtable header.
  The getkern method was failing with AttributeError on 'unknown'
  subtable formats, as their class only has 'format' instead of
  'version' attribute. The 'version' attribute is renamed to
  'format' also to avoid confusion, but the old one is kept for
  backward compatiblity. In the only implemeted subtable class,
  'format' becomes a class attribute rather than instance's
  (it must always be 0).
- KernTable_format_0 now takes an 'apple=False' argument, used to
  know the different headers and whether to read/write tupleIndex.
- minor pep8 whitespace and indentation fixes
- A new 'tupleIndex' attribute is written out to TTX for apple
  kern subtables. Old ttx files which lack that attribute will
  still be read (with a warning) and will default to tupleIndex=0
  when recompiled or dumped with current fonttools.

Fixes #1089
2017-11-03 16:39:31 +00:00
Martin Hosken
9651594848 Fix small graphite round trip bugs 2017-11-03 23:21:02 +07:00