• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- coding: utf-8 -*-
2from __future__ import absolute_import, unicode_literals
3import os
4import shutil
5import unittest
6import tempfile
7from io import open
8from fontTools.ufoLib import UFOReader, UFOWriter, UFOLibError
9from fontTools.ufoLib import plistlib
10from .testSupport import fontInfoVersion2
11
12
13class TestInfoObject(object): pass
14
15
16class ReadFontInfoVersion2TestCase(unittest.TestCase):
17
18	def setUp(self):
19		self.dstDir = tempfile.mktemp()
20		os.mkdir(self.dstDir)
21		metaInfo = {
22			"creator": "test",
23			"formatVersion": 2
24		}
25		path = os.path.join(self.dstDir, "metainfo.plist")
26		with open(path, "wb") as f:
27			plistlib.dump(metaInfo, f)
28
29	def tearDown(self):
30		shutil.rmtree(self.dstDir)
31
32	def _writeInfoToPlist(self, info):
33		path = os.path.join(self.dstDir, "fontinfo.plist")
34		with open(path, "wb") as f:
35			plistlib.dump(info, f)
36
37	def testRead(self):
38		originalData = dict(fontInfoVersion2)
39		self._writeInfoToPlist(originalData)
40		infoObject = TestInfoObject()
41		reader = UFOReader(self.dstDir, validate=True)
42		reader.readInfo(infoObject)
43		readData = {}
44		for attr in list(fontInfoVersion2.keys()):
45			readData[attr] = getattr(infoObject, attr)
46		self.assertEqual(originalData, readData)
47
48	def testGenericRead(self):
49		# familyName
50		info = dict(fontInfoVersion2)
51		info["familyName"] = 123
52		self._writeInfoToPlist(info)
53		reader = UFOReader(self.dstDir, validate=True)
54		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
55		# styleName
56		info = dict(fontInfoVersion2)
57		info["styleName"] = 123
58		self._writeInfoToPlist(info)
59		reader = UFOReader(self.dstDir, validate=True)
60		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
61		# styleMapFamilyName
62		info = dict(fontInfoVersion2)
63		info["styleMapFamilyName"] = 123
64		self._writeInfoToPlist(info)
65		reader = UFOReader(self.dstDir, validate=True)
66		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
67		# styleMapStyleName
68		## not a string
69		info = dict(fontInfoVersion2)
70		info["styleMapStyleName"] = 123
71		self._writeInfoToPlist(info)
72		reader = UFOReader(self.dstDir, validate=True)
73		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
74		## out of range
75		info = dict(fontInfoVersion2)
76		info["styleMapStyleName"] = "REGULAR"
77		self._writeInfoToPlist(info)
78		reader = UFOReader(self.dstDir, validate=True)
79		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
80		# versionMajor
81		info = dict(fontInfoVersion2)
82		info["versionMajor"] = "1"
83		self._writeInfoToPlist(info)
84		reader = UFOReader(self.dstDir, validate=True)
85		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
86		# versionMinor
87		info = dict(fontInfoVersion2)
88		info["versionMinor"] = "0"
89		self._writeInfoToPlist(info)
90		reader = UFOReader(self.dstDir, validate=True)
91		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
92		# copyright
93		info = dict(fontInfoVersion2)
94		info["copyright"] = 123
95		self._writeInfoToPlist(info)
96		reader = UFOReader(self.dstDir, validate=True)
97		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
98		# trademark
99		info = dict(fontInfoVersion2)
100		info["trademark"] = 123
101		self._writeInfoToPlist(info)
102		reader = UFOReader(self.dstDir, validate=True)
103		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
104		# unitsPerEm
105		info = dict(fontInfoVersion2)
106		info["unitsPerEm"] = "abc"
107		self._writeInfoToPlist(info)
108		reader = UFOReader(self.dstDir, validate=True)
109		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
110		# descender
111		info = dict(fontInfoVersion2)
112		info["descender"] = "abc"
113		self._writeInfoToPlist(info)
114		reader = UFOReader(self.dstDir, validate=True)
115		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
116		# xHeight
117		info = dict(fontInfoVersion2)
118		info["xHeight"] = "abc"
119		self._writeInfoToPlist(info)
120		reader = UFOReader(self.dstDir, validate=True)
121		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
122		# capHeight
123		info = dict(fontInfoVersion2)
124		info["capHeight"] = "abc"
125		self._writeInfoToPlist(info)
126		reader = UFOReader(self.dstDir, validate=True)
127		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
128		# ascender
129		info = dict(fontInfoVersion2)
130		info["ascender"] = "abc"
131		self._writeInfoToPlist(info)
132		reader = UFOReader(self.dstDir, validate=True)
133		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
134		# italicAngle
135		info = dict(fontInfoVersion2)
136		info["italicAngle"] = "abc"
137		self._writeInfoToPlist(info)
138		reader = UFOReader(self.dstDir, validate=True)
139		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
140
141	def testHeadRead(self):
142		# openTypeHeadCreated
143		## not a string
144		info = dict(fontInfoVersion2)
145		info["openTypeHeadCreated"] = 123
146		self._writeInfoToPlist(info)
147		reader = UFOReader(self.dstDir, validate=True)
148		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
149		## invalid format
150		info = dict(fontInfoVersion2)
151		info["openTypeHeadCreated"] = "2000-Jan-01 00:00:00"
152		self._writeInfoToPlist(info)
153		reader = UFOReader(self.dstDir, validate=True)
154		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
155		# openTypeHeadLowestRecPPEM
156		info = dict(fontInfoVersion2)
157		info["openTypeHeadLowestRecPPEM"] = "abc"
158		self._writeInfoToPlist(info)
159		reader = UFOReader(self.dstDir, validate=True)
160		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
161		# openTypeHeadFlags
162		info = dict(fontInfoVersion2)
163		info["openTypeHeadFlags"] = [-1]
164		self._writeInfoToPlist(info)
165		reader = UFOReader(self.dstDir, validate=True)
166		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
167
168	def testHheaRead(self):
169		# openTypeHheaAscender
170		info = dict(fontInfoVersion2)
171		info["openTypeHheaAscender"] = "abc"
172		self._writeInfoToPlist(info)
173		reader = UFOReader(self.dstDir, validate=True)
174		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
175		# openTypeHheaDescender
176		info = dict(fontInfoVersion2)
177		info["openTypeHheaDescender"] = "abc"
178		self._writeInfoToPlist(info)
179		reader = UFOReader(self.dstDir, validate=True)
180		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
181		# openTypeHheaLineGap
182		info = dict(fontInfoVersion2)
183		info["openTypeHheaLineGap"] = "abc"
184		self._writeInfoToPlist(info)
185		reader = UFOReader(self.dstDir, validate=True)
186		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
187		# openTypeHheaCaretSlopeRise
188		info = dict(fontInfoVersion2)
189		info["openTypeHheaCaretSlopeRise"] = "abc"
190		self._writeInfoToPlist(info)
191		reader = UFOReader(self.dstDir, validate=True)
192		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
193		# openTypeHheaCaretSlopeRun
194		info = dict(fontInfoVersion2)
195		info["openTypeHheaCaretSlopeRun"] = "abc"
196		self._writeInfoToPlist(info)
197		reader = UFOReader(self.dstDir, validate=True)
198		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
199		# openTypeHheaCaretOffset
200		info = dict(fontInfoVersion2)
201		info["openTypeHheaCaretOffset"] = "abc"
202		self._writeInfoToPlist(info)
203		reader = UFOReader(self.dstDir, validate=True)
204		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
205
206	def testNameRead(self):
207		# openTypeNameDesigner
208		info = dict(fontInfoVersion2)
209		info["openTypeNameDesigner"] = 123
210		self._writeInfoToPlist(info)
211		reader = UFOReader(self.dstDir, validate=True)
212		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
213		# openTypeNameDesignerURL
214		info = dict(fontInfoVersion2)
215		info["openTypeNameDesignerURL"] = 123
216		self._writeInfoToPlist(info)
217		reader = UFOReader(self.dstDir, validate=True)
218		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
219		# openTypeNameManufacturer
220		info = dict(fontInfoVersion2)
221		info["openTypeNameManufacturer"] = 123
222		self._writeInfoToPlist(info)
223		reader = UFOReader(self.dstDir, validate=True)
224		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
225		# openTypeNameManufacturerURL
226		info = dict(fontInfoVersion2)
227		info["openTypeNameManufacturerURL"] = 123
228		self._writeInfoToPlist(info)
229		reader = UFOReader(self.dstDir, validate=True)
230		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
231		# openTypeNameLicense
232		info = dict(fontInfoVersion2)
233		info["openTypeNameLicense"] = 123
234		self._writeInfoToPlist(info)
235		reader = UFOReader(self.dstDir, validate=True)
236		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
237		# openTypeNameLicenseURL
238		info = dict(fontInfoVersion2)
239		info["openTypeNameLicenseURL"] = 123
240		self._writeInfoToPlist(info)
241		reader = UFOReader(self.dstDir, validate=True)
242		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
243		# openTypeNameVersion
244		info = dict(fontInfoVersion2)
245		info["openTypeNameVersion"] = 123
246		self._writeInfoToPlist(info)
247		reader = UFOReader(self.dstDir, validate=True)
248		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
249		# openTypeNameUniqueID
250		info = dict(fontInfoVersion2)
251		info["openTypeNameUniqueID"] = 123
252		self._writeInfoToPlist(info)
253		reader = UFOReader(self.dstDir, validate=True)
254		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
255		# openTypeNameDescription
256		info = dict(fontInfoVersion2)
257		info["openTypeNameDescription"] = 123
258		self._writeInfoToPlist(info)
259		reader = UFOReader(self.dstDir, validate=True)
260		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
261		# openTypeNamePreferredFamilyName
262		info = dict(fontInfoVersion2)
263		info["openTypeNamePreferredFamilyName"] = 123
264		self._writeInfoToPlist(info)
265		reader = UFOReader(self.dstDir, validate=True)
266		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
267		# openTypeNamePreferredSubfamilyName
268		info = dict(fontInfoVersion2)
269		info["openTypeNamePreferredSubfamilyName"] = 123
270		self._writeInfoToPlist(info)
271		reader = UFOReader(self.dstDir, validate=True)
272		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
273		# openTypeNameCompatibleFullName
274		info = dict(fontInfoVersion2)
275		info["openTypeNameCompatibleFullName"] = 123
276		self._writeInfoToPlist(info)
277		reader = UFOReader(self.dstDir, validate=True)
278		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
279		# openTypeNameSampleText
280		info = dict(fontInfoVersion2)
281		info["openTypeNameSampleText"] = 123
282		self._writeInfoToPlist(info)
283		reader = UFOReader(self.dstDir, validate=True)
284		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
285		# openTypeNameWWSFamilyName
286		info = dict(fontInfoVersion2)
287		info["openTypeNameWWSFamilyName"] = 123
288		self._writeInfoToPlist(info)
289		reader = UFOReader(self.dstDir, validate=True)
290		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
291		# openTypeNameWWSSubfamilyName
292		info = dict(fontInfoVersion2)
293		info["openTypeNameWWSSubfamilyName"] = 123
294		self._writeInfoToPlist(info)
295		reader = UFOReader(self.dstDir, validate=True)
296		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
297
298	def testOS2Read(self):
299		# openTypeOS2WidthClass
300		## not an int
301		info = dict(fontInfoVersion2)
302		info["openTypeOS2WidthClass"] = "abc"
303		self._writeInfoToPlist(info)
304		reader = UFOReader(self.dstDir, validate=True)
305		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
306		## out or range
307		info = dict(fontInfoVersion2)
308		info["openTypeOS2WidthClass"] = 15
309		self._writeInfoToPlist(info)
310		reader = UFOReader(self.dstDir, validate=True)
311		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
312		# openTypeOS2WeightClass
313		info = dict(fontInfoVersion2)
314		## not an int
315		info["openTypeOS2WeightClass"] = "abc"
316		self._writeInfoToPlist(info)
317		reader = UFOReader(self.dstDir, validate=True)
318		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
319		## out of range
320		info["openTypeOS2WeightClass"] = -50
321		self._writeInfoToPlist(info)
322		reader = UFOReader(self.dstDir, validate=True)
323		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
324		# openTypeOS2Selection
325		info = dict(fontInfoVersion2)
326		info["openTypeOS2Selection"] = [-1]
327		self._writeInfoToPlist(info)
328		reader = UFOReader(self.dstDir, validate=True)
329		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
330		# openTypeOS2VendorID
331		info = dict(fontInfoVersion2)
332		info["openTypeOS2VendorID"] = 1234
333		self._writeInfoToPlist(info)
334		reader = UFOReader(self.dstDir, validate=True)
335		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
336		# openTypeOS2Panose
337		## not an int
338		info = dict(fontInfoVersion2)
339		info["openTypeOS2Panose"] = [0, 1, 2, 3, 4, 5, 6, 7, 8, str(9)]
340		self._writeInfoToPlist(info)
341		reader = UFOReader(self.dstDir, validate=True)
342		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
343		## too few values
344		info = dict(fontInfoVersion2)
345		info["openTypeOS2Panose"] = [0, 1, 2, 3]
346		self._writeInfoToPlist(info)
347		reader = UFOReader(self.dstDir, validate=True)
348		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
349		## too many values
350		info = dict(fontInfoVersion2)
351		info["openTypeOS2Panose"] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
352		self._writeInfoToPlist(info)
353		reader = UFOReader(self.dstDir, validate=True)
354		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
355		# openTypeOS2FamilyClass
356		## not an int
357		info = dict(fontInfoVersion2)
358		info["openTypeOS2FamilyClass"] = [1, str(1)]
359		self._writeInfoToPlist(info)
360		reader = UFOReader(self.dstDir, validate=True)
361		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
362		## too few values
363		info = dict(fontInfoVersion2)
364		info["openTypeOS2FamilyClass"] = [1]
365		self._writeInfoToPlist(info)
366		reader = UFOReader(self.dstDir, validate=True)
367		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
368		## too many values
369		info = dict(fontInfoVersion2)
370		info["openTypeOS2FamilyClass"] = [1, 1, 1]
371		self._writeInfoToPlist(info)
372		reader = UFOReader(self.dstDir, validate=True)
373		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
374		## out of range
375		info = dict(fontInfoVersion2)
376		info["openTypeOS2FamilyClass"] = [1, 201]
377		self._writeInfoToPlist(info)
378		reader = UFOReader(self.dstDir, validate=True)
379		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
380		# openTypeOS2UnicodeRanges
381		## not an int
382		info = dict(fontInfoVersion2)
383		info["openTypeOS2UnicodeRanges"] = ["0"]
384		self._writeInfoToPlist(info)
385		reader = UFOReader(self.dstDir, validate=True)
386		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
387		## out of range
388		info = dict(fontInfoVersion2)
389		info["openTypeOS2UnicodeRanges"] = [-1]
390		self._writeInfoToPlist(info)
391		reader = UFOReader(self.dstDir, validate=True)
392		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
393		# openTypeOS2CodePageRanges
394		## not an int
395		info = dict(fontInfoVersion2)
396		info["openTypeOS2CodePageRanges"] = ["0"]
397		self._writeInfoToPlist(info)
398		reader = UFOReader(self.dstDir, validate=True)
399		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
400		## out of range
401		info = dict(fontInfoVersion2)
402		info["openTypeOS2CodePageRanges"] = [-1]
403		self._writeInfoToPlist(info)
404		reader = UFOReader(self.dstDir, validate=True)
405		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
406		# openTypeOS2TypoAscender
407		info = dict(fontInfoVersion2)
408		info["openTypeOS2TypoAscender"] = "abc"
409		self._writeInfoToPlist(info)
410		reader = UFOReader(self.dstDir, validate=True)
411		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
412		# openTypeOS2TypoDescender
413		info = dict(fontInfoVersion2)
414		info["openTypeOS2TypoDescender"] = "abc"
415		self._writeInfoToPlist(info)
416		reader = UFOReader(self.dstDir, validate=True)
417		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
418		# openTypeOS2TypoLineGap
419		info = dict(fontInfoVersion2)
420		info["openTypeOS2TypoLineGap"] = "abc"
421		self._writeInfoToPlist(info)
422		reader = UFOReader(self.dstDir, validate=True)
423		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
424		# openTypeOS2WinAscent
425		info = dict(fontInfoVersion2)
426		info["openTypeOS2WinAscent"] = "abc"
427		self._writeInfoToPlist(info)
428		reader = UFOReader(self.dstDir, validate=True)
429		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
430		# openTypeOS2WinDescent
431		info = dict(fontInfoVersion2)
432		info["openTypeOS2WinDescent"] = "abc"
433		self._writeInfoToPlist(info)
434		reader = UFOReader(self.dstDir, validate=True)
435		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
436		# openTypeOS2Type
437		## not an int
438		info = dict(fontInfoVersion2)
439		info["openTypeOS2Type"] = ["1"]
440		self._writeInfoToPlist(info)
441		reader = UFOReader(self.dstDir, validate=True)
442		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
443		## out of range
444		info = dict(fontInfoVersion2)
445		info["openTypeOS2Type"] = [-1]
446		self._writeInfoToPlist(info)
447		reader = UFOReader(self.dstDir, validate=True)
448		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
449		# openTypeOS2SubscriptXSize
450		info = dict(fontInfoVersion2)
451		info["openTypeOS2SubscriptXSize"] = "abc"
452		self._writeInfoToPlist(info)
453		reader = UFOReader(self.dstDir, validate=True)
454		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
455		# openTypeOS2SubscriptYSize
456		info = dict(fontInfoVersion2)
457		info["openTypeOS2SubscriptYSize"] = "abc"
458		self._writeInfoToPlist(info)
459		reader = UFOReader(self.dstDir, validate=True)
460		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
461		# openTypeOS2SubscriptXOffset
462		info = dict(fontInfoVersion2)
463		info["openTypeOS2SubscriptXOffset"] = "abc"
464		self._writeInfoToPlist(info)
465		reader = UFOReader(self.dstDir, validate=True)
466		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
467		# openTypeOS2SubscriptYOffset
468		info = dict(fontInfoVersion2)
469		info["openTypeOS2SubscriptYOffset"] = "abc"
470		self._writeInfoToPlist(info)
471		reader = UFOReader(self.dstDir, validate=True)
472		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
473		# openTypeOS2SuperscriptXSize
474		info = dict(fontInfoVersion2)
475		info["openTypeOS2SuperscriptXSize"] = "abc"
476		self._writeInfoToPlist(info)
477		reader = UFOReader(self.dstDir, validate=True)
478		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
479		# openTypeOS2SuperscriptYSize
480		info = dict(fontInfoVersion2)
481		info["openTypeOS2SuperscriptYSize"] = "abc"
482		self._writeInfoToPlist(info)
483		reader = UFOReader(self.dstDir, validate=True)
484		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
485		# openTypeOS2SuperscriptXOffset
486		info = dict(fontInfoVersion2)
487		info["openTypeOS2SuperscriptXOffset"] = "abc"
488		self._writeInfoToPlist(info)
489		reader = UFOReader(self.dstDir, validate=True)
490		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
491		# openTypeOS2SuperscriptYOffset
492		info = dict(fontInfoVersion2)
493		info["openTypeOS2SuperscriptYOffset"] = "abc"
494		self._writeInfoToPlist(info)
495		reader = UFOReader(self.dstDir, validate=True)
496		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
497		# openTypeOS2StrikeoutSize
498		info = dict(fontInfoVersion2)
499		info["openTypeOS2StrikeoutSize"] = "abc"
500		self._writeInfoToPlist(info)
501		reader = UFOReader(self.dstDir, validate=True)
502		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
503		# openTypeOS2StrikeoutPosition
504		info = dict(fontInfoVersion2)
505		info["openTypeOS2StrikeoutPosition"] = "abc"
506		self._writeInfoToPlist(info)
507		reader = UFOReader(self.dstDir, validate=True)
508		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
509
510	def testVheaRead(self):
511		# openTypeVheaVertTypoAscender
512		info = dict(fontInfoVersion2)
513		info["openTypeVheaVertTypoAscender"] = "abc"
514		self._writeInfoToPlist(info)
515		reader = UFOReader(self.dstDir, validate=True)
516		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
517		# openTypeVheaVertTypoDescender
518		info = dict(fontInfoVersion2)
519		info["openTypeVheaVertTypoDescender"] = "abc"
520		self._writeInfoToPlist(info)
521		reader = UFOReader(self.dstDir, validate=True)
522		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
523		# openTypeVheaVertTypoLineGap
524		info = dict(fontInfoVersion2)
525		info["openTypeVheaVertTypoLineGap"] = "abc"
526		self._writeInfoToPlist(info)
527		reader = UFOReader(self.dstDir, validate=True)
528		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
529		# openTypeVheaCaretSlopeRise
530		info = dict(fontInfoVersion2)
531		info["openTypeVheaCaretSlopeRise"] = "abc"
532		self._writeInfoToPlist(info)
533		reader = UFOReader(self.dstDir, validate=True)
534		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
535		# openTypeVheaCaretSlopeRun
536		info = dict(fontInfoVersion2)
537		info["openTypeVheaCaretSlopeRun"] = "abc"
538		self._writeInfoToPlist(info)
539		reader = UFOReader(self.dstDir, validate=True)
540		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
541		# openTypeVheaCaretOffset
542		info = dict(fontInfoVersion2)
543		info["openTypeVheaCaretOffset"] = "abc"
544		self._writeInfoToPlist(info)
545		reader = UFOReader(self.dstDir, validate=True)
546		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
547
548	def testFONDRead(self):
549		# macintoshFONDFamilyID
550		info = dict(fontInfoVersion2)
551		info["macintoshFONDFamilyID"] = "abc"
552		self._writeInfoToPlist(info)
553		reader = UFOReader(self.dstDir, validate=True)
554		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
555		# macintoshFONDName
556		info = dict(fontInfoVersion2)
557		info["macintoshFONDName"] = 123
558		self._writeInfoToPlist(info)
559		reader = UFOReader(self.dstDir, validate=True)
560		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
561
562	def testPostscriptRead(self):
563		# postscriptFontName
564		info = dict(fontInfoVersion2)
565		info["postscriptFontName"] = 123
566		self._writeInfoToPlist(info)
567		reader = UFOReader(self.dstDir, validate=True)
568		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
569		# postscriptFullName
570		info = dict(fontInfoVersion2)
571		info["postscriptFullName"] = 123
572		self._writeInfoToPlist(info)
573		reader = UFOReader(self.dstDir, validate=True)
574		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
575		# postscriptSlantAngle
576		info = dict(fontInfoVersion2)
577		info["postscriptSlantAngle"] = "abc"
578		self._writeInfoToPlist(info)
579		reader = UFOReader(self.dstDir, validate=True)
580		self.assertRaises(UFOLibError, reader.readInfo, info=TestInfoObject())
581		# postscriptUniqueID
582		info = dict(fontInfoVersion2)
583		info["postscriptUniqueID"] = "abc"
584		self._writeInfoToPlist(info)
585		reader = UFOReader(self.dstDir, validate=True)
586		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
587		# postscriptUnderlineThickness
588		info = dict(fontInfoVersion2)
589		info["postscriptUnderlineThickness"] = "abc"
590		self._writeInfoToPlist(info)
591		reader = UFOReader(self.dstDir, validate=True)
592		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
593		# postscriptUnderlinePosition
594		info = dict(fontInfoVersion2)
595		info["postscriptUnderlinePosition"] = "abc"
596		self._writeInfoToPlist(info)
597		reader = UFOReader(self.dstDir, validate=True)
598		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
599		# postscriptIsFixedPitch
600		info = dict(fontInfoVersion2)
601		info["postscriptIsFixedPitch"] = 2
602		self._writeInfoToPlist(info)
603		reader = UFOReader(self.dstDir, validate=True)
604		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
605		# postscriptBlueValues
606		## not a list
607		info = dict(fontInfoVersion2)
608		info["postscriptBlueValues"] = "abc"
609		self._writeInfoToPlist(info)
610		reader = UFOReader(self.dstDir, validate=True)
611		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
612		## uneven value count
613		info = dict(fontInfoVersion2)
614		info["postscriptBlueValues"] = [500]
615		self._writeInfoToPlist(info)
616		reader = UFOReader(self.dstDir, validate=True)
617		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
618		## too many values
619		info = dict(fontInfoVersion2)
620		info["postscriptBlueValues"] = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
621		self._writeInfoToPlist(info)
622		reader = UFOReader(self.dstDir, validate=True)
623		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
624		# postscriptOtherBlues
625		## not a list
626		info = dict(fontInfoVersion2)
627		info["postscriptOtherBlues"] = "abc"
628		self._writeInfoToPlist(info)
629		reader = UFOReader(self.dstDir, validate=True)
630		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
631		## uneven value count
632		info = dict(fontInfoVersion2)
633		info["postscriptOtherBlues"] = [500]
634		self._writeInfoToPlist(info)
635		reader = UFOReader(self.dstDir, validate=True)
636		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
637		## too many values
638		info = dict(fontInfoVersion2)
639		info["postscriptOtherBlues"] = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
640		self._writeInfoToPlist(info)
641		reader = UFOReader(self.dstDir, validate=True)
642		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
643		# postscriptFamilyBlues
644		## not a list
645		info = dict(fontInfoVersion2)
646		info["postscriptFamilyBlues"] = "abc"
647		self._writeInfoToPlist(info)
648		reader = UFOReader(self.dstDir, validate=True)
649		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
650		## uneven value count
651		info = dict(fontInfoVersion2)
652		info["postscriptFamilyBlues"] = [500]
653		self._writeInfoToPlist(info)
654		reader = UFOReader(self.dstDir, validate=True)
655		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
656		## too many values
657		info = dict(fontInfoVersion2)
658		info["postscriptFamilyBlues"] = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
659		self._writeInfoToPlist(info)
660		reader = UFOReader(self.dstDir, validate=True)
661		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
662		# postscriptFamilyOtherBlues
663		## not a list
664		info = dict(fontInfoVersion2)
665		info["postscriptFamilyOtherBlues"] = "abc"
666		self._writeInfoToPlist(info)
667		reader = UFOReader(self.dstDir, validate=True)
668		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
669		## uneven value count
670		info = dict(fontInfoVersion2)
671		info["postscriptFamilyOtherBlues"] = [500]
672		self._writeInfoToPlist(info)
673		reader = UFOReader(self.dstDir, validate=True)
674		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
675		## too many values
676		info = dict(fontInfoVersion2)
677		info["postscriptFamilyOtherBlues"] = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
678		self._writeInfoToPlist(info)
679		reader = UFOReader(self.dstDir, validate=True)
680		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
681		# postscriptStemSnapH
682		## not list
683		info = dict(fontInfoVersion2)
684		info["postscriptStemSnapH"] = "abc"
685		self._writeInfoToPlist(info)
686		reader = UFOReader(self.dstDir, validate=True)
687		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
688		## too many values
689		info = dict(fontInfoVersion2)
690		info["postscriptStemSnapH"] = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
691		self._writeInfoToPlist(info)
692		reader = UFOReader(self.dstDir, validate=True)
693		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
694		# postscriptStemSnapV
695		## not list
696		info = dict(fontInfoVersion2)
697		info["postscriptStemSnapV"] = "abc"
698		self._writeInfoToPlist(info)
699		reader = UFOReader(self.dstDir, validate=True)
700		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
701		## too many values
702		info = dict(fontInfoVersion2)
703		info["postscriptStemSnapV"] = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
704		self._writeInfoToPlist(info)
705		reader = UFOReader(self.dstDir, validate=True)
706		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
707		# postscriptBlueFuzz
708		info = dict(fontInfoVersion2)
709		info["postscriptBlueFuzz"] = "abc"
710		self._writeInfoToPlist(info)
711		reader = UFOReader(self.dstDir, validate=True)
712		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
713		# postscriptBlueShift
714		info = dict(fontInfoVersion2)
715		info["postscriptBlueShift"] = "abc"
716		self._writeInfoToPlist(info)
717		reader = UFOReader(self.dstDir, validate=True)
718		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
719		# postscriptBlueScale
720		info = dict(fontInfoVersion2)
721		info["postscriptBlueScale"] = "abc"
722		self._writeInfoToPlist(info)
723		reader = UFOReader(self.dstDir, validate=True)
724		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
725		# postscriptForceBold
726		info = dict(fontInfoVersion2)
727		info["postscriptForceBold"] = "abc"
728		self._writeInfoToPlist(info)
729		reader = UFOReader(self.dstDir, validate=True)
730		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
731		# postscriptDefaultWidthX
732		info = dict(fontInfoVersion2)
733		info["postscriptDefaultWidthX"] = "abc"
734		self._writeInfoToPlist(info)
735		reader = UFOReader(self.dstDir, validate=True)
736		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
737		# postscriptNominalWidthX
738		info = dict(fontInfoVersion2)
739		info["postscriptNominalWidthX"] = "abc"
740		self._writeInfoToPlist(info)
741		reader = UFOReader(self.dstDir, validate=True)
742		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
743		# postscriptWeightName
744		info = dict(fontInfoVersion2)
745		info["postscriptWeightName"] = 123
746		self._writeInfoToPlist(info)
747		reader = UFOReader(self.dstDir, validate=True)
748		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
749		# postscriptDefaultCharacter
750		info = dict(fontInfoVersion2)
751		info["postscriptDefaultCharacter"] = 123
752		self._writeInfoToPlist(info)
753		reader = UFOReader(self.dstDir, validate=True)
754		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
755		# postscriptWindowsCharacterSet
756		info = dict(fontInfoVersion2)
757		info["postscriptWindowsCharacterSet"] = -1
758		self._writeInfoToPlist(info)
759		reader = UFOReader(self.dstDir, validate=True)
760		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
761		# macintoshFONDFamilyID
762		info = dict(fontInfoVersion2)
763		info["macintoshFONDFamilyID"] = "abc"
764		self._writeInfoToPlist(info)
765		reader = UFOReader(self.dstDir, validate=True)
766		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
767		# macintoshFONDName
768		info = dict(fontInfoVersion2)
769		info["macintoshFONDName"] = 123
770		self._writeInfoToPlist(info)
771		reader = UFOReader(self.dstDir, validate=True)
772		self.assertRaises(UFOLibError, reader.readInfo, TestInfoObject())
773
774
775class WriteFontInfoVersion2TestCase(unittest.TestCase):
776
777	def setUp(self):
778		self.tempDir = tempfile.mktemp()
779		os.mkdir(self.tempDir)
780		self.dstDir = os.path.join(self.tempDir, "test.ufo")
781
782	def tearDown(self):
783		shutil.rmtree(self.tempDir)
784
785	def makeInfoObject(self):
786		infoObject = TestInfoObject()
787		for attr, value in list(fontInfoVersion2.items()):
788			setattr(infoObject, attr, value)
789		return infoObject
790
791	def readPlist(self):
792		path = os.path.join(self.dstDir, "fontinfo.plist")
793		with open(path, "rb") as f:
794			plist = plistlib.load(f)
795		return plist
796
797	def testWrite(self):
798		infoObject = self.makeInfoObject()
799		writer = UFOWriter(self.dstDir, formatVersion=2)
800		writer.writeInfo(infoObject)
801		writtenData = self.readPlist()
802		for attr, originalValue in list(fontInfoVersion2.items()):
803			newValue = writtenData[attr]
804			self.assertEqual(newValue, originalValue)
805
806	def testGenericWrite(self):
807		# familyName
808		infoObject = self.makeInfoObject()
809		infoObject.familyName = 123
810		writer = UFOWriter(self.dstDir, formatVersion=2)
811		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
812		# styleName
813		infoObject = self.makeInfoObject()
814		infoObject.styleName = 123
815		writer = UFOWriter(self.dstDir, formatVersion=2)
816		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
817		# styleMapFamilyName
818		infoObject = self.makeInfoObject()
819		infoObject.styleMapFamilyName = 123
820		writer = UFOWriter(self.dstDir, formatVersion=2)
821		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
822		# styleMapStyleName
823		## not a string
824		infoObject = self.makeInfoObject()
825		infoObject.styleMapStyleName = 123
826		writer = UFOWriter(self.dstDir, formatVersion=2)
827		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
828		## out of range
829		infoObject = self.makeInfoObject()
830		infoObject.styleMapStyleName = "REGULAR"
831		writer = UFOWriter(self.dstDir, formatVersion=2)
832		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
833		# versionMajor
834		infoObject = self.makeInfoObject()
835		infoObject.versionMajor = "1"
836		writer = UFOWriter(self.dstDir, formatVersion=2)
837		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
838		# versionMinor
839		infoObject = self.makeInfoObject()
840		infoObject.versionMinor = "0"
841		writer = UFOWriter(self.dstDir, formatVersion=2)
842		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
843		# copyright
844		infoObject = self.makeInfoObject()
845		infoObject.copyright = 123
846		writer = UFOWriter(self.dstDir, formatVersion=2)
847		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
848		# trademark
849		infoObject = self.makeInfoObject()
850		infoObject.trademark = 123
851		writer = UFOWriter(self.dstDir, formatVersion=2)
852		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
853		# unitsPerEm
854		infoObject = self.makeInfoObject()
855		infoObject.unitsPerEm = "abc"
856		writer = UFOWriter(self.dstDir, formatVersion=2)
857		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
858		# descender
859		infoObject = self.makeInfoObject()
860		infoObject.descender = "abc"
861		writer = UFOWriter(self.dstDir, formatVersion=2)
862		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
863		# xHeight
864		infoObject = self.makeInfoObject()
865		infoObject.xHeight = "abc"
866		writer = UFOWriter(self.dstDir, formatVersion=2)
867		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
868		# capHeight
869		infoObject = self.makeInfoObject()
870		infoObject.capHeight = "abc"
871		writer = UFOWriter(self.dstDir, formatVersion=2)
872		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
873		# ascender
874		infoObject = self.makeInfoObject()
875		infoObject.ascender = "abc"
876		writer = UFOWriter(self.dstDir, formatVersion=2)
877		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
878		# italicAngle
879		infoObject = self.makeInfoObject()
880		infoObject.italicAngle = "abc"
881		writer = UFOWriter(self.dstDir, formatVersion=2)
882		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
883
884	def testHeadWrite(self):
885		# openTypeHeadCreated
886		## not a string
887		infoObject = self.makeInfoObject()
888		infoObject.openTypeHeadCreated = 123
889		writer = UFOWriter(self.dstDir, formatVersion=2)
890		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
891		## invalid format
892		infoObject = self.makeInfoObject()
893		infoObject.openTypeHeadCreated = "2000-Jan-01 00:00:00"
894		writer = UFOWriter(self.dstDir, formatVersion=2)
895		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
896		# openTypeHeadLowestRecPPEM
897		infoObject = self.makeInfoObject()
898		infoObject.openTypeHeadLowestRecPPEM = "abc"
899		writer = UFOWriter(self.dstDir, formatVersion=2)
900		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
901		# openTypeHeadFlags
902		infoObject = self.makeInfoObject()
903		infoObject.openTypeHeadFlags = [-1]
904		writer = UFOWriter(self.dstDir, formatVersion=2)
905		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
906
907	def testHheaWrite(self):
908		# openTypeHheaAscender
909		infoObject = self.makeInfoObject()
910		infoObject.openTypeHheaAscender = "abc"
911		writer = UFOWriter(self.dstDir, formatVersion=2)
912		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
913		# openTypeHheaDescender
914		infoObject = self.makeInfoObject()
915		infoObject.openTypeHheaDescender = "abc"
916		writer = UFOWriter(self.dstDir, formatVersion=2)
917		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
918		# openTypeHheaLineGap
919		infoObject = self.makeInfoObject()
920		infoObject.openTypeHheaLineGap = "abc"
921		writer = UFOWriter(self.dstDir, formatVersion=2)
922		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
923		# openTypeHheaCaretSlopeRise
924		infoObject = self.makeInfoObject()
925		infoObject.openTypeHheaCaretSlopeRise = "abc"
926		writer = UFOWriter(self.dstDir, formatVersion=2)
927		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
928		# openTypeHheaCaretSlopeRun
929		infoObject = self.makeInfoObject()
930		infoObject.openTypeHheaCaretSlopeRun = "abc"
931		writer = UFOWriter(self.dstDir, formatVersion=2)
932		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
933		# openTypeHheaCaretOffset
934		infoObject = self.makeInfoObject()
935		infoObject.openTypeHheaCaretOffset = "abc"
936		writer = UFOWriter(self.dstDir, formatVersion=2)
937		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
938
939	def testNameWrite(self):
940		# openTypeNameDesigner
941		infoObject = self.makeInfoObject()
942		infoObject.openTypeNameDesigner = 123
943		writer = UFOWriter(self.dstDir, formatVersion=2)
944		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
945		# openTypeNameDesignerURL
946		infoObject = self.makeInfoObject()
947		infoObject.openTypeNameDesignerURL = 123
948		writer = UFOWriter(self.dstDir, formatVersion=2)
949		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
950		# openTypeNameManufacturer
951		infoObject = self.makeInfoObject()
952		infoObject.openTypeNameManufacturer = 123
953		writer = UFOWriter(self.dstDir, formatVersion=2)
954		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
955		# openTypeNameManufacturerURL
956		infoObject = self.makeInfoObject()
957		infoObject.openTypeNameManufacturerURL = 123
958		writer = UFOWriter(self.dstDir, formatVersion=2)
959		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
960		# openTypeNameLicense
961		infoObject = self.makeInfoObject()
962		infoObject.openTypeNameLicense = 123
963		writer = UFOWriter(self.dstDir, formatVersion=2)
964		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
965		# openTypeNameLicenseURL
966		infoObject = self.makeInfoObject()
967		infoObject.openTypeNameLicenseURL = 123
968		writer = UFOWriter(self.dstDir, formatVersion=2)
969		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
970		# openTypeNameVersion
971		infoObject = self.makeInfoObject()
972		infoObject.openTypeNameVersion = 123
973		writer = UFOWriter(self.dstDir, formatVersion=2)
974		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
975		# openTypeNameUniqueID
976		infoObject = self.makeInfoObject()
977		infoObject.openTypeNameUniqueID = 123
978		writer = UFOWriter(self.dstDir, formatVersion=2)
979		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
980		# openTypeNameDescription
981		infoObject = self.makeInfoObject()
982		infoObject.openTypeNameDescription = 123
983		writer = UFOWriter(self.dstDir, formatVersion=2)
984		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
985		# openTypeNamePreferredFamilyName
986		infoObject = self.makeInfoObject()
987		infoObject.openTypeNamePreferredFamilyName = 123
988		writer = UFOWriter(self.dstDir, formatVersion=2)
989		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
990		# openTypeNamePreferredSubfamilyName
991		infoObject = self.makeInfoObject()
992		infoObject.openTypeNamePreferredSubfamilyName = 123
993		writer = UFOWriter(self.dstDir, formatVersion=2)
994		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
995		# openTypeNameCompatibleFullName
996		infoObject = self.makeInfoObject()
997		infoObject.openTypeNameCompatibleFullName = 123
998		writer = UFOWriter(self.dstDir, formatVersion=2)
999		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1000		# openTypeNameSampleText
1001		infoObject = self.makeInfoObject()
1002		infoObject.openTypeNameSampleText = 123
1003		writer = UFOWriter(self.dstDir, formatVersion=2)
1004		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1005		# openTypeNameWWSFamilyName
1006		infoObject = self.makeInfoObject()
1007		infoObject.openTypeNameWWSFamilyName = 123
1008		writer = UFOWriter(self.dstDir, formatVersion=2)
1009		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1010		# openTypeNameWWSSubfamilyName
1011		infoObject = self.makeInfoObject()
1012		infoObject.openTypeNameWWSSubfamilyName = 123
1013		writer = UFOWriter(self.dstDir, formatVersion=2)
1014		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1015
1016	def testOS2Write(self):
1017		# openTypeOS2WidthClass
1018		## not an int
1019		infoObject = self.makeInfoObject()
1020		infoObject.openTypeOS2WidthClass = "abc"
1021		writer = UFOWriter(self.dstDir, formatVersion=2)
1022		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1023		## out or range
1024		infoObject = self.makeInfoObject()
1025		infoObject.openTypeOS2WidthClass = 15
1026		writer = UFOWriter(self.dstDir, formatVersion=2)
1027		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1028		# openTypeOS2WeightClass
1029		infoObject = self.makeInfoObject()
1030		## not an int
1031		infoObject.openTypeOS2WeightClass = "abc"
1032		writer = UFOWriter(self.dstDir, formatVersion=2)
1033		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1034		## out of range
1035		infoObject.openTypeOS2WeightClass = -50
1036		writer = UFOWriter(self.dstDir, formatVersion=2)
1037		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1038		# openTypeOS2Selection
1039		infoObject = self.makeInfoObject()
1040		infoObject.openTypeOS2Selection = [-1]
1041		writer = UFOWriter(self.dstDir, formatVersion=2)
1042		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1043		# openTypeOS2VendorID
1044		infoObject = self.makeInfoObject()
1045		infoObject.openTypeOS2VendorID = 1234
1046		writer = UFOWriter(self.dstDir, formatVersion=2)
1047		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1048		# openTypeOS2Panose
1049		## not an int
1050		infoObject = self.makeInfoObject()
1051		infoObject.openTypeOS2Panose = [0, 1, 2, 3, 4, 5, 6, 7, 8, str(9)]
1052		writer = UFOWriter(self.dstDir, formatVersion=2)
1053		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1054		## too few values
1055		infoObject = self.makeInfoObject()
1056		infoObject.openTypeOS2Panose = [0, 1, 2, 3]
1057		writer = UFOWriter(self.dstDir, formatVersion=2)
1058		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1059		## too many values
1060		infoObject = self.makeInfoObject()
1061		infoObject.openTypeOS2Panose = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
1062		writer = UFOWriter(self.dstDir, formatVersion=2)
1063		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1064		# openTypeOS2FamilyClass
1065		## not an int
1066		infoObject = self.makeInfoObject()
1067		infoObject.openTypeOS2FamilyClass = [0, str(1)]
1068		writer = UFOWriter(self.dstDir, formatVersion=2)
1069		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1070		## too few values
1071		infoObject = self.makeInfoObject()
1072		infoObject.openTypeOS2FamilyClass = [1]
1073		writer = UFOWriter(self.dstDir, formatVersion=2)
1074		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1075		## too many values
1076		infoObject = self.makeInfoObject()
1077		infoObject.openTypeOS2FamilyClass = [1, 1, 1]
1078		writer = UFOWriter(self.dstDir, formatVersion=2)
1079		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1080		## out of range
1081		infoObject = self.makeInfoObject()
1082		infoObject.openTypeOS2FamilyClass = [1, 20]
1083		writer = UFOWriter(self.dstDir, formatVersion=2)
1084		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1085		# openTypeOS2UnicodeRanges
1086		## not an int
1087		infoObject = self.makeInfoObject()
1088		infoObject.openTypeOS2UnicodeRanges = ["0"]
1089		writer = UFOWriter(self.dstDir, formatVersion=2)
1090		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1091		## out of range
1092		infoObject = self.makeInfoObject()
1093		infoObject.openTypeOS2UnicodeRanges = [-1]
1094		writer = UFOWriter(self.dstDir, formatVersion=2)
1095		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1096		# openTypeOS2CodePageRanges
1097		## not an int
1098		infoObject = self.makeInfoObject()
1099		infoObject.openTypeOS2CodePageRanges = ["0"]
1100		writer = UFOWriter(self.dstDir, formatVersion=2)
1101		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1102		## out of range
1103		infoObject = self.makeInfoObject()
1104		infoObject.openTypeOS2CodePageRanges = [-1]
1105		writer = UFOWriter(self.dstDir, formatVersion=2)
1106		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1107		# openTypeOS2TypoAscender
1108		infoObject = self.makeInfoObject()
1109		infoObject.openTypeOS2TypoAscender = "abc"
1110		writer = UFOWriter(self.dstDir, formatVersion=2)
1111		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1112		# openTypeOS2TypoDescender
1113		infoObject = self.makeInfoObject()
1114		infoObject.openTypeOS2TypoDescender = "abc"
1115		writer = UFOWriter(self.dstDir, formatVersion=2)
1116		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1117		# openTypeOS2TypoLineGap
1118		infoObject = self.makeInfoObject()
1119		infoObject.openTypeOS2TypoLineGap = "abc"
1120		writer = UFOWriter(self.dstDir, formatVersion=2)
1121		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1122		# openTypeOS2WinAscent
1123		infoObject = self.makeInfoObject()
1124		infoObject.openTypeOS2WinAscent = "abc"
1125		writer = UFOWriter(self.dstDir, formatVersion=2)
1126		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1127		# openTypeOS2WinDescent
1128		infoObject = self.makeInfoObject()
1129		infoObject.openTypeOS2WinDescent = "abc"
1130		writer = UFOWriter(self.dstDir, formatVersion=2)
1131		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1132		# openTypeOS2Type
1133		## not an int
1134		infoObject = self.makeInfoObject()
1135		infoObject.openTypeOS2Type = ["1"]
1136		writer = UFOWriter(self.dstDir, formatVersion=2)
1137		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1138		## out of range
1139		infoObject = self.makeInfoObject()
1140		infoObject.openTypeOS2Type = [-1]
1141		writer = UFOWriter(self.dstDir, formatVersion=2)
1142		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1143		# openTypeOS2SubscriptXSize
1144		infoObject = self.makeInfoObject()
1145		infoObject.openTypeOS2SubscriptXSize = "abc"
1146		writer = UFOWriter(self.dstDir, formatVersion=2)
1147		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1148		# openTypeOS2SubscriptYSize
1149		infoObject = self.makeInfoObject()
1150		infoObject.openTypeOS2SubscriptYSize = "abc"
1151		writer = UFOWriter(self.dstDir, formatVersion=2)
1152		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1153		# openTypeOS2SubscriptXOffset
1154		infoObject = self.makeInfoObject()
1155		infoObject.openTypeOS2SubscriptXOffset = "abc"
1156		writer = UFOWriter(self.dstDir, formatVersion=2)
1157		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1158		# openTypeOS2SubscriptYOffset
1159		infoObject = self.makeInfoObject()
1160		infoObject.openTypeOS2SubscriptYOffset = "abc"
1161		writer = UFOWriter(self.dstDir, formatVersion=2)
1162		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1163		# openTypeOS2SuperscriptXSize
1164		infoObject = self.makeInfoObject()
1165		infoObject.openTypeOS2SuperscriptXSize = "abc"
1166		writer = UFOWriter(self.dstDir, formatVersion=2)
1167		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1168		# openTypeOS2SuperscriptYSize
1169		infoObject = self.makeInfoObject()
1170		infoObject.openTypeOS2SuperscriptYSize = "abc"
1171		writer = UFOWriter(self.dstDir, formatVersion=2)
1172		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1173		# openTypeOS2SuperscriptXOffset
1174		infoObject = self.makeInfoObject()
1175		infoObject.openTypeOS2SuperscriptXOffset = "abc"
1176		writer = UFOWriter(self.dstDir, formatVersion=2)
1177		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1178		# openTypeOS2SuperscriptYOffset
1179		infoObject = self.makeInfoObject()
1180		infoObject.openTypeOS2SuperscriptYOffset = "abc"
1181		writer = UFOWriter(self.dstDir, formatVersion=2)
1182		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1183		# openTypeOS2StrikeoutSize
1184		infoObject = self.makeInfoObject()
1185		infoObject.openTypeOS2StrikeoutSize = "abc"
1186		writer = UFOWriter(self.dstDir, formatVersion=2)
1187		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1188		# openTypeOS2StrikeoutPosition
1189		infoObject = self.makeInfoObject()
1190		infoObject.openTypeOS2StrikeoutPosition = "abc"
1191		writer = UFOWriter(self.dstDir, formatVersion=2)
1192		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1193
1194	def testVheaWrite(self):
1195		# openTypeVheaVertTypoAscender
1196		infoObject = self.makeInfoObject()
1197		infoObject.openTypeVheaVertTypoAscender = "abc"
1198		writer = UFOWriter(self.dstDir, formatVersion=2)
1199		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1200		# openTypeVheaVertTypoDescender
1201		infoObject = self.makeInfoObject()
1202		infoObject.openTypeVheaVertTypoDescender = "abc"
1203		writer = UFOWriter(self.dstDir, formatVersion=2)
1204		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1205		# openTypeVheaVertTypoLineGap
1206		infoObject = self.makeInfoObject()
1207		infoObject.openTypeVheaVertTypoLineGap = "abc"
1208		writer = UFOWriter(self.dstDir, formatVersion=2)
1209		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1210		# openTypeVheaCaretSlopeRise
1211		infoObject = self.makeInfoObject()
1212		infoObject.openTypeVheaCaretSlopeRise = "abc"
1213		writer = UFOWriter(self.dstDir, formatVersion=2)
1214		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1215		# openTypeVheaCaretSlopeRun
1216		infoObject = self.makeInfoObject()
1217		infoObject.openTypeVheaCaretSlopeRun = "abc"
1218		writer = UFOWriter(self.dstDir, formatVersion=2)
1219		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1220		# openTypeVheaCaretOffset
1221		infoObject = self.makeInfoObject()
1222		infoObject.openTypeVheaCaretOffset = "abc"
1223		writer = UFOWriter(self.dstDir, formatVersion=2)
1224		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1225
1226	def testFONDWrite(self):
1227		# macintoshFONDFamilyID
1228		infoObject = self.makeInfoObject()
1229		infoObject.macintoshFONDFamilyID = "abc"
1230		writer = UFOWriter(self.dstDir, formatVersion=2)
1231		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1232		# macintoshFONDName
1233		infoObject = self.makeInfoObject()
1234		infoObject.macintoshFONDName = 123
1235		writer = UFOWriter(self.dstDir, formatVersion=2)
1236		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1237
1238	def testPostscriptWrite(self):
1239		# postscriptFontName
1240		infoObject = self.makeInfoObject()
1241		infoObject.postscriptFontName = 123
1242		writer = UFOWriter(self.dstDir, formatVersion=2)
1243		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1244		# postscriptFullName
1245		infoObject = self.makeInfoObject()
1246		infoObject.postscriptFullName = 123
1247		writer = UFOWriter(self.dstDir, formatVersion=2)
1248		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1249		# postscriptSlantAngle
1250		infoObject = self.makeInfoObject()
1251		infoObject.postscriptSlantAngle = "abc"
1252		writer = UFOWriter(self.dstDir, formatVersion=2)
1253		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1254		# postscriptUniqueID
1255		infoObject = self.makeInfoObject()
1256		infoObject.postscriptUniqueID = "abc"
1257		writer = UFOWriter(self.dstDir, formatVersion=2)
1258		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1259		# postscriptUnderlineThickness
1260		infoObject = self.makeInfoObject()
1261		infoObject.postscriptUnderlineThickness = "abc"
1262		writer = UFOWriter(self.dstDir, formatVersion=2)
1263		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1264		# postscriptUnderlinePosition
1265		infoObject = self.makeInfoObject()
1266		infoObject.postscriptUnderlinePosition = "abc"
1267		writer = UFOWriter(self.dstDir, formatVersion=2)
1268		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1269		# postscriptIsFixedPitch
1270		infoObject = self.makeInfoObject()
1271		infoObject.postscriptIsFixedPitch = 2
1272		writer = UFOWriter(self.dstDir, formatVersion=2)
1273		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1274		# postscriptBlueValues
1275		## not a list
1276		infoObject = self.makeInfoObject()
1277		infoObject.postscriptBlueValues = "abc"
1278		writer = UFOWriter(self.dstDir, formatVersion=2)
1279		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1280		## uneven value count
1281		infoObject = self.makeInfoObject()
1282		infoObject.postscriptBlueValues = [500]
1283		writer = UFOWriter(self.dstDir, formatVersion=2)
1284		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1285		## too many values
1286		infoObject = self.makeInfoObject()
1287		infoObject.postscriptBlueValues = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
1288		writer = UFOWriter(self.dstDir, formatVersion=2)
1289		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1290		# postscriptOtherBlues
1291		## not a list
1292		infoObject = self.makeInfoObject()
1293		infoObject.postscriptOtherBlues = "abc"
1294		writer = UFOWriter(self.dstDir, formatVersion=2)
1295		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1296		## uneven value count
1297		infoObject = self.makeInfoObject()
1298		infoObject.postscriptOtherBlues = [500]
1299		writer = UFOWriter(self.dstDir, formatVersion=2)
1300		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1301		## too many values
1302		infoObject = self.makeInfoObject()
1303		infoObject.postscriptOtherBlues = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
1304		writer = UFOWriter(self.dstDir, formatVersion=2)
1305		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1306		# postscriptFamilyBlues
1307		## not a list
1308		infoObject = self.makeInfoObject()
1309		infoObject.postscriptFamilyBlues = "abc"
1310		writer = UFOWriter(self.dstDir, formatVersion=2)
1311		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1312		## uneven value count
1313		infoObject = self.makeInfoObject()
1314		infoObject.postscriptFamilyBlues = [500]
1315		writer = UFOWriter(self.dstDir, formatVersion=2)
1316		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1317		## too many values
1318		infoObject = self.makeInfoObject()
1319		infoObject.postscriptFamilyBlues = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
1320		writer = UFOWriter(self.dstDir, formatVersion=2)
1321		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1322		# postscriptFamilyOtherBlues
1323		## not a list
1324		infoObject = self.makeInfoObject()
1325		infoObject.postscriptFamilyOtherBlues = "abc"
1326		writer = UFOWriter(self.dstDir, formatVersion=2)
1327		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1328		## uneven value count
1329		infoObject = self.makeInfoObject()
1330		infoObject.postscriptFamilyOtherBlues = [500]
1331		writer = UFOWriter(self.dstDir, formatVersion=2)
1332		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1333		## too many values
1334		infoObject = self.makeInfoObject()
1335		infoObject.postscriptFamilyOtherBlues = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
1336		writer = UFOWriter(self.dstDir, formatVersion=2)
1337		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1338		# postscriptStemSnapH
1339		## not list
1340		infoObject = self.makeInfoObject()
1341		infoObject.postscriptStemSnapH = "abc"
1342		writer = UFOWriter(self.dstDir, formatVersion=2)
1343		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1344		## too many values
1345		infoObject = self.makeInfoObject()
1346		infoObject.postscriptStemSnapH = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
1347		writer = UFOWriter(self.dstDir, formatVersion=2)
1348		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1349		# postscriptStemSnapV
1350		## not list
1351		infoObject = self.makeInfoObject()
1352		infoObject.postscriptStemSnapV = "abc"
1353		writer = UFOWriter(self.dstDir, formatVersion=2)
1354		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1355		## too many values
1356		infoObject = self.makeInfoObject()
1357		infoObject.postscriptStemSnapV = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]
1358		writer = UFOWriter(self.dstDir, formatVersion=2)
1359		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1360		# postscriptBlueFuzz
1361		infoObject = self.makeInfoObject()
1362		infoObject.postscriptBlueFuzz = "abc"
1363		writer = UFOWriter(self.dstDir, formatVersion=2)
1364		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1365		# postscriptBlueShift
1366		infoObject = self.makeInfoObject()
1367		infoObject.postscriptBlueShift = "abc"
1368		writer = UFOWriter(self.dstDir, formatVersion=2)
1369		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1370		# postscriptBlueScale
1371		infoObject = self.makeInfoObject()
1372		infoObject.postscriptBlueScale = "abc"
1373		writer = UFOWriter(self.dstDir, formatVersion=2)
1374		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1375		# postscriptForceBold
1376		infoObject = self.makeInfoObject()
1377		infoObject.postscriptForceBold = "abc"
1378		writer = UFOWriter(self.dstDir, formatVersion=2)
1379		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1380		# postscriptDefaultWidthX
1381		infoObject = self.makeInfoObject()
1382		infoObject.postscriptDefaultWidthX = "abc"
1383		writer = UFOWriter(self.dstDir, formatVersion=2)
1384		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1385		# postscriptNominalWidthX
1386		infoObject = self.makeInfoObject()
1387		infoObject.postscriptNominalWidthX = "abc"
1388		writer = UFOWriter(self.dstDir, formatVersion=2)
1389		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1390		# postscriptWeightName
1391		infoObject = self.makeInfoObject()
1392		infoObject.postscriptWeightName = 123
1393		writer = UFOWriter(self.dstDir, formatVersion=2)
1394		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1395		# postscriptDefaultCharacter
1396		infoObject = self.makeInfoObject()
1397		infoObject.postscriptDefaultCharacter = 123
1398		writer = UFOWriter(self.dstDir, formatVersion=2)
1399		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1400		# postscriptWindowsCharacterSet
1401		infoObject = self.makeInfoObject()
1402		infoObject.postscriptWindowsCharacterSet = -1
1403		writer = UFOWriter(self.dstDir, formatVersion=2)
1404		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1405		# macintoshFONDFamilyID
1406		infoObject = self.makeInfoObject()
1407		infoObject.macintoshFONDFamilyID = "abc"
1408		writer = UFOWriter(self.dstDir, formatVersion=2)
1409		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1410		# macintoshFONDName
1411		infoObject = self.makeInfoObject()
1412		infoObject.macintoshFONDName = 123
1413		writer = UFOWriter(self.dstDir, formatVersion=2)
1414		self.assertRaises(UFOLibError, writer.writeInfo, info=infoObject)
1415