1import defcon 2from fontParts.base import BaseComponent 3from fontParts.fontshell.base import RBaseObject 4 5 6class RComponent(RBaseObject, BaseComponent): 7 8 wrapClass = defcon.Component 9 10 # ---------- 11 # Attributes 12 # ---------- 13 14 # baseGlyph 15 16 def _get_baseGlyph(self): 17 return self.naked().baseGlyph 18 19 def _set_baseGlyph(self, value): 20 self.naked().baseGlyph = value 21 22 # transformation 23 24 def _get_transformation(self): 25 return self.naked().transformation 26 27 def _set_transformation(self, value): 28 self.naked().transformation = value 29 30 # -------------- 31 # Identification 32 # -------------- 33 34 # index 35 36 def _set_index(self, value): 37 component = self.naked() 38 glyph = component.glyph 39 if value > glyph.components.index(component): 40 value -= 1 41 glyph.removeComponent(component) 42 glyph.insertComponent(value, component) 43 44 # identifier 45 46 def _get_identifier(self): 47 component = self.naked() 48 return component.identifier 49 50 def _getIdentifier(self): 51 component = self.naked() 52 return component.generateIdentifier() 53 54 def _setIdentifier(self, value): 55 self.naked().identifier = value 56 57 # ------------- 58 # Normalization 59 # ------------- 60 61 def _decompose(self): 62 component = self.naked() 63 glyph = component.glyph 64 glyph.decomposeComponent(component) 65