()
| 173 | func (fb *FontButton) WidgetValue() any { return &fb.Text } |
| 174 | |
| 175 | func (fb *FontButton) Init() { |
| 176 | fb.Button.Init() |
| 177 | fb.SetType(ButtonTonal) |
| 178 | InitValueButton(fb, false, func(d *Body) { |
| 179 | d.SetTitle("Select a font family") |
| 180 | si := 0 |
| 181 | fi := paint.FontLibrary.FontInfo |
| 182 | tb := NewTable(d) |
| 183 | tb.SetSlice(&fi).SetSelectedField("Name").SetSelectedValue(fb.Text).BindSelect(&si) |
| 184 | tb.SetTableStyler(func(w Widget, s *styles.Style, row, col int) { |
| 185 | if col != 4 { |
| 186 | return |
| 187 | } |
| 188 | s.Font.Family = fi[row].Name |
| 189 | s.Font.Stretch = fi[row].Stretch |
| 190 | s.Font.Weight = fi[row].Weight |
| 191 | s.Font.Style = fi[row].Style |
| 192 | s.Font.Size.Pt(18) |
| 193 | }) |
| 194 | tb.OnChange(func(e events.Event) { |
| 195 | fb.Text = fi[si].Name |
| 196 | }) |
| 197 | }) |
| 198 | } |
| 199 | |
| 200 | // HighlightingName is a highlighting style name. |
| 201 | // TODO: move this to texteditor/highlighting. |
nothing calls this directly
no test coverage detected