42 Commits

Author SHA1 Message Date
Erik van Blokland
c81fb4068d Roundtrip localised names. 2017-04-23 23:27:41 +02:00
Erik van Blokland
5a21c9299c Write some localised name elements for an instance. Assume "en" is the default language code. 2017-04-23 16:16:22 +02:00
Erik van Blokland
3b27469c04 sketch out localisable names following ideas from #9 2017-04-23 15:39:17 +02:00
Erik van Blokland
22d8100e4c As with MutatorMath, it's nicer to use enumerate. 2017-03-29 00:08:25 +02:00
Erik van Blokland
82e48b95b7 Source elements may not have a name attribute, but it is needed for for some processes afterwards.
If the element does not have one: create a new one with pattern "temp_master.%d"%(sourceCount).
The document writer then checks for source name attributes with this pattern so that is does not export.
2017-03-28 23:00:13 +02:00
Erik van Blokland
1b4106981e Better logic for overwriting exisiting axes in checkAxes() 2017-03-27 15:00:07 +02:00
Erik van Blokland
81087f79bd Use tagForAxisName to get tag and labelnames for axes we know. 2017-02-26 11:29:50 +01:00
Erik
48a6684b34 Remove unnecessary print. 2017-02-23 22:54:08 +01:00
Erik
a089ffe4c3 Even more explicit check for the presence of axes elements in the document. 2017-02-23 11:06:22 +01:00
Erik
0acaa233eb Better check if there are no axes in a document. 2017-02-22 11:15:10 +01:00
Erik
c31da9df47 Some legacy documents do not have an <axes> element. This causes problems reading and processing the file.
If there are no defined axes, use the available names from locations in the document. New axes are tagged with "_" as first letter. There is no guarantee that the guessed axes have the same dimensions as the originals.
2017-02-21 15:47:09 +01:00
Erik
22ce159ecd Merge remote-tracking branch 'origin/relative-paths'
# Conflicts:
#	Lib/designSpaceDocument/__init__.py
2017-02-06 22:35:55 +01:00
Erik
6ba727bed3 More testcases for the relaive path processing. 2017-02-06 22:33:03 +01:00
Erik
1dd261f6e6 Add comment. 2017-02-06 14:40:20 +01:00
Erik
6e724af43b Clarified how designSpaceDocument object handles the filename and path attributes of the descriptors. 2017-02-06 14:17:56 +01:00
Erik
e102c5e992 Tests to verify the handling of filename and path attrs. 2017-02-06 10:29:59 +01:00
Erik
13abae94c5 New "filename" attribute for source and instance descriptor objects that contains the relative path to the ufo.
So we have:
descriptor.filename: the path to the UFO, relative to the documentpath
descriptor.path: the resolved, absolute path to the UFO

This means we have to be aware of  a couple of situations, described in updatePaths() and testPatgNameResolve().
Case 1: both filename and path attributes are None. Action: write the descriptor as is, without filename attr.
Case 2: filename attribute points somewhere, but the path attribute is None. So we can't actually verify if the UFO really exists, but we don't have to. Action: write the filename attribute as is. We could calculate a new path though.
Case 3: filename attribute is None, path attribute has a path. So there is no legacy value for filename that we need to look out for. Action: we can calculate a new relative path and store that in filename.
Case 4: filename and path attributes are not None, but they're in conflict, pointing to different places/ So the absolute path of the UFO and the absolute path of the document produce a different relative path than is stored in filename. One of them must be wrong.

