2437 Commits

Author SHA1 Message Date
Cosimo Lupo
99307e8991
subset_test: unit tests for subsetting non-BMP characters with --text/--text-file options 2016-11-29 15:45:07 +00:00
Cosimo Lupo
bcd4268442
subset/testdata: add a version of TestTTF-Regular.ttx containing an additional non-BMP character, U+1F6D2 2016-11-29 15:42:51 +00:00
justvanrossum
e5d2d49900 two more doctests 2016-11-29 14:42:20 +01:00
justvanrossum
8fa2ee1d95 Do the capping before calculating the normalized value to avoid ZeroDivisionError when default == lower or default == upper. Added doctests to verify. Fixes #749 2016-11-29 14:38:46 +01:00
Parag Nemade
167ee6041e Make inspect.py file compatible to run with python2 and python3 (#748)
Signed-off-by: Parag A Nemade <pnemade@fedoraproject.org>
2016-11-28 07:33:24 -06:00
justvanrossum
f713c93340 made warning even more specific 2016-11-26 14:05:23 +01:00
justvanrossum
7eff97e08b made warning more specific 2016-11-26 14:05:23 +01:00
justvanrossum
4a5c838b5b Improve the warnings issued when 'useless' FontDict key/value pairs are provided either by an OTF, or a TTX file; It now warns reliably in both those cases. 2016-11-26 14:05:23 +01:00
justvanrossum
ce73bba3f3 use log.warning() instead of log.log(logging.WARNING, ...) 2016-11-26 14:05:23 +01:00
justvanrossum
cce31c9950 Also warn when keys are ignored upon compile. 2016-11-26 14:05:23 +01:00
justvanrossum
8d22c39d0b Output an XML comment with the keys that were ignored; Added references to the other issues involved. 2016-11-26 14:05:23 +01:00
justvanrossum
f9d265d1e6 This commit fixes #740.
Commits 3063def and 5b47971 introduced a separate fontDictOperators list for FontDict, only listing those TopDict key/value pairs that are actually used in the FontDict context. It provided a fallback that TTX files containing such "useless" key/value pairs would not be rejected.

However, the code still rejected binary fonts that contained such values, even though it didn't before, and yes, such fonts exist. Also: such fonts are not broken per spec, they just contain some fields that otherwise no one ever looks at, so it's a little harsh to reject them.

This patch removes most of the special FontDict code, and uses everything from TopDict, *except* the order attribute: it sets that to a list of the relevant keys for the FontDict. The effect of this is that "useless" key/value pairs are ignored, not just upon reading XML, but also upon decompilation and compilation of binary fonts. It improves on the previous XML reading behavior in that it no longer silently ignores key typos in the TTX input.

Ideally, we would *output* everything that is actually in the FontDict to TTX, and only ignore the values when compiling, but I didn't find a clean solution for that, so I decided to just fix the issue.
2016-11-26 14:05:23 +01:00
Cosimo Lupo
400e8e8dd0
Bump version: 3.2.1 → 3.2.2 2016-11-24 17:19:58 +00:00
Masaya Nakamura
08a0d550db Fix "Private Use (plane 15)" range
https://twitter.com/ken_lunde/status/796564061206913024
https://www.microsoft.com/typography/otspec/errata.htm
2016-11-21 11:26:57 +09:00
Behdad Esfahbod
78d3cbea57 [subset] Fix subsetting MathVariants
Was failing on Caudex-Regular.ttf for example.
2016-11-11 10:58:02 -08:00
Behdad Esfahbod
25083502e4 [perimeterPen] Update check for cusps
If p1 coincides with p0 or p2, we still can use the lineTo()
code.
2016-11-08 16:39:38 -08:00
Behdad Esfahbod
7915a45ddf [varLib] Handle fonts without GPOS
Fixes https://github.com/fonttools/fonttools/issues/699
2016-11-08 15:44:39 -08:00
Behdad Esfahbod
a11bc5655d [merge] Ignore LangSys if None
Fixes https://github.com/fonttools/fonttools/issues/739
for now, though proper fix is more complicated.

This was hit now because the subsetter was changed a while back
to retain script systems even if empty...  I don't like that.
2016-11-08 14:06:50 -08:00
Rob McKaughan
1bebcec00d Do not emit null axes in fvar (default==min==max) 2016-11-04 14:53:43 -07:00
Cosimo Lupo
6e0b952441
Bump version: 3.2.0 → 3.2.1 2016-11-03 14:21:51 +00:00
Cosimo Lupo
c66a2bc327
Bump version: 3.1.2 → 3.2.0
I had forgotten to bump the version for 3.2.0... Sorry :(

This is not a problem for the released packages, since versioneer correctly writes the tagged version.
It's only the hard-coded version string that's used as a fallback if git fails to compute the version which I forgot to update.
2016-11-03 14:21:51 +00:00
moyogo
acfb137881 OS2/2: fix checking fsSelection bits matching head.macStyle bits 2016-11-03 11:37:00 +00:00
Cosimo Lupo
df967e70fc
varLib: rename --buildHVAR option to --build-HVAR; add 'build_HVAR=False' kwarg to 'build' function
better not having to pass an argparse.Namespace object to varLib.build
2016-11-03 10:59:00 +00:00
Rob McKaughan
bdbb8c5374 Add commandline switch to build HVAR 2016-11-02 20:54:50 -07:00
Cosimo Lupo
3b1e0bdc47
[feaLib.builder_test] fix up tests for backslash-escaped glyph names 2016-11-02 16:01:35 +00:00
Cosimo Lupo
a0cc66bfc0
[feaLib.parser] strip initial backslash from glyph names
Fixes https://github.com/fonttools/fonttools/issues/457

Backslash-prefixed glyph name can be used in a Feature file to distinguish them from identically-named keywords.

From section "2.f.i. Glyph name" of Adobe's Feature File Specification:

> An initial backslash serves to differentiate a glyph name from an identical keyword in the feature file language. For example, a glyph named "table" must be specified in the feature file as: \table

Thus, when we parse a glyph name that begins with a backslash, we need to ignore the first character.

Note that makeotf rejects feature files with glyph names that start with or contain backslashes, even when escaped with another backslash.

feature liga {
    sub \\glyphWithBackslash by A;
} liga;

This yields:

    makeotfexe [FATAL] <Backslash-Regular> invalid token (text was "\") [features 2]
2016-11-02 16:01:21 +00:00
Cosimo Lupo
dcb72536a0
[C_F_F_test] strip ttFont's 'ttLibVersion' attribute because it may change 2016-11-02 10:05:10 +00:00
Behdad Esfahbod
904b1c5942 Support splitting PairPosFormat1 tables
Fixes https://github.com/googlei18n/fontmake/issues/143
2016-11-01 18:15:21 -07:00
Behdad Esfahbod
b4ebe12b31 [varLib] Reenable HVAR for CFF2 fonts
https://github.com/fonttools/fonttools/issues/705
2016-10-31 16:15:24 -07:00
Behdad Esfahbod
f5bf9b04de Add a 'fonttools' command-line tool that simply runs modules
ttx is now equivalent to:
$ fonttools ttx

pyftsubset can be called as:
$ fonttools subset

varLib can be called as:
$ fonttools.varLib

Also adds a executable at toplevel called fonttools, such that
with "./fonttools ..." one can run stuff without installing.
Python seems to automatically include ./Lib into its search path.
2016-10-30 15:19:29 +02:00
Behdad Esfahbod
a71faf9322 [perimeterPen] 5x speed-up cubic by using complex numbers as points 2016-10-30 14:28:38 +02:00
Behdad Esfahbod
c5538eaccf [perimeterPen] Speed up quadratic by using complex numbers for points 2016-10-30 14:28:33 +02:00
Behdad Esfahbod
a284865851 Remove unused line 2016-10-30 14:28:07 +02:00
Sascha Brawer
14509af47c [fvar] Include either all PostScript names, or none
The table structure requires that all named instances have the same
record size. Slightly refactored the compilation code to make the
logic easier to understand/maintain.
2016-10-25 00:09:31 +02:00
Sascha Brawer
248336a0fb Add test case for glyph names with backslash
Resolves https://github.com/fonttools/fonttools/issues/457
2016-10-24 22:39:59 +02:00
Cosimo Lupo
38e71cf45a Merge pull request #276 from moyogo/os2format4
warn when fsSelection bits aren’t defined or don’t match head.macStyle bits
2016-10-24 11:20:33 +01:00
moyogo
49ac9ba5cb OS/2: fsSelection bits 0 and 5 should match head.macStyle bits 1 and 0 2016-10-24 10:03:50 +01:00
Behdad Esfahbod
ea958e72e4 [varLib] Implement effective-kern-pair from PairPosFormat2 2016-10-23 14:09:49 +02:00
Behdad Esfahbod
b563e6673c [varLib] Implement GPOS binary interpolation for PairPosFormat1 2016-10-22 22:47:18 +02:00
moyogo
b5002eb5d4 OS/2: if fsSelection bit 6 is on bits then 0 and 5 must be clear 2016-10-22 13:06:30 +01:00
moyogo
c46423df3a OS/2: warn when fsSelection bits defined in version 4 are on but version < 4 2016-10-22 13:06:30 +01:00
Cosimo Lupo
0ab640c4bc
[_h_m_t_x_test] add test for rounding floats 2016-10-21 12:42:01 +01:00
Cosimo Lupo
5e3734c91e
[_h_m_t_x] round float values to int
No need to issue warnings, as we don't do that either for glyf coordinates.
Fixes #593
2016-10-21 12:40:00 +01:00
Cosimo Lupo
ce609addd0 [ttx] add --newline option to explicitly control line endings 2016-10-20 17:22:12 +01:00
Cosimo Lupo
2552d224a3 [testTools] use 'newlinestr' for makeXMLWriter() helper function 2016-10-20 16:57:49 +01:00
Cosimo Lupo
543be9cfbf [xmlWriter_test] test custom 'newlinestr' values in XMLWriter constructor 2016-10-20 16:56:41 +01:00
Cosimo Lupo
d235e124b4 [ttLib] add 'newlinestr=None' kwarg to TTFont.saveXML, passed on to XMLWriter instances 2016-10-20 16:54:31 +01:00
Cosimo Lupo
d874782ee4 [xmlWriter] add 'newlinestr' argument for overriding os-specific line endings
By default (newlinestr=None), the XMLWriter will still use the `os.linesep` as the
newline string.
Otherwise, it will use the specified `newlinestr`.

This is useful when TTX files under version control are being written from
multiple platforms; in which case, one usually wants to always use one
specific line ending (most likely LF, which is what the XML spec itself
normalizes it to).
2016-10-20 16:53:07 +01:00
moyogo
678876325e Add hhea tests 2016-10-18 18:18:09 +02:00
moyogo
004a5b7361 feaLib: hhea tableVersion = 0x00010000 2016-10-18 18:18:09 +02:00