1159 Commits

Author SHA1 Message Date
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
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
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
Cosimo Lupo
b1fae3fe32 ttx/ttLib: use from fontTools import version as before 2016-10-10 15:26:04 +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
Cosimo Lupo
2bbc62d371 sfnt.py: drop WOFFDirectoryEntry.zlibCompressionLevel; use global ZLIB_COMPRESSION_LEVEL instead
Fixes https://github.com/fonttools/fonttools/issues/686
2016-10-02 12:42:54 +01:00
Cosimo Lupo
95c1a3e2f7 C_F_F_test.py: load test CFF xml/binary data from external files 2016-09-28 18:13:11 +01:00
Cosimo Lupo
e0a10698aa [ttLib] must cast 'sfntVersion' to native string type (bytes on py2, str on py3) to normalize repr() output 2016-09-28 18:08:08 +01:00
Cosimo Lupo
674ceac0ce ttLib/tables/testdata: add C_F_F_.bin and C_F_F_.ttx for CFF table rountrip tests 2016-09-28 17:59:23 +01:00
Behdad Esfahbod
f9672ba7e1 Try fixing up Windows bot failure 2016-09-28 15:16:25 +02:00
ReadRoberts
1677c9e33d Add unit test file for CFF. Uses a small test font to decompile from the data to XML, and back to the data. 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
fb22f64ab1 [varLib] Add TODO item 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
e9ab61c5b5 [GX] Fix FeatureVariations 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
2f38f4a05a [GX] Fix typo 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
caa353d5dd [varStore] Generate variation for Anchors and store in GDEF
Finally!  Phew...
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
8e46c6a121 [varLib] Err if gvar tuples have unknown location axes 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
6b564d7d66 [varLib] Add FeatureVariations to GSUB/GPOS
Based on patch from Read Roberts.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
402d726692 [ot] Change Version to be an integer instead of float
API Change:
This will change XML output for GSUB/GPOS/GDEF/MATH/BASE/JSTF/...
Scripts that set the Version for those to 1.0 or other float values
also need fixing.  A warning is emitted when code or XML needs fix.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
0c577bb7da [ot] Add support for long counts 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
846d969209 [varLib] Remove unused VarAxisID 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
ae93928275 [varLib] Rename fields in fvar, to accommodate for postscriptNameID 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
3da7de7452 [varLib] Use Tag() in fvar 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
72fe29359b [varLib] Start building Device table for variations 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
687c2c1812 [varLib] Build indirect advance-width in HVAR
Fixes VarIdxMap implementation as well.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
32bd6bcc31 [varLib] Add optimizeVarData()
Though not really effective right now since we don't split into
multiple VarData sets.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
3064985880 VarStore: Remove Reserved field 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
47a7dde070 [varLib] Make VarData.NumShorts automatic 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
f11414c93b [varLib] Implement new VarData, aka. ItemVariationData, table 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
38c88f6996 [varLib] Rename VarTuple to VarRegion 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
e7163eddb0 [varLib] Rename VarTupleList to VarRegionList
Aka. ItemVariationRegionList.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
35a401f04d [varLib] Add support for VarIdxMap, aka. DeltaSetIndexMap.
Update HVAR / VVAR to latest draft.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
a174aa76af [ot] Implement template converters
Eg. "OffsetTo(TypeName)"
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
c1717224da [varLib] Generate direct HVAR 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
e2da17e032 [opentype-gx/varLib] More work towards VariationStore
And HVAR/VVAR tables.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
32dd2e9e7e Add a VarStore at the end of GDEF 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
4d7b5f6472 [varLib] Start implementing VariationStore 2016-09-27 19:49:41 +02:00
Cosimo Lupo
5dabba6699 [ttLib] get 'ttLibVersion' from fontTools.version.__version__, but only write MAJOR.MINOR
otherwise it risks changing too often... ;)
2016-09-27 00:28:01 +01:00
Cosimo Lupo
f171719e05 TSI5: set group to 0 (i.e. "AnyGroup") when compiling if glyph name is missing
This is also what VTT does when one does "Prepare font..." and a character is not present in the character groups template file ("CharGrp.txt"): it gets assigned to the default "AnyGroup" group, or 0.

Note that the TSI1 and TSI3 tables do not raise when a glyph name is in the glyphOrder but is missing in their internal mapping; they instead write an empty entry.

This makes easier to merge TSI* tables from different fonts or from earlier revision of the same font containing only a subset of the glyphs.
2016-09-26 16:15:29 +01:00
moyogo
304994851b TSI1: text can be utf-8 2016-09-15 07:16:57 +01:00
Miguel Sousa
f502bbba98 [CPAL] write paletteEntryLabels names 2016-08-28 16:24:58 -07:00
Miguel Sousa
3c6537de88 [CPAL] remove extra newline before palette label name 2016-08-28 16:21:21 -07:00
Cosimo Lupo
855c3b17c9 [woff2_test] adjust 'test_incorrect_compressed_size' to make it work with brotlipy
In the upstream google/brotli, if the `decompress` function receives an empty byte
string, it returns a brotli.error; whereas in 'brotlipy' it does not raise but
returns an empty string b"":
https://github.com/python-hyper/brotlipy/issues/43#issuecomment-240378257

This test case asserts that when 'totalCompressedSize' in the WOFF2 header is
incorrectly set, the woff2 reader fails -- either because the brotli decoder
raises an exception, or it returns a string whose length is not the one expected.
2016-08-17 12:07:02 +01:00
Behdad Esfahbod
5cd0a55635 Ignore up to 4 bytes excess in kern subtables
Fixes https://github.com/behdad/fonttools/issues/314

Previously the warning message was wrong (probably a regression)
as it was reporting the the length of all kern data as "excess".
Fixing that, I see 4 bytes excess in Calibri.  Up to 4 is alright,
since many compilers add padding and wrongly add 4 instead of 0
sometimes.
2016-08-08 13:02:34 -07:00
Behdad Esfahbod
9c037fc826 [gvar] Add TODO 2016-07-16 21:22:20 -07:00