When a new filename is set, make sure to set the path attribute to None and vice versa.
2017-02-04 18:17:20 +01:00
Erik
dc483f9c17 Not sure why this string does not compare, but it is not vital and I want the tests to be clear. 2017-02-04 15:16:00 +01:00
Erik
91d4b89cd0 filename attr to store the actual string of the relative path. path attr to store the absolute path to the file (if we can find it) 2017-02-04 10:30:03 +01:00
Erik
146bcd078d Option to only process specific glyphnames in ufoProcessor. 2017-01-29 11:56:17 +01:00
Erik
6d421e0871 Use the axis map when generating ufos. 2017-01-06 17:37:29 +01:00
Erik
3a693b37ec Improve support for rules only a minimum or a maximum attribute.
More tests.
2016-12-18 22:15:54 +01:00
Erik
6f4eac1aaa Add unicode values to instance glyphs.
Fixes typo.
2016-12-17 11:46:30 +01:00
Erik
ef80bbf890 Adds a function for swapping glyphs if we want to express a rule in a UFO.
More tests.
2016-12-13 17:56:21 +01:00
Erik
ab450a9017 Proposal to change the condition from axis.tag" to axis.name: conditions, locations use the axis.name.
This makes it possible to evaluate a rule without having to look up the axis data.
Evaluate and apply a rule to a list of glyphnames.
More tests.
2016-12-13 08:53:49 +01:00
Erik
c17592984f Support for basic rule object.
Description of the element and the object.
2016-12-11 08:18:49 -05:00
Erik
f74eae0ef3 Add classmethods for making source and instance descriptors. 2016-12-09 08:29:39 -08:00
Erik
fcdf6c8d93 Option to overwrite existing axes, or define new ones. 2016-12-02 20:39:31 +01:00
Erik
ea8c1270a5 When a document is read that has no axis definitions, there were no axis names to compare the locations to.
- self_strictAxisNames controls whether unknown axis names are ignored when reading locations.
- if we don't have any axes in the document then we don't know the axis names, but we still need to read locations.
- after reading all locations we can then reconstruct axis objects.

- also set the copyInfo flag after choosing one.

__removeAxesFromDesignSpace(path) takes a designspace path, reads the file and deletes the <axes> element. This is to make a test file for reading a file without axes.
2016-12-02 16:53:39 +01:00
Erik
e3cd7dd48b - check if a document has a default master define, repair if necessary.
- check if a document has axes defined, repair if necessary.
2016-12-02 12:22:07 +01:00
Erik
a854b170b6 - normalise the glyph instance location.
- normalise the glyph masters' location.
2016-11-28 22:29:14 +01:00
Erik
d1da75d3e3 Normalise the axis.map outputValues. 2016-11-28 17:18:36 +01:00
Erik
1b6ae36bab Initial commit for a normalize() method.
- instance locations
- source locations
- axis extremes and default values.

todo:
axis.map values.
2016-11-28 17:12:46 +01:00
Erik
448dd36973 Add an example on scripting with designSpaceDocument. 2016-11-26 14:45:56 +01:00
Erik
9abd4beec1 Convenience method that returns font objects for all the existing sources in the document. Defaults to defcon font object, but you can BYO. 2016-11-22 22:47:34 +01:00
Erik
733c4ea755 Smaller check. 2016-11-20 15:48:22 +01:00
Erik
079771dd76 Merge branch 'master' of https://github.com/LettError/designSpaceDocument
# Conflicts:
#	Lib/designSpaceDocument/__init__.py
2016-11-20 10:14:25 +01:00
Erik
8a0ad4bac8 - changed axis "labelName" element name to lowercase.
- actually also read the labelnames.
- added tests for axis data roundttrip
2016-11-20 10:05:55 +01:00
Denis Moyogo Jacquerye
050f5731b2 py23: unicode_literals 2016-11-15 20:17:57 +00:00
Denis Moyogo Jacquerye
a62918cb72 py23: print function 2016-11-15 20:16:48 +00:00
Denis Moyogo Jacquerye
6770d6a02f whitespace 2016-11-15 20:15:04 +00:00
Erik
2fbdd37362 Initial commit
- independent reader / writer object for designspace documents.
- imports and exports easy to subclass objects for instance, source and axis data.
- roundtrips
- intended to be compatible with use in MutatorMath, Superpolatpor and varlib.
2016-11-15 13:27:39 +01:00