63 Commits

Author SHA1 Message Date
Nikolaus Waxweiler
ada9828121 Add some proper exceptions 2022-04-29 16:56:50 +01:00
Nikolaus Waxweiler
d8bf4c3123 Fix typo to actually transfer font references 2022-04-26 10:15:37 +01:00
mike maxfield
47bbe6f7ca correct naming of dataclasses '__post_init__' method 2022-04-23 16:18:41 -06:00
Jany Belluz
35e560603e [designspaceLib] Add designspace 5 code 2022-04-14 15:03:58 +01:00
Simon Cozens
0f03e6529a
[docs] Fix sphinx warnings (#2453)
* Add default auto doc options

* Ensure all references are unique

* Use anonymous links to avoid duplicate references

* Remove default options, fix wrong module name

* Don’t index repeated class

* Remove repeated classes included through automodule

* Fix warnings

* We don’t use our own static directory

* Correctly format XML in docs

* Fix indentation

* Fix overline

* Bring TOC to top

* Fix definition list

* Offset definition lists and examples

* Fix erroneous markup

* Fix markup

* Already included in automodule

* Fix args markup

* Correct markup for example

* Don’t reindex repeated module

* Correct XML code block markup

* Fix markup errors, change example to doctest

* Correct list markup

* Make ttx docstring both valid RST and valid help output

* Various other boring markup fixes

* Fix example indenting

* Make docstring valid RST and valid help output

* Mock import for reportlab

* It’s ok if manual links don’t appear in toctrees

* Oops typo, I guess doctests are useful
2021-12-02 15:31:49 +00:00
Khaled Hosny
232b2ccbc4 Move the rest of py23 module to textTools
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02:00
Eigi
84d77e5c3a fix for issue #2299
translate leading backslashes of UNC path to forward slashes.
2021-05-09 18:59:34 +02:00
Just van Rossum
5fc65d7168
Misc py23 cleanups (#2243)
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
Cosimo Lupo
ca3306da57
designspaceLib: add add{Axis,Source,Instance,Rule}Descriptor methods
as suggested by Just here:
https://github.com/fonttools/fonttools/pull/1860#issuecomment-601762751
2020-03-20 16:04:24 +00:00
Cosimo Lupo
2d27490c7d
designspaceLib: allow to construct descriptors from keyword args
like data classes
2020-03-20 16:04:23 +00:00
Just van Rossum
b8fafdd259
[WIP] [designspaceLib] designspace docs edits (#1750)
Various changes in the designspaceLib readme.rst
- added docs for DesignSpaceDocument object, methods and attributes
- removed comments on validation, localisation and generating UFO instances.
- added note that axis minimum, default and maximum are in userspace coordinates.
- added clarification to map input (userpace!) / output (designspace!) values.
- added note that sourceDescriptor location is in designspace coordinates.
- moved comment on rule subs to rule descriptor object.
- added proposed "processing" flag to rules element
- move note on sub element
- implementation differences
- varlib vs. mutatormath
- older versions
- rules and generating static ufo instances
- Updated the description of the `copyInfo` flag of the sourceDescriptor.
- Change the example import.
- Remove additional mention of copyInfo.
2019-11-07 19:30:51 +01:00
justvanrossum
f9b04572f6 fix error message, reformatted long line 2019-10-18 13:24:32 +02:00
justvanrossum
d42b7d74ca Implement <rules> attribute 'processing' according to spec update #1750, as well as the related doc.rulesProcessingLast flag 2019-10-18 13:20:28 +02:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Nikolaus Waxweiler
0b9ad5ab80 Add a default InstanceDescriptor.font attribute 2019-08-02 13:40:15 +01:00
Cosimo Lupo
175399ecbc
designspaceLib: add examples to loadSourceFonts docstring 2019-05-10 18:43:42 +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
b327287f97
designspaceLib: remove defaultLoc attribute, use up-to-date default location in findDefault
Fixes #1554
2019-04-08 16:59:01 +01:00
Nikolaus Waxweiler
754c1c6a2f Minor: Remove redundant comment 2019-03-10 23:03:08 +00:00
Nikolaus Waxweiler
5f7afa23b2 newDefaultLocation: Return location in design space 2019-03-10 22:20:00 +00:00
Nikolaus Waxweiler
c4899330c5 designspaceLib, findDefault: consider axis mapping 2019-03-10 22:12:06 +00:00
Cosimo Lupo
a979af2019 designspaceLib: use axis maps with normalizeLocation
fixes https://github.com/fonttools/fonttools/issues/1226
2019-02-27 15:17:24 -08:00
Nikolaus Waxweiler
dd40dac5e0 Remove InstanceDescriptor.mutedGlyphNames
Closes https://github.com/fonttools/fonttools/issues/1417.
2019-01-19 14:13:32 +00:00
Cosimo Lupo
48e72dab9b
varLib: use addMultilingualName for localised instance style names
designspaceLib: ensure instance localised names are set as unicode strings
2019-01-13 15:04:55 +00:00
Cosimo Lupo
acbc65c1a9
varLib: use addMultilingualName method to support localized axes 'labelname'
now that addMultilingualName method also adds mac names by default, we can use it in
varLib instead of addName.
The language identifiers are expected to be minimized, i.e. not contain default script/region
subtags -- until we implement the minimizeSubtags algorithm from ICU/CLDR:
https://github.com/fonttools/fonttools/issues/930
2019-01-13 13:39:15 +00:00
Cosimo Lupo
448b946636
varLib/designspaceLib: require font-less source to have a path; remove getSourcePath
simpler is better. Also, refactored updatePaths and added more tests to it.
2019-01-03 14:21:09 +00:00
Cosimo Lupo
e640806657
designspace: normalize platform path separator in getSourcePath 2019-01-02 16:11:32 +00:00
Cosimo Lupo
3558d4e537
Merge remote-tracking branch 'origin/master' into varlib-build-accept-ds-object 2019-01-02 14:12:56 +00:00
Cosimo Lupo
1470ef7258
designspaceLib: add getSourcePath method
and remove BaseDocReader.getSourcePaths as it was broken anyway (it was assuming 'sources'
attribute of DesignSpaceDocument object was a dict, whereas it is now a list of
SourceDescriptor objects
2019-01-02 14:06:55 +00:00
Just van Rossum
327b05d8c0
[designspaceLib] [t1Lib] [misc.macRes] fix some cases where pathlib.Path objects were not accepted (#1421)
* fix two cases where pathlib.Path objects were not accepted

* make macRes reader accept os.PathLike objects

* use __fspath__ explicitly to support os.PathLike paths

* use __fspath__ explicitly to support os.PathLike paths

* convert tmpdir to str

* only test pathlib.Path on Python 3.6 and up
2018-12-30 12:07:05 +01:00
Cosimo Lupo
6a7493adbb
designspaceLib: port to using lxml via fontTools.misc.etree
indentation is now two spaces like lxml (unchangeable) default
https://github.com/fonttools/fonttools/pull/1335#issuecomment-431112494
2018-10-18 20:03:54 +01:00
Cosimo Lupo
76ba93e6db
designspaceLib: only raise when 'No axis defined' when self._strictAxisNames=True (default) 2018-09-11 18:12:25 +02:00
Cosimo Lupo
95f1909849
designspaceLib: add map_forward/backward methods to AxisDescriptor class 2018-09-11 18:10:51 +02:00
Cosimo Lupo
d8d8ed4016
designspaceLib: add asdict() method to descriptor objects
useful when pretty-printting in the logger
2018-09-11 18:09:22 +02:00
Cosimo Lupo
6cfa1a0bea
designspaceLib: add fromfile, fromstring and tostring methods 2018-09-11 15:12:43 +02:00
Cosimo Lupo
bf87025826
designspaceLib: fix formatting of DesigSpaceError exception
https://travis-ci.org/googlei18n/fontmake/jobs/390821469#L498
2018-06-11 16:35:02 +01:00
Cosimo Lupo
565e835c92
designspaceLib: cleanup formatting, remove unused vars, etc. 2018-06-07 12:44:49 +01:00
Cosimo Lupo
d7714ead35
designspaceLib: use LogMixin; fix undefined name
'ruleObject' name in _readConditionElements was undefined
2018-06-07 11:43:14 +01:00
Erik van Blokland
e4c90b9afe WIP uncomment test for conditions without min or max.
Add _axesAsDict to the test because there it is needed.
2018-05-30 22:26:59 +02:00
Erik van Blokland
554aa362bd WIP Change warnings.warn to logger.info and logger.warning.
findDefault only looks for the sourceDescriptor on the default of all axes. Returns None otherwise.
Remove _axesAsDict - not needed.
Shortened logger name to "DesignSpaceLog"
2018-05-30 22:21:05 +02:00
Erik van Blokland
855a475ad2 WIP removed test for incomplete rules. Added test for stray conditions. Removed high unicode character from lib test. Read stray unwrapped conditions, put them in a conditionset. 2018-05-27 19:18:13 +02:00
Erik van Blokland
a24b00ba14 WIP Comments. 2018-05-27 12:36:57 +02:00
Erik van Blokland
6c649aa023 Remove checkAxes() 2018-05-27 12:19:16 +02:00
Erik van Blokland
1f7f4e42ab WIP reformat some of the docstrings. 2018-05-25 15:22:00 +02:00
Erik van Blokland
b774d8c3e8 WIP remove fontTools.varLib import. 2018-05-25 11:46:44 +02:00
Erik van Blokland
16cba5ad81 WIP Remove _locationFromElement. Single method for newDefaultLocation. Split some of the tests into smaller things. Add some thoughts to normaliseLocation and why this needs a separate method from the one in varLib. 2018-05-25 11:43:58 +02:00
Erik van Blokland
46bfc1c907 WIP Rename self.axes and self.rules attributes of the reader and writer to self._axes and self._rules
Comment out self._locationFromElement - not sure why it exists, let's see if someone complains.
Only raise missing axes error if we read a location *and* we have no axes. This allows a designspace file with a lib but without sources.
Only do findDefault() if we have sources.
2018-05-24 22:47:31 +02:00
Erik van Blokland
9d91c82bbe WIP test documentLib. Add a warning if a findDefault can't find a suitable location. 2018-05-24 21:49:33 +02:00
Erik van Blokland
3b6708940f WIP remove guessAxes 2018-05-23 16:15:14 +02:00
Erik van Blokland
086de222fa WIP axes are compulsory, so don't accomodate missing axes. Raise error if document is missing axes.
We know what the default location is before we start reading the masters and there is no guessing.
findDefault() method: default master is at all default values of all axes, or if that fails, the master with the copyInfo flag.
Warn if a location contains an axis that is not defined in the axes element. Otherwise ignore this value, no guessing.
Remove rulesToFeature() function.
2018-05-23 13:19:23 +02:00