82 Commits

Author SHA1 Message Date
Tal Leming
45910b6131 Initial work on reading single file UFO.
This is a work in progress update of UFOReader and UFOWriter that
supports UFO in its package and zipped forms. Reading works. Writing is
not yet implemented.

I'm building a base file system (that lives on top of fs for now and
maybe in the long term) that the reader and writer then subclass. This
base class implements the file system interaction so that the reader
and writer can be blissfully ignorant about file systems.

Additionally, I ran into a problem with the local plistlib.py creating
an import error, so I've temporarily renamed it plistlibShim.py so that
I can continue working.

Did I mention that this is a work in progress? It's a work in progress.
2016-05-02 23:06:25 -04:00
Tal Leming
185c04220d The UFO spec has changed with regard to kerning conflicts. Reflect this in ufoLib. 2016-04-22 13:30:28 -04:00
Adrien Tétar
fab99c30e5 plistlib: reimplement as shim 2016-03-01 12:43:04 +01:00
Denis Jacquerye
d05df7eb7e Python 2/3: replace str by basestring 2015-11-18 13:22:14 +00:00
Adrien Tétar
e345fec96f meta: remove robofab files 2015-11-08 11:11:11 +01:00
Denis Jacquerye
929ed4454c ufoLib: drop READ_MODE and WRITE_MODE 2015-11-06 15:06:52 +00:00
Denis Jacquerye
7deef57dd0 ufoLib.__init__: add basestring in Python3 and undo 2to3 2015-11-06 15:06:51 +00:00
Denis Jacquerye
66e5ae0242 ufoLib __init__.py: use io.StringIO, io.BytesIO, and standard plistlib load and dump 2015-11-06 15:06:49 +00:00
Denis Jacquerye
607cdf9a39 ufoLib __init__: typo 'maetainfo' -> 'metainfo' 2015-11-06 14:10:42 +00:00
Adrien Tétar
3fd0c69d65 ufoLib meta: post-2to3 fixes 2015-11-06 14:10:42 +00:00
Adrien Tétar
337ef3202b ufoLib meta: automated 2to3 conversion 2015-11-05 09:30:43 +00:00
Adrien Tétar
ff8bd252d4 ufoLib: previousFormatVersion None-check 2015-09-27 16:39:30 +02:00
Lasse Fister
e875cfe3ec Add default layerOrder to writeLayerContents 2014-12-08 23:11:55 +01:00
Lasse Fister
24676b3ebb Repair and refactor UFOWriter._writePlist to be more DRY
`UFOWriter._writePlist` constructs the full path to the file to be written;
but the calling code did so, too.

This reliefs the calling code of `UFOWriter._writePlist` from knowing
how to construct the full path and thus makes the code more DRY.
Also, this fixes the faulty behavior that was caused by the double
path construction.
A further new helper `UFOWriter._deleteFile` was added to fully enable the
removal of path construction in the callers.
2014-12-08 23:10:46 +01:00
Lasse Fister
b498155890 use shared _getPlist implementation in UFOWriter 2014-12-08 21:33:39 +01:00
Lasse Fister
d8788cc8d5 prepare sharing of UFOReader._getPlist implementation 2014-12-08 21:33:33 +01:00
Lasse Fister
39af9f6495 Refactor and fix wrong usage of UFOReader._readPlist
All cases where UFOReader._readPlist was used suffered
from calling it with the fully constructed path where
it expected just the relative path/fileName of the plist.

Also, all cases had the similiar pattern of checking if
the file exists before trying to read it.

