| 1 |
--- |
| 2 |
title: "`FontSource` generic family variants" |
| 3 |
pull_requests: [24378] |
| 4 |
--- |
| 5 |
|
| 6 |
The generic font family variants on `FontSource`, such as `FontSource::SansSerif` and `FontSource::Monospace`, have been replaced by a new `GenericFontFamily` enum. Use the corresponding `FontSource` constructor methods, or convert `GenericFontFamily` into a `FontSource`. |
| 7 |
|
| 8 |
```rust |
| 9 |
// Old |
| 10 |
TextFont { |
| 11 |
font: FontSource::SansSerif, |
| 12 |
..default() |
| 13 |
} |
| 14 |
|
| 15 |
// New |
| 16 |
TextFont { |
| 17 |
font: FontSource::sans_serif(), |
| 18 |
..default() |
| 19 |
} |
| 20 |
``` |
| 21 |
|
| 22 |
`FontCx::set_generic_family` now takes a `GenericFontFamily` instead of a `parley::GenericFamily`. |