parameters: (canvas, s, x, y, font=None, color=None, angle=0)
docstring: Draw a formatted string starting at location x,y in canvas.
docstring_summary: Draw a formatted string starting at location x,y in canvas.
docstring_tokens: Draw a formatted string starting at location x y in canvas .
function: def drawString(canvas, s, x, y, font=None, color=None, angle=0):
    "Draw a formatted string starting at location x,y in canvas."
    sformatter = StringFormatter()
  
    segmentlist = sformatter.parseSegments(s)
  
    # to calculate a new font the segments must be given an actual font
    if not font:
      font = canvas.defaultFont
  
    # have each formatted string segment specify its own font
    startpos = x
    for seg in segmentlist:
      # calculate x and y for this segment based on the angle
      # if the string wasn't at an angle then
      # (draw_x,draw_y) = (startpos, seg.calcNewY(font, y)) want to
      # rotate around original x and y
      (delta_x, delta_y) = rotateXY(startpos - x, seg.calcNewY(font, y) - y, angle)
  
      canvas.drawString(seg.s, x + delta_x, y + delta_y, seg.calcNewFont(font), color, angle)
  
      # new x start position, startpos is calculated assuming no angle
      startpos = startpos + canvas.stringWidth(seg.s, seg.calcNewFont(font))
function_tokens: def drawString ( canvas , s , x , y , font = None , color = None , angle = 0 ) : sformatter = StringFormatter ( ) segmentlist = sformatter . parseSegments ( s ) # to calculate a new font the segments must be given an actual font if not font : font = canvas . defaultFont # have each formatted string segment specify its own font startpos = x for seg in segmentlist : # calculate x and y for this segment based on the angle # if the string wasn't at an angle then # (draw_x,draw_y) = (startpos, seg.calcNewY(font, y)) want to # rotate around original x and y ( delta_x , delta_y ) = rotateXY ( startpos - x , seg . calcNewY ( font , y ) - y , angle ) canvas . drawString ( seg . s , x + delta_x , y + delta_y , seg . calcNewFont ( font ) , color , angle ) # new x start position, startpos is calculated assuming no angle startpos = startpos + canvas . stringWidth ( seg . s , seg . calcNewFont ( font ) )