Changeset 1102
- Timestamp:
- 12/11/06 05:42:42 (2 years ago)
- Files:
-
- gaphas/trunk/gaphas/util.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphas/trunk/gaphas/util.py
r1090 r1102 34 34 text_align(cr, x, y, text, align_x=0, align_y=0) 35 35 36 36 37 def text_align(cr, x, y, text, align_x=0, align_y=0, padding_x=0, padding_y=0): 37 38 """ … … 64 65 cr.show_text(text) 65 66 67 66 68 def text_multiline(cr, x, y, text, padding=1): 67 69 """ … … 76 78 #cr.move_to(x, y) 77 79 for line in text.split('\n'): 78 x_bear, y_bear, w, h, x_adv, y_adv = cr.text_extents(text) 80 print 'line', line 81 x_bear, y_bear, w, h, x_adv, y_adv = cr.text_extents(line) 79 82 cr.move_to(x, y) 80 83 cr.show_text(line) 84 cr.stroke() 81 85 y += h + padding 82 86 87 83 88 def text_set_font(cr, font): 84 """Set the font from a string. E.g. 'sans 10' or 'sans italic bold 12' 89 """ 90 Set the font from a string. E.g. 'sans 10' or 'sans italic bold 12' 85 91 only restriction is that the font name should be the first option and 86 92 the font size as last argument … … 96 102 97 103 def path_ellipse (cr, x, y, width, height, angle=0): 98 """Draw an ellipse. 104 """ 105 Draw an ellipse. 99 106 x - center x 100 107 y - center y
