1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Implement user-named TextStyle:s

This commit is contained in:
Emil Ernerfeldt
2022-01-22 18:29:53 +01:00
parent 4f98f26fda
commit 1aceaefba3
7 changed files with 109 additions and 74 deletions

View File

@@ -54,7 +54,7 @@ impl super::View for FontBook {
egui::ComboBox::from_label("Text style")
.selected_text(format!("{:?}", self.text_style))
.show_ui(ui, |ui| {
for style in egui::TextStyle::all() {
for style in egui::TextStyle::built_in() {
ui.selectable_value(
&mut self.text_style,
style.clone(),
@@ -81,7 +81,7 @@ impl super::View for FontBook {
ui.fonts()
.lock()
.fonts
.font_mut(&text_style)
.font_for_style(&text_style)
.characters()
.iter()
.filter(|chr| !chr.is_whitespace() && !chr.is_ascii_control())

View File

@@ -261,7 +261,7 @@ impl Widget for &mut LegendDemo {
egui::Grid::new("settings").show(ui, |ui| {
ui.label("Text style:");
ui.horizontal(|ui| {
TextStyle::all().for_each(|style| {
TextStyle::built_in().for_each(|style| {
ui.selectable_value(
&mut config.text_style,
style.clone(),