Changeset 340
- Timestamp:
- 09/29/11 19:38:33 (20 months ago)
- File:
-
- 1 edited
-
branches/ufo3k/Lib/ufoLib/glifLib.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ufo3k/Lib/ufoLib/glifLib.py
r339 r340 490 490 if width is not None: 491 491 if not isinstance(width, (int, float)): 492 raise GlifLibError , "width attribute must be int or float"492 raise GlifLibError("width attribute must be int or float") 493 493 height = getattr(glyphObject, "height", None) 494 494 if height is not None: 495 495 if not isinstance(height, (int, float)): 496 raise GlifLibError , "height attribute must be int or float"496 raise GlifLibError("height attribute must be int or float") 497 497 if width is not None and height is not None: 498 498 writer.simpletag("advance", width=str(width), height=str(height)) … … 511 511 for code in unicodes: 512 512 if not isinstance(code, int): 513 raise GlifLibError , "unicode values must be int"513 raise GlifLibError("unicode values must be int") 514 514 hexCode = hex(code)[2:].upper() 515 515 if len(hexCode) < 4: … … 521 521 if note is not None: 522 522 if not isinstance(note, (str, unicode)): 523 raise GlifLibError , "note attribute must be str or unicode"524 note = note.encode( 'utf-8')523 raise GlifLibError("note attribute must be str or unicode") 524 note = note.encode("utf-8") 525 525 writer.begintag("note") 526 526 writer.newline() … … 530 530 writer.endtag("note") 531 531 writer.newline() 532 533 image = getattr(glyphObject, "image", None) 534 if image is not None: 535 if not imageValidator(image): 536 raise GlifLibError("image attribute must be a dict or dict-like object with the proper structure.") 537 attrs = [ 538 ("filename", image["filename"]) 539 ] 540 for attr, default in _transformationInfo.items(): 541 value = image.get(attr) 542 attrs.append((attr, str(value))) 543 color = image.get("color") 544 if color is not None: 545 attrs.append(("color", color)) 546 self.writer.simpletag("image", attrs) 547 self.writer.newline() 532 548 533 549 if drawPointsFunc is not None:
Note: See TracChangeset
for help on using the changeset viewer.
