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