Пример #1
0
 def toWires(self):
     '''toWires(self): Creates a collection of Part.Wires outlining the text
     string. Returns a list where each entry corresponds to 1 character.  
     Each list entry is a list of Wires describing 1 of the character's
     Contours'''
     PenPos = 0                            # offset along baseline
     KChar = chr(0)                        # kerning. missing glyph convention
     Chars = []
     for char in self.String:
         # get unpacked and segmented contour outlines and positioning metrics
         # for this char
         CharCons,Adv,Kern = FontUtils.getTTFCharContours(
                                                    self.FTFont, 
                                                    char, 
                                                    KChar)
         PenPos += Kern.x * self.Scale[0]        # only horiz strings for now
         CharWires = self._makeCharWires(CharCons, PenPos)
         if CharWires:
             Chars.append(CharWires)
         PenPos += (Adv * self.Scale[0]) + self.Tracking
         KChar = char
     return(Chars)