• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Miscellaneous helpers for our test suite."""
2
3from __future__ import absolute_import, unicode_literals
4import os
5from fontTools.ufoLib.utils import numberTypes
6
7try:
8	basestring
9except NameError:
10	basestring = str
11
12def getDemoFontPath():
13	"""Return the path to Data/DemoFont.ufo/."""
14	testdata = os.path.join(os.path.dirname(__file__), "testdata")
15	return os.path.join(testdata, "DemoFont.ufo")
16
17
18def getDemoFontGlyphSetPath():
19	"""Return the path to Data/DemoFont.ufo/glyphs/."""
20	return os.path.join(getDemoFontPath(), "glyphs")
21
22
23# GLIF test tools
24
25class Glyph(object):
26
27	def __init__(self):
28		self.name = None
29		self.width = None
30		self.height = None
31		self.unicodes = None
32		self.note = None
33		self.lib = None
34		self.image = None
35		self.guidelines = None
36		self.anchors = None
37		self.outline = []
38
39	def _writePointPenCommand(self, command, args, kwargs):
40		args = _listToString(args)
41		kwargs = _dictToString(kwargs)
42		if args and kwargs:
43			return "pointPen.%s(*%s, **%s)" % (command, args, kwargs)
44		elif len(args):
45			return "pointPen.%s(*%s)" % (command, args)
46		elif len(kwargs):
47			return "pointPen.%s(**%s)" % (command, kwargs)
48		else:
49			return "pointPen.%s()" % command
50
51	def beginPath(self, **kwargs):
52		self.outline.append(self._writePointPenCommand("beginPath", [], kwargs))
53
54	def endPath(self):
55		self.outline.append(self._writePointPenCommand("endPath", [], {}))
56
57	def addPoint(self, *args, **kwargs):
58		self.outline.append(self._writePointPenCommand("addPoint", args, kwargs))
59
60	def addComponent(self, *args, **kwargs):
61		self.outline.append(self._writePointPenCommand("addComponent", args, kwargs))
62
63	def drawPoints(self, pointPen):
64		if self.outline:
65			py = "\n".join(self.outline)
66			exec(py, {"pointPen" : pointPen})
67
68	def py(self):
69		text = []
70		if self.name is not None:
71			text.append("glyph.name = \"%s\"" % self.name)
72		if self.width:
73			text.append("glyph.width = %r" % self.width)
74		if self.height:
75			text.append("glyph.height = %r" % self.height)
76		if self.unicodes is not None:
77			text.append("glyph.unicodes = [%s]" % ", ".join([str(i) for i in self.unicodes]))
78		if self.note is not None:
79			text.append("glyph.note = \"%s\"" % self.note)
80		if self.lib is not None:
81			text.append("glyph.lib = %s" % _dictToString(self.lib))
82		if self.image is not None:
83			text.append("glyph.image = %s" % _dictToString(self.image))
84		if self.guidelines is not None:
85			text.append("glyph.guidelines = %s" % _listToString(self.guidelines))
86		if self.anchors is not None:
87			text.append("glyph.anchors = %s" % _listToString(self.anchors))
88		if self.outline:
89			text += self.outline
90		return "\n".join(text)
91
92def _dictToString(d):
93	text = []
94	for key, value in sorted(d.items()):
95		if value is None:
96			continue
97		key = "\"%s\"" % key
98		if isinstance(value, dict):
99			value = _dictToString(value)
100		elif isinstance(value, list):
101			value = _listToString(value)
102		elif isinstance(value, tuple):
103			value = _tupleToString(value)
104		elif isinstance(value, numberTypes):
105			value = repr(value)
106		elif isinstance(value, basestring):
107			value = "\"%s\"" % value
108		text.append("%s : %s" % (key, value))
109	if not text:
110		return ""
111	return "{%s}" % ", ".join(text)
112
113def _listToString(l):
114	text = []
115	for value in l:
116		if isinstance(value, dict):
117			value = _dictToString(value)
118		elif isinstance(value, list):
119			value = _listToString(value)
120		elif isinstance(value, tuple):
121			value = _tupleToString(value)
122		elif isinstance(value, numberTypes):
123			value = repr(value)
124		elif isinstance(value, basestring):
125			value = "\"%s\"" % value
126		text.append(value)
127	if not text:
128		return ""
129	return "[%s]" % ", ".join(text)
130
131def _tupleToString(t):
132	text = []
133	for value in t:
134		if isinstance(value, dict):
135			value = _dictToString(value)
136		elif isinstance(value, list):
137			value = _listToString(value)
138		elif isinstance(value, tuple):
139			value = _tupleToString(value)
140		elif isinstance(value, numberTypes):
141			value = repr(value)
142		elif isinstance(value, basestring):
143			value = "\"%s\"" % value
144		text.append(value)
145	if not text:
146		return ""
147	return "(%s)" % ", ".join(text)
148
149def stripText(text):
150	new = []
151	for line in text.strip().splitlines():
152		line = line.strip()
153		if not line:
154			continue
155		new.append(line)
156	return "\n".join(new)
157
158# font info values used by several tests
159
160fontInfoVersion1 = {
161	"familyName"   : "Some Font (Family Name)",
162	"styleName"	   : "Regular (Style Name)",
163	"fullName"	   : "Some Font-Regular (Postscript Full Name)",
164	"fontName"	   : "SomeFont-Regular (Postscript Font Name)",
165	"menuName"	   : "Some Font Regular (Style Map Family Name)",
166	"fontStyle"	   : 64,
167	"note"		   : "A note.",
168	"versionMajor" : 1,
169	"versionMinor" : 0,
170	"year"		   : 2008,
171	"copyright"	   : "Copyright Some Foundry.",
172	"notice"	   : "Some Font by Some Designer for Some Foundry.",
173	"trademark"	   : "Trademark Some Foundry",
174	"license"	   : "License info for Some Foundry.",
175	"licenseURL"   : "http://somefoundry.com/license",
176	"createdBy"	   : "Some Foundry",
177	"designer"	   : "Some Designer",
178	"designerURL"  : "http://somedesigner.com",
179	"vendorURL"	   : "http://somefoundry.com",
180	"unitsPerEm"   : 1000,
181	"ascender"	   : 750,
182	"descender"	   : -250,
183	"capHeight"	   : 750,
184	"xHeight"	   : 500,
185	"defaultWidth" : 400,
186	"slantAngle"   : -12.5,
187	"italicAngle"  : -12.5,
188	"widthName"	   : "Medium (normal)",
189	"weightName"   : "Medium",
190	"weightValue"  : 500,
191	"fondName"	   : "SomeFont Regular (FOND Name)",
192	"otFamilyName" : "Some Font (Preferred Family Name)",
193	"otStyleName"  : "Regular (Preferred Subfamily Name)",
194	"otMacName"	   : "Some Font Regular (Compatible Full Name)",
195	"msCharSet"	   : 0,
196	"fondID"	   : 15000,
197	"uniqueID"	   : 4000000,
198	"ttVendor"	   : "SOME",
199	"ttUniqueID"   : "OpenType name Table Unique ID",
200	"ttVersion"	   : "OpenType name Table Version",
201}
202
203fontInfoVersion2 = {
204	"familyName"						 : "Some Font (Family Name)",
205	"styleName"							 : "Regular (Style Name)",
206	"styleMapFamilyName"				 : "Some Font Regular (Style Map Family Name)",
207	"styleMapStyleName"					 : "regular",
208	"versionMajor"						 : 1,
209	"versionMinor"						 : 0,
210	"year"								 : 2008,
211	"copyright"							 : "Copyright Some Foundry.",
212	"trademark"							 : "Trademark Some Foundry",
213	"unitsPerEm"						 : 1000,
214	"descender"							 : -250,
215	"xHeight"							 : 500,
216	"capHeight"							 : 750,
217	"ascender"							 : 750,
218	"italicAngle"						 : -12.5,
219	"note"								 : "A note.",
220	"openTypeHeadCreated"				 : "2000/01/01 00:00:00",
221	"openTypeHeadLowestRecPPEM"			 : 10,
222	"openTypeHeadFlags"					 : [0, 1],
223	"openTypeHheaAscender"				 : 750,
224	"openTypeHheaDescender"				 : -250,
225	"openTypeHheaLineGap"				 : 200,
226	"openTypeHheaCaretSlopeRise"		 : 1,
227	"openTypeHheaCaretSlopeRun"			 : 0,
228	"openTypeHheaCaretOffset"			 : 0,
229	"openTypeNameDesigner"				 : "Some Designer",
230	"openTypeNameDesignerURL"			 : "http://somedesigner.com",
231	"openTypeNameManufacturer"			 : "Some Foundry",
232	"openTypeNameManufacturerURL"		 : "http://somefoundry.com",
233	"openTypeNameLicense"				 : "License info for Some Foundry.",
234	"openTypeNameLicenseURL"			 : "http://somefoundry.com/license",
235	"openTypeNameVersion"				 : "OpenType name Table Version",
236	"openTypeNameUniqueID"				 : "OpenType name Table Unique ID",
237	"openTypeNameDescription"			 : "Some Font by Some Designer for Some Foundry.",
238	"openTypeNamePreferredFamilyName"	 : "Some Font (Preferred Family Name)",
239	"openTypeNamePreferredSubfamilyName" : "Regular (Preferred Subfamily Name)",
240	"openTypeNameCompatibleFullName"	 : "Some Font Regular (Compatible Full Name)",
241	"openTypeNameSampleText"			 : "Sample Text for Some Font.",
242	"openTypeNameWWSFamilyName"			 : "Some Font (WWS Family Name)",
243	"openTypeNameWWSSubfamilyName"		 : "Regular (WWS Subfamily Name)",
244	"openTypeOS2WidthClass"				 : 5,
245	"openTypeOS2WeightClass"			 : 500,
246	"openTypeOS2Selection"				 : [3],
247	"openTypeOS2VendorID"				 : "SOME",
248	"openTypeOS2Panose"					 : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
249	"openTypeOS2FamilyClass"			 : [1, 1],
250	"openTypeOS2UnicodeRanges"			 : [0, 1],
251	"openTypeOS2CodePageRanges"			 : [0, 1],
252	"openTypeOS2TypoAscender"			 : 750,
253	"openTypeOS2TypoDescender"			 : -250,
254	"openTypeOS2TypoLineGap"			 : 200,
255	"openTypeOS2WinAscent"				 : 750,
256	"openTypeOS2WinDescent"				 : 250,
257	"openTypeOS2Type"					 : [],
258	"openTypeOS2SubscriptXSize"			 : 200,
259	"openTypeOS2SubscriptYSize"			 : 400,
260	"openTypeOS2SubscriptXOffset"		 : 0,
261	"openTypeOS2SubscriptYOffset"		 : -100,
262	"openTypeOS2SuperscriptXSize"		 : 200,
263	"openTypeOS2SuperscriptYSize"		 : 400,
264	"openTypeOS2SuperscriptXOffset"		 : 0,
265	"openTypeOS2SuperscriptYOffset"		 : 200,
266	"openTypeOS2StrikeoutSize"			 : 20,
267	"openTypeOS2StrikeoutPosition"		 : 300,
268	"openTypeVheaVertTypoAscender"		 : 750,
269	"openTypeVheaVertTypoDescender"		 : -250,
270	"openTypeVheaVertTypoLineGap"		 : 200,
271	"openTypeVheaCaretSlopeRise"		 : 0,
272	"openTypeVheaCaretSlopeRun"			 : 1,
273	"openTypeVheaCaretOffset"			 : 0,
274	"postscriptFontName"				 : "SomeFont-Regular (Postscript Font Name)",
275	"postscriptFullName"				 : "Some Font-Regular (Postscript Full Name)",
276	"postscriptSlantAngle"				 : -12.5,
277	"postscriptUniqueID"				 : 4000000,
278	"postscriptUnderlineThickness"		 : 20,
279	"postscriptUnderlinePosition"		 : -200,
280	"postscriptIsFixedPitch"			 : False,
281	"postscriptBlueValues"				 : [500, 510],
282	"postscriptOtherBlues"				 : [-250, -260],
283	"postscriptFamilyBlues"				 : [500, 510],
284	"postscriptFamilyOtherBlues"		 : [-250, -260],
285	"postscriptStemSnapH"				 : [100, 120],
286	"postscriptStemSnapV"				 : [80, 90],
287	"postscriptBlueFuzz"				 : 1,
288	"postscriptBlueShift"				 : 7,
289	"postscriptBlueScale"				 : 0.039625,
290	"postscriptForceBold"				 : True,
291	"postscriptDefaultWidthX"			 : 400,
292	"postscriptNominalWidthX"			 : 400,
293	"postscriptWeightName"				 : "Medium",
294	"postscriptDefaultCharacter"		 : ".notdef",
295	"postscriptWindowsCharacterSet"		 : 1,
296	"macintoshFONDFamilyID"				 : 15000,
297	"macintoshFONDName"					 : "SomeFont Regular (FOND Name)",
298}
299
300fontInfoVersion3 = {
301	"familyName"						 : "Some Font (Family Name)",
302	"styleName"							 : "Regular (Style Name)",
303	"styleMapFamilyName"				 : "Some Font Regular (Style Map Family Name)",
304	"styleMapStyleName"					 : "regular",
305	"versionMajor"						 : 1,
306	"versionMinor"						 : 0,
307	"year"								 : 2008,
308	"copyright"							 : "Copyright Some Foundry.",
309	"trademark"							 : "Trademark Some Foundry",
310	"unitsPerEm"						 : 1000,
311	"descender"							 : -250,
312	"xHeight"							 : 500,
313	"capHeight"							 : 750,
314	"ascender"							 : 750,
315	"italicAngle"						 : -12.5,
316	"note"								 : "A note.",
317	"openTypeGaspRangeRecords"			 : [
318		dict(rangeMaxPPEM=10, rangeGaspBehavior=[0]),
319		dict(rangeMaxPPEM=20, rangeGaspBehavior=[1]),
320		dict(rangeMaxPPEM=30, rangeGaspBehavior=[2]),
321		dict(rangeMaxPPEM=40, rangeGaspBehavior=[3]),
322		dict(rangeMaxPPEM=50, rangeGaspBehavior=[0, 1, 2, 3]),
323		dict(rangeMaxPPEM=0xFFFF, rangeGaspBehavior=[0])
324	],
325	"openTypeHeadCreated"				 : "2000/01/01 00:00:00",
326	"openTypeHeadLowestRecPPEM"			 : 10,
327	"openTypeHeadFlags"					 : [0, 1],
328	"openTypeHheaAscender"				 : 750,
329	"openTypeHheaDescender"				 : -250,
330	"openTypeHheaLineGap"				 : 200,
331	"openTypeHheaCaretSlopeRise"		 : 1,
332	"openTypeHheaCaretSlopeRun"			 : 0,
333	"openTypeHheaCaretOffset"			 : 0,
334	"openTypeNameDesigner"				 : "Some Designer",
335	"openTypeNameDesignerURL"			 : "http://somedesigner.com",
336	"openTypeNameManufacturer"			 : "Some Foundry",
337	"openTypeNameManufacturerURL"		 : "http://somefoundry.com",
338	"openTypeNameLicense"				 : "License info for Some Foundry.",
339	"openTypeNameLicenseURL"			 : "http://somefoundry.com/license",
340	"openTypeNameVersion"				 : "OpenType name Table Version",
341	"openTypeNameUniqueID"				 : "OpenType name Table Unique ID",
342	"openTypeNameDescription"			 : "Some Font by Some Designer for Some Foundry.",
343	"openTypeNamePreferredFamilyName"	 : "Some Font (Preferred Family Name)",
344	"openTypeNamePreferredSubfamilyName" : "Regular (Preferred Subfamily Name)",
345	"openTypeNameCompatibleFullName"	 : "Some Font Regular (Compatible Full Name)",
346	"openTypeNameSampleText"			 : "Sample Text for Some Font.",
347	"openTypeNameWWSFamilyName"			 : "Some Font (WWS Family Name)",
348	"openTypeNameWWSSubfamilyName"		 : "Regular (WWS Subfamily Name)",
349	"openTypeNameRecords"				 : [
350		dict(nameID=1, platformID=1, encodingID=1, languageID=1, string="Name Record."),
351		dict(nameID=2, platformID=1, encodingID=1, languageID=1, string="Name Record.")
352	],
353	"openTypeOS2WidthClass"				 : 5,
354	"openTypeOS2WeightClass"			 : 500,
355	"openTypeOS2Selection"				 : [3],
356	"openTypeOS2VendorID"				 : "SOME",
357	"openTypeOS2Panose"					 : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
358	"openTypeOS2FamilyClass"			 : [1, 1],
359	"openTypeOS2UnicodeRanges"			 : [0, 1],
360	"openTypeOS2CodePageRanges"			 : [0, 1],
361	"openTypeOS2TypoAscender"			 : 750,
362	"openTypeOS2TypoDescender"			 : -250,
363	"openTypeOS2TypoLineGap"			 : 200,
364	"openTypeOS2WinAscent"				 : 750,
365	"openTypeOS2WinDescent"				 : 250,
366	"openTypeOS2Type"					 : [],
367	"openTypeOS2SubscriptXSize"			 : 200,
368	"openTypeOS2SubscriptYSize"			 : 400,
369	"openTypeOS2SubscriptXOffset"		 : 0,
370	"openTypeOS2SubscriptYOffset"		 : -100,
371	"openTypeOS2SuperscriptXSize"		 : 200,
372	"openTypeOS2SuperscriptYSize"		 : 400,
373	"openTypeOS2SuperscriptXOffset"		 : 0,
374	"openTypeOS2SuperscriptYOffset"		 : 200,
375	"openTypeOS2StrikeoutSize"			 : 20,
376	"openTypeOS2StrikeoutPosition"		 : 300,
377	"openTypeVheaVertTypoAscender"		 : 750,
378	"openTypeVheaVertTypoDescender"		 : -250,
379	"openTypeVheaVertTypoLineGap"		 : 200,
380	"openTypeVheaCaretSlopeRise"		 : 0,
381	"openTypeVheaCaretSlopeRun"			 : 1,
382	"openTypeVheaCaretOffset"			 : 0,
383	"postscriptFontName"				 : "SomeFont-Regular (Postscript Font Name)",
384	"postscriptFullName"				 : "Some Font-Regular (Postscript Full Name)",
385	"postscriptSlantAngle"				 : -12.5,
386	"postscriptUniqueID"				 : 4000000,
387	"postscriptUnderlineThickness"		 : 20,
388	"postscriptUnderlinePosition"		 : -200,
389	"postscriptIsFixedPitch"			 : False,
390	"postscriptBlueValues"				 : [500, 510],
391	"postscriptOtherBlues"				 : [-250, -260],
392	"postscriptFamilyBlues"				 : [500, 510],
393	"postscriptFamilyOtherBlues"		 : [-250, -260],
394	"postscriptStemSnapH"				 : [100, 120],
395	"postscriptStemSnapV"				 : [80, 90],
396	"postscriptBlueFuzz"				 : 1,
397	"postscriptBlueShift"				 : 7,
398	"postscriptBlueScale"				 : 0.039625,
399	"postscriptForceBold"				 : True,
400	"postscriptDefaultWidthX"			 : 400,
401	"postscriptNominalWidthX"			 : 400,
402	"postscriptWeightName"				 : "Medium",
403	"postscriptDefaultCharacter"		 : ".notdef",
404	"postscriptWindowsCharacterSet"		 : 1,
405	"macintoshFONDFamilyID"				 : 15000,
406	"macintoshFONDName"					 : "SomeFont Regular (FOND Name)",
407	"woffMajorVersion"					 : 1,
408	"woffMinorVersion"					 : 0,
409	"woffMetadataUniqueID"				 : dict(id="string"),
410	"woffMetadataVendor"				 : dict(name="Some Foundry", url="http://somefoundry.com"),
411	"woffMetadataCredits"				 : dict(
412												credits=[
413													dict(name="Some Designer"),
414													dict(name=""),
415													dict(name="Some Designer", url="http://somedesigner.com"),
416													dict(name="Some Designer", url=""),
417													dict(name="Some Designer", role="Designer"),
418													dict(name="Some Designer", role=""),
419													dict(name="Some Designer", dir="ltr"),
420													dict(name="rengiseD emoS", dir="rtl"),
421													{"name" : "Some Designer", "class" : "hello"},
422													{"name" : "Some Designer", "class" : ""},
423												]
424											),
425	"woffMetadataDescription"			 : dict(
426												url="http://somefoundry.com/foo/description",
427												text=[
428													dict(text="foo"),
429													dict(text=""),
430													dict(text="foo", language="bar"),
431													dict(text="foo", language=""),
432													dict(text="foo", dir="ltr"),
433													dict(text="foo", dir="rtl"),
434													{"text" : "foo", "class" : "foo"},
435													{"text" : "foo", "class" : ""},
436												]
437											),
438	"woffMetadataLicense"				 : dict(
439												url="http://somefoundry.com/foo/license",
440												id="foo",
441												text=[
442													dict(text="foo"),
443													dict(text=""),
444													dict(text="foo", language="bar"),
445													dict(text="foo", language=""),
446													dict(text="foo", dir="ltr"),
447													dict(text="foo", dir="rtl"),
448													{"text" : "foo", "class" : "foo"},
449													{"text" : "foo", "class" : ""},
450												]
451											),
452	"woffMetadataCopyright"				 : dict(
453												text=[
454													dict(text="foo"),
455													dict(text=""),
456													dict(text="foo", language="bar"),
457													dict(text="foo", language=""),
458													dict(text="foo", dir="ltr"),
459													dict(text="foo", dir="rtl"),
460													{"text" : "foo", "class" : "foo"},
461													{"text" : "foo", "class" : ""},
462												]
463											),
464	"woffMetadataTrademark"				 : dict(
465												text=[
466													dict(text="foo"),
467													dict(text=""),
468													dict(text="foo", language="bar"),
469													dict(text="foo", language=""),
470													dict(text="foo", dir="ltr"),
471													dict(text="foo", dir="rtl"),
472													{"text" : "foo", "class" : "foo"},
473													{"text" : "foo", "class" : ""},
474												]
475											),
476	"woffMetadataLicensee"				 : dict(
477												name="Some Licensee"
478											),
479	"woffMetadataExtensions"			 : [
480												dict(
481													# everything
482													names=[
483														dict(text="foo"),
484														dict(text=""),
485														dict(text="foo", language="bar"),
486														dict(text="foo", language=""),
487														dict(text="foo", dir="ltr"),
488														dict(text="foo", dir="rtl"),
489														{"text" : "foo", "class" : "hello"},
490														{"text" : "foo", "class" : ""},
491													],
492													items=[
493														# everything
494														dict(
495															id="foo",
496															names=[
497																dict(text="foo"),
498																dict(text=""),
499																dict(text="foo", language="bar"),
500																dict(text="foo", language=""),
501																dict(text="foo", dir="ltr"),
502																dict(text="foo", dir="rtl"),
503																{"text" : "foo", "class" : "hello"},
504																{"text" : "foo", "class" : ""},
505															],
506															values=[
507																dict(text="foo"),
508																dict(text=""),
509																dict(text="foo", language="bar"),
510																dict(text="foo", language=""),
511																dict(text="foo", dir="ltr"),
512																dict(text="foo", dir="rtl"),
513																{"text" : "foo", "class" : "hello"},
514																{"text" : "foo", "class" : ""},
515															]
516														),
517														# no id
518														dict(
519															names=[
520																dict(text="foo")
521															],
522															values=[
523																dict(text="foo")
524															]
525														)
526													]
527												),
528												# no names
529												dict(
530													items=[
531														dict(
532															id="foo",
533															names=[
534																dict(text="foo")
535															],
536															values=[
537																dict(text="foo")
538															]
539														)
540													]
541												),
542											],
543	"guidelines"						 : [
544											# ints
545											dict(x=100, y=200, angle=45),
546											# floats
547											dict(x=100.5, y=200.5, angle=45.5),
548											# edges
549											dict(x=0, y=0, angle=0),
550											dict(x=0, y=0, angle=360),
551											dict(x=0, y=0, angle=360.0),
552											# no y
553											dict(x=100),
554											# no x
555											dict(y=200),
556											# name
557											dict(x=100, y=200, angle=45, name="foo"),
558											dict(x=100, y=200, angle=45, name=""),
559											# identifier
560											dict(x=100, y=200, angle=45, identifier="guide1"),
561											dict(x=100, y=200, angle=45, identifier="guide2"),
562											dict(x=100, y=200, angle=45, identifier="\x20"),
563											dict(x=100, y=200, angle=45, identifier="\x7E"),
564											# colors
565											dict(x=100, y=200, angle=45, color="0,0,0,0"),
566											dict(x=100, y=200, angle=45, color="1,0,0,0"),
567											dict(x=100, y=200, angle=45, color="1,1,1,1"),
568											dict(x=100, y=200, angle=45, color="0,1,0,0"),
569											dict(x=100, y=200, angle=45, color="0,0,1,0"),
570											dict(x=100, y=200, angle=45, color="0,0,0,1"),
571											dict(x=100, y=200, angle=45, color="1, 0, 0, 0"),
572											dict(x=100, y=200, angle=45, color="0, 1, 0, 0"),
573											dict(x=100, y=200, angle=45, color="0, 0, 1, 0"),
574											dict(x=100, y=200, angle=45, color="0, 0, 0, 1"),
575											dict(x=100, y=200, angle=45, color=".5,0,0,0"),
576											dict(x=100, y=200, angle=45, color="0,.5,0,0"),
577											dict(x=100, y=200, angle=45, color="0,0,.5,0"),
578											dict(x=100, y=200, angle=45, color="0,0,0,.5"),
579											dict(x=100, y=200, angle=45, color=".5,1,1,1"),
580											dict(x=100, y=200, angle=45, color="1,.5,1,1"),
581											dict(x=100, y=200, angle=45, color="1,1,.5,1"),
582											dict(x=100, y=200, angle=45, color="1,1,1,.5"),
583										],
584}
585
586expectedFontInfo1To2Conversion = {
587	"familyName"						: "Some Font (Family Name)",
588	"styleMapFamilyName"				: "Some Font Regular (Style Map Family Name)",
589	"styleMapStyleName"					: "regular",
590	"styleName"							: "Regular (Style Name)",
591	"unitsPerEm"						: 1000,
592	"ascender"							: 750,
593	"capHeight"							: 750,
594	"xHeight"							: 500,
595	"descender"							: -250,
596	"italicAngle"						: -12.5,
597	"versionMajor"						: 1,
598	"versionMinor"						: 0,
599	"year"								: 2008,
600	"copyright"							: "Copyright Some Foundry.",
601	"trademark"							: "Trademark Some Foundry",
602	"note"								: "A note.",
603	"macintoshFONDFamilyID"				: 15000,
604	"macintoshFONDName"					: "SomeFont Regular (FOND Name)",
605	"openTypeNameCompatibleFullName"	: "Some Font Regular (Compatible Full Name)",
606	"openTypeNameDescription"			: "Some Font by Some Designer for Some Foundry.",
607	"openTypeNameDesigner"				: "Some Designer",
608	"openTypeNameDesignerURL"			: "http://somedesigner.com",
609	"openTypeNameLicense"				: "License info for Some Foundry.",
610	"openTypeNameLicenseURL"			: "http://somefoundry.com/license",
611	"openTypeNameManufacturer"			: "Some Foundry",
612	"openTypeNameManufacturerURL"		: "http://somefoundry.com",
613	"openTypeNamePreferredFamilyName"	: "Some Font (Preferred Family Name)",
614	"openTypeNamePreferredSubfamilyName": "Regular (Preferred Subfamily Name)",
615	"openTypeNameCompatibleFullName"	: "Some Font Regular (Compatible Full Name)",
616	"openTypeNameUniqueID"				: "OpenType name Table Unique ID",
617	"openTypeNameVersion"				: "OpenType name Table Version",
618	"openTypeOS2VendorID"				: "SOME",
619	"openTypeOS2WeightClass"			: 500,
620	"openTypeOS2WidthClass"				: 5,
621	"postscriptDefaultWidthX"			: 400,
622	"postscriptFontName"				: "SomeFont-Regular (Postscript Font Name)",
623	"postscriptFullName"				: "Some Font-Regular (Postscript Full Name)",
624	"postscriptSlantAngle"				: -12.5,
625	"postscriptUniqueID"				: 4000000,
626	"postscriptWeightName"				: "Medium",
627	"postscriptWindowsCharacterSet"		: 1
628}
629
630expectedFontInfo2To1Conversion = {
631	"familyName"  	: "Some Font (Family Name)",
632	"menuName"	  	: "Some Font Regular (Style Map Family Name)",
633	"fontStyle"	  	: 64,
634	"styleName"	  	: "Regular (Style Name)",
635	"unitsPerEm"  	: 1000,
636	"ascender"	  	: 750,
637	"capHeight"	  	: 750,
638	"xHeight"	  	: 500,
639	"descender"	  	: -250,
640	"italicAngle" 	: -12.5,
641	"versionMajor"	: 1,
642	"versionMinor"	: 0,
643	"copyright"	  	: "Copyright Some Foundry.",
644	"trademark"	  	: "Trademark Some Foundry",
645	"note"		  	: "A note.",
646	"fondID"	  	: 15000,
647	"fondName"	  	: "SomeFont Regular (FOND Name)",
648	"fullName"	  	: "Some Font Regular (Compatible Full Name)",
649	"notice"	  	: "Some Font by Some Designer for Some Foundry.",
650	"designer"	  	: "Some Designer",
651	"designerURL" 	: "http://somedesigner.com",
652	"license"	  	: "License info for Some Foundry.",
653	"licenseURL"  	: "http://somefoundry.com/license",
654	"createdBy"	  	: "Some Foundry",
655	"vendorURL"	  	: "http://somefoundry.com",
656	"otFamilyName"	: "Some Font (Preferred Family Name)",
657	"otStyleName" 	: "Regular (Preferred Subfamily Name)",
658	"otMacName"	  	: "Some Font Regular (Compatible Full Name)",
659	"ttUniqueID"  	: "OpenType name Table Unique ID",
660	"ttVersion"	  	: "OpenType name Table Version",
661	"ttVendor"	  	: "SOME",
662	"weightValue" 	: 500,
663	"widthName"	  	: "Medium (normal)",
664	"defaultWidth"	: 400,
665	"fontName"	  	: "SomeFont-Regular (Postscript Font Name)",
666	"fullName"	  	: "Some Font-Regular (Postscript Full Name)",
667	"slantAngle"  	: -12.5,
668	"uniqueID"	  	: 4000000,
669	"weightName"  	: "Medium",
670	"msCharSet"	  	: 0,
671	"year"			: 2008
672}
673