7101 Commits

Author SHA1 Message Date
Cosimo Lupo
df4eb568de
Merge pull request #1606 from anthrotype/dslib-load-source-fonts
designspaceLib: add loadSourceFonts method with custom opener
2019-05-11 10:33:37 +01:00
Cosimo Lupo
175399ecbc
designspaceLib: add examples to loadSourceFonts docstring 2019-05-10 18:43:42 +01:00
Cosimo Lupo
338793d055
varLib: use DesignSpaceDocument.loadSourceFonts method to load masters
we still need to check if source have 'layerName' set before loading from path
since that attribute only makes sense for UFOs, not TTFonts.
2019-05-10 16:34:18 +01:00
Cosimo Lupo
44f74dc8bb
designspaceLib: add loadSourceFonts method with custom opener
Allows to load the SourceDescriptor.font attribute from its path, using a custom callable (e.g. defcon.Font or ttLib.TTFont, etc.).
2019-05-10 16:32:11 +01:00
Cosimo Lupo
fb6eba96f6
Merge pull request #1603 from anthrotype/partial-instantiate-name
instancer: prune unused name records and set glyf 'overlap' flags
2019-05-09 16:39:45 +01:00
Cosimo Lupo
b5da46425c
instancer: rename --no-overlap to --no-overlap-flag
as suggested by Laurence
https://github.com/fonttools/fonttools/pull/1603#commitcomment-33462372
2019-05-09 16:39:26 +01:00
Cosimo Lupo
85c3f85526
Merge pull request #1605 from editkid/fix/ttlib-bbox-rounding
Fix: ttLib _h_e_a_d FontBBox rounding
2019-05-09 13:56:32 +01:00
editkid
9f4fcfeee5 Improve README text wrap 2019-05-09 23:27:32 +12:00
editkid
7f145be901 Add name to README 2019-05-09 23:18:51 +12:00
editkid
742ed88b07 Apply intRect to FontBBox to prevent type error 2019-05-09 23:13:15 +12:00
Cosimo Lupo
d9ad9d8ef5
instancer: set OS/2 weight/width and post.italicAngle 2019-05-08 18:46:43 +01:00
Cosimo Lupo
2d99beb0da
instancer: distinguish full/partial instance in log and outfile
and call argparse parser.error() instead of letting ValueError propagate
when parsing CLI options in parseArgs
2019-05-08 17:23:24 +01:00
Cosimo Lupo
178840dcf9
instancer: add --no-overlap to CLI options 2019-05-08 17:23:24 +01:00
Cosimo Lupo
5871a754de
instancer: set mac overlap glyf flags when fully instancing
like varLib.mutator does
2019-05-08 17:23:24 +01:00
Cosimo Lupo
5a530880c0
instancer: prune unused name records after instancing 2019-05-08 11:38:38 +01:00
Cosimo Lupo
0010a3cd9a
instancer: return default deltas as floats from instantiateTupleVariationStore
Do not round them to integer, but let the caller do the rounding immediately before adding them to the default instance (or just before compiling the binary table as with glyf).

This ensures that the glyphs' left sidebearings are calculated in the same way as they were by varLib.mutator.
If we round deltas too early, then we may get off-by-one differences.
See the glyf table setCoordinates method where left sidebearings are computed.
2019-05-07 14:05:27 +01:00
pyup-bot
c2b34737be Update fs from 2.4.4 to 2.4.5 2019-05-06 16:33:06 +01:00
Cosimo Lupo
1041cf90ef
_g_l_y_f: don't return component flags in getCoordinatesAndControls
varLib._GetCoordinates (which this method is copied from) did not return such data either.

