summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-11 02:47:24 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-11 02:47:24 +0200
commit346af3f8b0baa418fd37b878bc2930ff0bd57cc0 (patch)
treeb11cde03595fb28bddb055507d272dd973634ab5 /widget
parent9245423c5d82f88c99adecaaf5dd2ac3559a05a8 (diff)
downloadiced-346af3f8b0baa418fd37b878bc2930ff0bd57cc0.tar.gz
iced-346af3f8b0baa418fd37b878bc2930ff0bd57cc0.tar.bz2
iced-346af3f8b0baa418fd37b878bc2930ff0bd57cc0.zip
Make `FontSystem` global and simplify `Paragraph` API
Diffstat (limited to 'widget')
-rw-r--r--widget/src/pick_list.rs22
-rw-r--r--widget/src/text_input.rs17
2 files changed, 15 insertions, 24 deletions
diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs
index 056a5e65..4b89d6ff 100644
--- a/widget/src/pick_list.rs
+++ b/widget/src/pick_list.rs
@@ -415,23 +415,17 @@ where
for (option, paragraph) in options.iter().zip(state.options.iter_mut()) {
let label = option.to_string();
- renderer.update_paragraph(
- paragraph,
- Text {
- content: &label,
- ..option_text
- },
- );
+ paragraph.update(Text {
+ content: &label,
+ ..option_text
+ });
}
if let Some(placeholder) = placeholder {
- renderer.update_paragraph(
- &mut state.placeholder,
- Text {
- content: placeholder,
- ..option_text
- },
- );
+ state.placeholder.update(Text {
+ content: placeholder,
+ ..option_text
+ });
}
let max_width = match width {
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index 7d5ae806..f9a2d419 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -523,18 +523,15 @@ where
shaping: text::Shaping::Advanced,
};
- renderer.update_paragraph(&mut state.placeholder, placeholder_text);
+ state.placeholder.update(placeholder_text);
let secure_value = is_secure.then(|| value.secure());
let value = secure_value.as_ref().unwrap_or(value);
- renderer.update_paragraph(
- &mut state.value,
- Text {
- content: &value.to_string(),
- ..placeholder_text
- },
- );
+ state.value.update(Text {
+ content: &value.to_string(),
+ ..placeholder_text
+ });
if let Some(icon) = icon {
let icon_text = Text {
@@ -548,7 +545,7 @@ where
shaping: text::Shaping::Advanced,
};
- renderer.update_paragraph(&mut state.icon, icon_text);
+ state.icon.update(icon_text);
let icon_width = state.icon.min_width();
@@ -1461,7 +1458,7 @@ fn replace_paragraph<Renderer>(
let mut children_layout = layout.children();
let text_bounds = children_layout.next().unwrap().bounds();
- state.value = renderer.create_paragraph(Text {
+ state.value = Renderer::Paragraph::with_text(Text {
font,
line_height,
content: &value.to_string(),