NewTextBox is an advanced text formatter that will format text placement based on the settings. It takes a single font face, a string, the width or height of the box (can be zero to disable), horizontal and vertical alignment (Left, Center, Right, Top, Bottom or Justify), text indentation for the fi
(face *FontFace, s string, width, height float64, halign, valign TextAlign, opts *TextOptions)
| 412 | |
| 413 | // NewTextBox is an advanced text formatter that will format text placement based on the settings. It takes a single font face, a string, the width or height of the box (can be zero to disable), horizontal and vertical alignment (Left, Center, Right, Top, Bottom or Justify), text indentation for the first line and line stretch (percentage to stretch the line based on the line height). |
| 414 | func NewTextBox(face *FontFace, s string, width, height float64, halign, valign TextAlign, opts *TextOptions) *Text { |
| 415 | rt := NewRichText(face) |
| 416 | rt.WriteString(s) |
| 417 | return rt.ToText(width, height, halign, valign, opts) |
| 418 | } |
| 419 | |
| 420 | type indexer []int |
| 421 |