2386 Commits

Author SHA1 Message Date
moyogo
f55c60c4df feaLib: add vhea table 2016-10-18 18:18:09 +02:00
moyogo
074f6ea009 Add vhea tests 2016-10-18 18:18:09 +02:00
moyogo
bd4d43e7c5 feaLib: hhea test with hex version 2016-10-18 18:18:09 +02:00
moyogo
6e85a6c4fb otConverters: use fixedTools fixedToVersion() and versionToFixed() 2016-10-18 18:18:09 +02:00
moyogo
cf2c6ec127 vhea: tableVersion as L instead of 16.16F, hex in XML 2016-10-18 18:18:09 +02:00
moyogo
f67d0eb826 hhea: tableVersion as L instead of 16.16F, hex in XML 2016-10-18 18:18:09 +02:00
moyogo
f591e8c503 fixedTools: add ensureVersionIsLong() and versionToFixed() 2016-10-18 18:18:09 +02:00
moyogo
d7a3ae3f3d vhea: vhea.reserved0 should be vhea.caretOffset 2016-10-18 18:18:09 +02:00
Cosimo Lupo
d7b7cbd9cd Merge pull request #706 from fonttools/hmtx-width-ushort
[_h_m_t_x] Read advanceWidth as unsigned short (uint16)
2016-10-17 19:31:53 +01:00
moyogo
4dd1e73b04 Revert "Merge pull request #606 from anthrotype/cff-dehint"
This reverts commit 25a03f5a5736ed70791a8dde31605ed4cee9bbd9, reversing
changes made to 8351600bc628278960390d747f45593a50b7c1ea.
2016-10-14 20:20:35 +01:00
Sascha Brawer
0588502771 Add otConverters.NameID (#708)
When writing XML, this produces a comment with the English name.
If the name ID is missing from the name table, it logs a warning.
2016-10-14 21:04:35 +02:00
Cosimo Lupo
25a03f5a57 Merge pull request #606 from anthrotype/cff-dehint
subset: must 'draw' charstrings to set 'width' attribute before calling 'drop_hints'
2016-10-14 18:43:15 +01:00
Cosimo Lupo
2300b9c168 [_h_m_t_x] use tuple() instead of list() for metrics dict values
As suggested in https://github.com/fonttools/fonttools/pull/706#commitcomment-19429339
2016-10-14 18:35:33 +01:00
Cosimo Lupo
7adfe98690 [_v_m_t_x_test] add test for vmtx table (simply inherits from hmtx one) 2016-10-14 18:35:33 +01:00
Cosimo Lupo
f6b951c6da [_h_m_t_x_test] add test module for hmtx table compiler/decompiler 2016-10-14 18:35:33 +01:00
Cosimo Lupo
115993216a [_h_m_t_x] use list() instead of tuple() in __setitem__
This is for consistency with the way the hmtx `decompile` method already worked.
2016-10-14 18:35:33 +01:00
Cosimo Lupo
2839145c05 [_h_m_t_x] log glyph names with negative advances upon compile; re-raise struct.error as TTLibError with nicer message 2016-10-14 18:35:33 +01:00
Cosimo Lupo
ca6beadd22 [_h_m_t_x] warn if hhea.numberOfHMetrics > maxp.numGlyphs
the comment said "We warn later" but that's not true.
2016-10-14 18:35:33 +01:00
Cosimo Lupo
b1846201ba [_h_m_t_x] set longMetricFormat='Hh' as class attribute
In theory this could be overridden with the old 'hh' struct format, though I wouldn't recommend it.
2016-10-14 18:35:33 +01:00
Cosimo Lupo
1d545b8f91 [_h_m_t_x] Read advanceWidth as unsigned short (uint16); warn on decompile if exceeds 0x7FFF; raise on compile if negative
struct.pack will raise with `argument out of range` when trying to compile a negative integer as unsigned "H".
2016-10-14 18:35:33 +01:00
Behdad Esfahbod
72f5cb8579 Fixup 2016-10-13 15:59:25 -07:00
Behdad Esfahbod
37dbb77c67 Make varLib module callable 2016-10-13 15:43:19 -07:00
Behdad Esfahbod
4158b54244 Make subset module callable 2016-10-13 15:42:14 -07:00
Behdad Esfahbod
b39772b256 [varLib] Fix interpolate_layout for non-similar SinglePos
Has to be ported to varfont merger as well.
2016-10-12 16:11:20 -07:00
Behdad Esfahbod
b9c38af1ff Disable HVAR generation until I fix it
https://github.com/fonttools/fonttools/issues/705
2016-10-12 13:30:52 -07:00
Cosimo Lupo
850293a30a Merge pull request #700 from fonttools/versioneer+bumpversion
version
2016-10-12 11:57:10 +01:00
Sascha Brawer
f5b31db578 [fvar] Omit optional PostScript name when missing; improve tests
If a named instance has a PostScript name, the name is now printed as
a comment into the XML dump. Also, unit tests on `fvar` are now
exercising all code paths, both with and without PostScript names.
2016-10-12 10:58:41 +02:00
Behdad Esfahbod
12d4f277d7 [varLib.merger] Towards supporting merging individual attributes 2016-10-11 20:39:22 -07:00
Cosimo Lupo
3acacb592d fontTools: use versioneer to get_versions(); if fails, print warning and fall back to latest known tag 2016-10-12 00:49:57 +01:00
Cosimo Lupo
48b566dc09 check-in auto-generated versioneer.py and _version.py files 2016-10-11 19:01:34 +01:00
James Godfrey-Kittle
5606f47c03 Merge pull request #691 from jamesgk/varlib-usability
varLib usability stuff
2016-10-10 15:20:03 -07:00
Cosimo Lupo
b1fae3fe32 ttx/ttLib: use from fontTools import version as before 2016-10-10 15:26:04 +01:00
Cosimo Lupo
7223536d7d fontTools.__init__: restore fontTools.version for backward compatiblity
See https://github.com/fonttools/fonttools/issues/697#issuecomment-252622588
2016-10-10 15:20:07 +01:00
Cosimo Lupo
6b152f57ae generate 'version.py' file with plain version string instead of using pkg_resources to read version from package metadata
See https://github.com/fonttools/fonttools/issues/697#issuecomment-252621005
2016-10-10 15:06:11 +01:00
Cosimo Lupo
718201471a {subset,builder}_test: fix order of fromfile/tofile in expect_ttx
The order of the arguments for difflib.unified_diff was inverted in feaLib.builder_test.
The same snippet was probably copy-pasted to the subset_test.

See https://docs.python.org/3/library/difflib.html#difflib.unified_diff
2016-10-09 11:54:48 +01:00
Cosimo Lupo
5d43936d85 subset_test: add basic unit tests for --no-hinting (CFF and TTF) and --desubroutinize options (CFF only) 2016-10-09 11:37:52 +01:00
Cosimo Lupo
942e656b3c subset_test: remove unused variable 2016-10-09 11:22:21 +01:00
Cosimo Lupo
ddfa48ea7c subset: 'draw' charstrings to set 'width' before calling 'drop_hints'
the horizontal advance of hinted charstrings gets lost when the CFF hinting
is stripped with '--no-hinting' option, as noted by @miguelsousa here:

https://github.com/behdad/fonttools/issues/343#issuecomment-156234918

The reason is T2CharString objects only get assigned a 'witdh' attribute
after their 'draw' method is called.

The subsetter's 'drop_hints' function attempts to insert the width back
at the beginning of the de-hinted charstring's program, but can do that
only if the charstring does have a 'width' attribute:

https://github.com/behdad/fonttools/blob/master/Lib/fontTools/subset/__init__.py#L1908
2016-10-09 10:59:10 +01:00
James Godfrey-Kittle
1e8e17e753 [varLib] Define an interpolate_layout method 2016-10-06 17:33:07 -07:00
James Godfrey-Kittle
6f6106ef6c [varLib] Rename interpolate-layout to be loadable 2016-10-06 17:32:37 -07:00
Behdad Esfahbod
b5d7eb8fd4 [varLib] Show failure path when merging fails 2016-10-05 17:03:48 -07:00
Cosimo Lupo
53dce87b03 Merge pull request #688 from fonttools/fix-varlib-names
Fix varlib names
2016-10-05 19:23:10 +01:00
James Godfrey-Kittle
0682e77370 Merge pull request #690 from jamesgk/area-pen
Allow single-point open contours in area pen
2016-10-04 18:05:43 -07:00
Behdad Esfahbod
87e07bc4c4 [varLib] Add kerning merger for interpolate-layout.py 2016-10-04 17:46:22 -07:00
James Godfrey-Kittle
c732ffce8e [areaPen] Add test for endPath 2016-10-04 17:33:16 -07:00
James Godfrey-Kittle
238e8cbc52 Typo 2016-10-04 17:32:49 -07:00
James Godfrey-Kittle
870b7ce92a Allow single-point open contours in area pen
Sometimes an anchor is drawn as a moveTo followed by an endPath, for
that case it makes sense just to ignore and count the area as zero.
2016-10-04 16:27:09 -07:00
Cosimo Lupo
79d755a837 [varLib] use both Macintosh and Windows names for fvar names; use addName method from _n_a_m_e.NameRecord; use unicode_literals
We must coerce name strings with `tounicode` because, on Python 2, the ElementTree library that we use to parse the designspace's XML will return ASCII-encoded `bytes` (PY2 `str`) whenever it can; and only returns `unicode` (PY3 `str`) when strings can't be encoded as ASCII... :(
However the `addName` method requires unicode strings (it wouldn't be able to encode them with multiple platform-specific encodings otherwise).
So we decode bytes as ASCII before passing them to addName.
2016-10-04 17:08:29 +01:00
Cosimo Lupo
726bf65160 [_n_a_m_e_test] add tests for addName method; test that warning is logged from setName if input is bytes 2016-10-04 17:08:29 +01:00
Cosimo Lupo
3feddad5c6 [name] add addName (from varLib); in setName, issue warning if string is not unicode; add makeName (from _n_a_m_e_test)
previously (only on Python 2), the following line was silently coercing to Unicode using default 'ascii' encoding, whenever the input string was a `bytes` string (same as `str` in PY2):

    namerecord.string = string.encode(namerecord.getEncoding())

On Python 3, the line above would crash, since bytes objects don't have an `encode` method (and rightly so).

`setName` should now accept both Unicode or bytes, but will issue a warning if the latter are used.
2016-10-04 17:04:35 +01:00