{"action":"created","issue":{"url":"https://api.github.com/repos/behdad/fonttools/issues/239","labels_url":"https://api.github.com/repos/behdad/fonttools/issues/239/labels{/name}","comments_url":"https://api.github.com/repos/behdad/fonttools/issues/239/comments","events_url":"https://api.github.com/repos/behdad/fonttools/issues/239/events","html_url":"https://github.com/behdad/fonttools/issues/239","id":68898911,"number":239,"title":"raise a proper TTLibError while opening a \"com.adobe.postscript-lwfn-font\" type1 font","user":{"login":"typemytype","id":1190358,"avatar_url":"https://avatars.githubusercontent.com/u/1190358?v=3","gravatar_id":"","url":"https://api.github.com/users/typemytype","html_url":"https://github.com/typemytype","followers_url":"https://api.github.com/users/typemytype/followers","following_url":"https://api.github.com/users/typemytype/following{/other_user}","gists_url":"https://api.github.com/users/typemytype/gists{/gist_id}","starred_url":"https://api.github.com/users/typemytype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/typemytype/subscriptions","organizations_url":"https://api.github.com/users/typemytype/orgs","repos_url":"https://api.github.com/users/typemytype/repos","events_url":"https://api.github.com/users/typemytype/events{/privacy}","received_events_url":"https://api.github.com/users/typemytype/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-16T10:56:26Z","updated_at":"2015-05-17T09:54:11Z","closed_at":null,"body":"> fonttools/Lib/fontTools/misc/sstruct.py\", line 87, in unpack\r\n    elements = struct.unpack(formatstring, data)\r\nerror: unpack requires a string argument of length 12\r\n\r\nraising the correct error is import for packages like Extractor\r\n\r\nsee https://github.com/typesupply/extractor/blob/master/Lib/extractor/formats/opentype.py#L12-L18\r\n\r\nfor your reference: http://sourceforge.net/p/fonttools/code/ci/master/tree/Lib/fontTools/ttLib/sfnt.py#l28\r\n\r\n\r\nthanks!"},"comment":{"url":"https://api.github.com/repos/behdad/fonttools/issues/comments/102774316","html_url":"https://github.com/behdad/fonttools/issues/239#issuecomment-102774316","issue_url":"https://api.github.com/repos/behdad/fonttools/issues/239","id":102774316,"user":{"login":"anthrotype","id":6939968,"avatar_url":"https://avatars.githubusercontent.com/u/6939968?v=3","gravatar_id":"","url":"https://api.github.com/users/anthrotype","html_url":"https://github.com/anthrotype","followers_url":"https://api.github.com/users/anthrotype/followers","following_url":"https://api.github.com/users/anthrotype/following{/other_user}","gists_url":"https://api.github.com/users/anthrotype/gists{/gist_id}","starred_url":"https://api.github.com/users/anthrotype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthrotype/subscriptions","organizations_url":"https://api.github.com/users/anthrotype/orgs","repos_url":"https://api.github.com/users/anthrotype/repos","events_url":"https://api.github.com/users/anthrotype/events{/privacy}","received_events_url":"https://api.github.com/users/anthrotype/received_events","type":"User","site_admin":false},"created_at":"2015-05-17T09:54:11Z","updated_at":"2015-05-17T09:54:11Z","body":"@behdad sorry for late reply. I think we should have a proper function to detect all supported file types. We could extend the current `ttx.guessFileType` and move that to ttLib.__init__. The function would be used to pick up the compatible reader class, or to raise a TTLibError if the type is not supported.\r\nHowever, while we think about that, we can already add a test for \"enough data\" to sfnt and woff2 modules, like the one proposed by @typemytype. I'll send a PR in a minute."}}