The problem with also including component flags in the returned controls
tuple is that different masters may happen to have different component
flags (e.g. if one master has USE_MY_METRICS, another doesn't).
2019-05-03 18:59:32 +01:00
Cosimo Lupo
82662e31f0
Merge pull request #1596 from anthrotype/partial-instantiate-avar
[instancer] partially instantiate avar, STAT and fvar
2019-05-03 13:38:26 +01:00
Cosimo Lupo
89ce41be55
instancer_test: add test for instantiateSTAT
added a dummy STAT table to PartialInstancer-VF.ttx font that has all 4 AxisValue formats.
It doesn't have contain AxisValue for each fvar NamedInstance like the spec recommends, but it's ok for the sake of this test
2019-05-03 13:32:06 +01:00
Cosimo Lupo
3bfff09c8c
instancer: remap STAT AxisValue.AxisIndex
if STAT table contains no DesignAxisRecord, then keep it empty and skip.
2019-05-03 13:29:43 +01:00
Cosimo Lupo
ffc98baa0f
Merge pull request #1600 from silnrsi/bugfix1
Minor fixlet for Sill table
2019-05-03 10:34:08 +01:00
Martin Hosken
ad60ce80a9 Minor fixlet for Sill table 2019-05-03 16:27:13 +07:00
Khaled Hosny
dadec23978
Merge pull request #1599 from khaledhosny/fealib-valuerecord-asfea
[feaLib] don’t write None in ast.ValueRecord.asFea()
2019-05-03 11:20:33 +02:00
Khaled Hosny
887ea22a34
Merge pull request #1594 from fonttools/fix-subsetter-cff2-issue
Fix bug in subsetting T2 CharStrings from CFF font, issue 1590
2019-05-03 01:34:53 +02:00
Khaled Hosny
b1999a1a0e Add test for previous commit 2019-05-03 01:14:09 +02:00
Khaled Hosny
41c7760be3 [feaLib] don’t write None in ast.ValueRecord.asFea()
The code tries to write the short format when some values as None, but
when writing the long format it would write any None value as is which
is invalid, use 0 for None values instead.
2019-05-03 00:53:09 +02:00
ReadRoberts
77f72bc62b Convert OTF font files in test data to ttx files.
This required a fix to fontTools/cffLib. When reading a CFF2 variable font (VF) from XML, the VF state in FontDict and PrivateDict does not get set. I made a temporary fix by adding a loop to set PrivateDict.vstore for all the PrivateDict objects after the XML file has been read. This should not be necessary, and in the near future I will revisit both this issue, and the related use of isCFF2 when compiling/decompiling.
2019-05-01 16:01:43 -07:00
Cosimo Lupo
aa6c9a1110
instancer: drop STAT DesignAxes and AxisValues for pinned axes 2019-05-01 19:25:41 +01:00
Cosimo Lupo
b8a33d0c75
instancer: drop STAT when varfont fully instanced
varLib.mutator does the same.

Ideally we would keep STAT if has any extra (inter-family) DesignAxis or it font was only partially instanced. We can improve on this later as needed.
2019-05-01 18:30:49 +01:00
Cosimo Lupo
465d85d3d6
Merge pull request #1597 from silnrsi/bugfix5
Fix unmasked bug from previous typo fix
2019-05-01 18:02:54 +02:00
Martin Hosken
2e7b021237 Fix unmasked bug from previous typo fix 2019-05-01 22:28:05 +07:00
Cosimo Lupo
8eed2a2ec0
instancer_test: add test for instantiateFvar 2019-05-01 15:54:58 +01:00
Cosimo Lupo
c8d82e809d
instancer_test: add test for instantiateAvar 2019-05-01 15:48:00 +01:00
Cosimo Lupo
cbf1a854ee
instancer_test: fix MVAR/HVAR tests now that pinned VarRegionAxis are dropped 2019-05-01 15:48:00 +01:00
Cosimo Lupo
d478ef050f
instancer: partially instantiate avar and fvar
for avar, we drop segments of the axes being pinned.

for fvar, we drop the pinned axes and all the named instances whose coordinates are different from the pinned location.
2019-05-01 15:47:56 +01:00
Cosimo Lupo
691547b00b
Merge pull request #1583 from anthrotype/partial-instantiate-HVAR
[instancer] support instantiating HVAR and VVAR  (TTF only for now)
2019-05-01 12:50:45 +02:00
Cosimo Lupo
76fb26306d
instancer: add comments in instantiateHVAR
as per nyshadhr9's review in https://github.com/fonttools/fonttools/pull/1583
2019-05-01 11:49:01 +01:00
ReadRoberts
dbcdde1bee Fix bug in subsetting T2 CharStrings from CFF font. The logic seeks to avoid unnecessarily executing subroutines that have already been subroutinized. It is necessary execute all subroutines when counting hints in order to determine the byte length of mask arguments, but we want to quit doing this when we know that counting hints is no longer necessary,. The previous logic stopped when a [vh]stem operator was seen, as this means there will not be need for hintmask mask arguments However, the [vh]stem operators can be used even when there is a cntrmask, so the logic stopped counting hints too early. 2019-04-30 09:43:13 -07:00
Cosimo Lupo
2a1e6a1fd5
instancer_test: test instancing HVAR table
Aldo added AdvWidthMap to PartialInstancer-VF.ttx test font
2019-04-29 12:51:34 +02:00
Cosimo Lupo
c5ec06d82f
instancer: remove unused regions from VarRegionList
if the original VarStore had any regions in VarRegionList that wasn't
even referenced in any VarData VarRegionIndex, this makes sure we
remove those as well from VarRegionList (and remap the VarRegionIndex
accordingly)
2019-04-29 12:51:34 +02:00
Cosimo Lupo
002de44c13
instancer_test: add vmtx to PartialInstancer-VF.ttx
used in gvar unit tests in instancer_test.py
2019-04-29 12:51:34 +02:00
Cosimo Lupo
7b5202cd79
glyf: only recalcBounds once in setCoordinates
glyph.recalcBounds is called unconditionally a few lines below within the same
setCoordinates method, just after setting the new glyph's coordinates.
We don't need to call recalcBounds twice.
Only empty glyphs with numberOfContours == 0 may not have xMin set.
recalcBounds ensure it's set to 0 for those.
2019-04-29 12:51:34 +02:00
Cosimo Lupo
1e6f8bc39b
instancer: support partial instancing VVAR table as well
for TrueType VF only yet
2019-04-29 12:51:34 +02:00
Cosimo Lupo
91089b7a1b
glyf: support setting vmtx advance/tsb from phantom points 2019-04-29 12:51:34 +02:00
Cosimo Lupo
2b50b94ed7
instancer: support partial instancing HVAR
We don't actually apply deltas to hmtx since these have already been applied
from the gvar deltas when we call glyf.setCoordinates method using the glyf
phantom points.

We simply call instantiateItemVariationStore on HVAR.VarStore to remove
regions and scale remaining deltas, but ignore the return value.
We only run VarStore.optimize() if the HVAR originally has an AdvWidthMap,
if it does not then it uses a direct implicit GID->VariationIndex mapping
for advance widths deltas, and we keep the VariationIndex unchanged by
not optimizing VarStore.

If all axes in fvar are being instanced, then we simply delete HVAR
(just like varLib.mutator currently does).

VVAR is not supported yet because we do not set the 3rd and 4th phantom points
from gvar to the vmtx table yet (this should be done in glyf.setCoordinates).

Also, supporting CFF2 would need more work, in that HVAR there is required
and we need to apply the deltas to hmtx/vmtx in here.
2019-04-29 12:51:33 +02:00
Cosimo Lupo
bdef36501f
instancer: raise NotImplementedError with CFF2 table for now 2019-04-29 12:51:33 +02:00
Cosimo Lupo
1b5393acdd
instancer: call optimize() after instantiateItemVariationStore, not inside
for HVAR/VVAR without indirect mappings, we can skip calling VarStore.optimize() and
keep a direct mapping from GID to VarIdx
2019-04-29 12:51:33 +02:00
Cosimo Lupo
349417d57e
varLib: rename {H,V}VAR_FIELDS constants
we shall reuse them from varLib.instancer too
2019-04-29 12:51:33 +02:00
Cosimo Lupo
aacbc7153d
instancer: capitalise 'MVAR' in method names 2019-04-29 12:51:33 +02:00