InsertSpan inserts a new span at given index
(at int, ns *Span)
| 64 | |
| 65 | // InsertSpan inserts a new span at given index |
| 66 | func (tr *Text) InsertSpan(at int, ns *Span) { |
| 67 | sz := len(tr.Spans) |
| 68 | tr.Spans = append(tr.Spans, Span{}) |
| 69 | if at > sz-1 { |
| 70 | tr.Spans[sz] = *ns |
| 71 | return |
| 72 | } |
| 73 | copy(tr.Spans[at+1:], tr.Spans[at:]) |
| 74 | tr.Spans[at] = *ns |
| 75 | } |
| 76 | |
| 77 | // Render does text rendering into given image, within given bounds, at given |
| 78 | // absolute position offset (specifying position of text baseline) -- any |