This replaces that pattern by `_getPlist`. The method has
a `default` argument that acts similar to the `default`
argument of the builtin function `getattr` i.e. when
`default is None` the requested plist is mandatory.
2014-12-08 21:31:46 +01:00
Lasse Fister
418b6859c8 Define UFOReader._checkForFile as an alias of os.path.exists
Maybe we should rather replace it with os.path.exists, as this
would make the code easier to read. Also os.path.exists is already
used very often in ufoLib.__init__
2014-12-08 21:27:24 +01:00
Tal Leming
8dc8742959 Add write time kerning group down conversion to UFOWriter.
This allows the UFO 3 up converted kerning group names to be reset to
their original names at the time of writing in UFO <= 2.
2014-02-18 11:49:26 -05:00
Tal Leming
c09c53485c The UFO 3 spec requires ints for many format specific fields now.
git-svn-id: http://svn.robofab.com/branches/ufo3k@549 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2012-02-14 03:25:21 +00:00
Tal Leming
3fb94d2b65 Make the automatic group rename mapping available.
git-svn-id: http://svn.robofab.com/branches/ufo3k@548 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2012-01-30 15:19:05 +00:00
Tal Leming
d3bce60a6a Added a method for setting the modification time of the UFO. This addresses ticket #20.
git-svn-id: http://svn.robofab.com/branches/ufo3k@515 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-12-07 15:45:06 +00:00
Tal Leming
87eee9dc29 Added font info conversion functions. These should resolve tickets #10 and #11.
git-svn-id: http://svn.robofab.com/branches/ufo3k@511 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-12-06 20:25:49 +00:00
Tal Leming
429fc95ae6 Deprecate conversion function. It wasn't possible to make a safe in place conversion for FO 3, so I think these should go away.
git-svn-id: http://svn.robofab.com/branches/ufo3k@510 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-12-06 19:17:35 +00:00
Tal Leming
5312ac46d1 Updating the documentation.
git-svn-id: http://svn.robofab.com/branches/ufo3k@509 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-12-06 19:13:57 +00:00
Tal Leming
6f7a70d13f Found an error in a test and a couple of typos in the code.
git-svn-id: http://svn.robofab.com/branches/ufo3k@508 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-12-06 18:47:56 +00:00
Tal Leming
ff01e27763 Added a kerning validator. This must be run by the caller since groups are required. This should resolve ticket #8.
git-svn-id: http://svn.robofab.com/branches/ufo3k@507 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-12-06 18:46:31 +00:00
Tal Leming
5571ca07de Typo.
git-svn-id: http://svn.robofab.com/branches/ufo3k@505 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-12-01 14:11:37 +00:00
Tal Leming
8def59e71a More verbose method name.
git-svn-id: http://svn.robofab.com/branches/ufo3k@482 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-28 16:54:11 +00:00
Tal Leming
5d3c381e97 Added a path property to the writer.
git-svn-id: http://svn.robofab.com/branches/ufo3k@480 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-27 14:59:01 +00:00
Tal Leming
1cc8ddbe43 Add a mod time request method to the reader.
git-svn-id: http://svn.robofab.com/branches/ufo3k@479 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-27 14:53:54 +00:00
Tal Leming
a0dd7ae714 Bugs.
git-svn-id: http://svn.robofab.com/branches/ufo3k@432 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-19 16:39:49 +00:00
Tal Leming
2b8c197b89 Don't show "data" in the data directory listing.
git-svn-id: http://svn.robofab.com/branches/ufo3k@431 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-19 16:24:12 +00:00
Tal Leming
ee5c1edfcd Don't try to read a directory.
git-svn-id: http://svn.robofab.com/branches/ufo3k@430 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-19 16:22:08 +00:00
Tal Leming
94f05633f5 Added a convenience for copying images.
git-svn-id: http://svn.robofab.com/branches/ufo3k@429 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-19 14:58:35 +00:00
Tal Leming
b8e639ac31 Added a method for copying a file or directory from a UFOReader. This should (I'll find out tomorrow) be helpful for dealing with /data and /images in save as operations in higher level objects.
git-svn-id: http://svn.robofab.com/branches/ufo3k@426 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-19 02:18:56 +00:00
Tal Leming
62bd9d2774 Validate public.markColor.
git-svn-id: http://svn.robofab.com/branches/ufo3k@412 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-17 20:32:20 +00:00
Tal Leming
b4d892e896 Typo.
git-svn-id: http://svn.robofab.com/branches/ufo3k@401 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-13 00:43:23 +00:00
Tal Leming
494a13641e Support the recent fsSelection bits.
git-svn-id: http://svn.robofab.com/branches/ufo3k@400 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-13 00:41:58 +00:00
Tal Leming
0155bb7b55 Use a kwarg with the validator.
git-svn-id: http://svn.robofab.com/branches/ufo3k@396 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-11 16:43:35 +00:00
Tal Leming
2d0ded609c Raise errors in UFO 1 and UFO 2.
git-svn-id: http://svn.robofab.com/branches/ufo3k@395 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-11 16:21:58 +00:00
Tal Leming
e4f9b0f78c API for working with images.
git-svn-id: http://svn.robofab.com/branches/ufo3k@394 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-11 16:19:11 +00:00
Tal Leming
b6bed08dfa Don't read GLIF 2 in UFO 1 or UFO 2.
git-svn-id: http://svn.robofab.com/branches/ufo3k@390 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-07 13:54:14 +00:00
Tal Leming
87af17931c Pass the UFO format version to the glyph set.
git-svn-id: http://svn.robofab.com/branches/ufo3k@389 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-07 02:13:17 +00:00
Tal Leming
4579b92abc Bug fixes.
git-svn-id: http://svn.robofab.com/branches/ufo3k@388 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-06 19:53:38 +00:00
Tal Leming
2cddcd6e3e Be a bit more lenient with dict-like objects at the top level.
git-svn-id: http://svn.robofab.com/branches/ufo3k@387 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-06 19:23:48 +00:00
Tal Leming
91b7ba0e72 Make it possible to rename the default layer.
git-svn-id: http://svn.robofab.com/branches/ufo3k@386 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-06 17:50:53 +00:00
Tal Leming
145902c57a Allow renaming to the default directory.
git-svn-id: http://svn.robofab.com/branches/ufo3k@385 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-06 16:09:40 +00:00
Tal Leming
2d17dfc09e Don't support in-place down conversion. It's too lossy. The way to do it is to write a UFO with the lower format to a temporary location, use shutil to remove the old UFO, then use shutil to move the new UFO. This will remove any unknown data (ie .svn directories) but this would likely happen in an in-place down conversion anyway.
git-svn-id: http://svn.robofab.com/branches/ufo3k@384 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-06 13:30:11 +00:00
Tal Leming
aaab0ed06d Test cases for an edge case.
git-svn-id: http://svn.robofab.com/branches/ufo3k@383 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2011-10-05 20:48:36 +00:00