Skip to content

Commit

Permalink
Fix RichText not getting the 1.0 default
Browse files Browse the repository at this point in the history
  • Loading branch information
MeGaGiGaGon committed Nov 12, 2024
1 parent 67d78fa commit 959187b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion crates/egui/src/widget_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
/// RichText::new("colored").color(Color32::RED);
/// RichText::new("Large and underlined").size(20.0).underline();
/// ```
#[derive(Clone, Default, PartialEq)]
#[derive(Clone, PartialEq)]
pub struct RichText {
text: String,
size: Option<f32>,
Expand All @@ -40,6 +40,29 @@ pub struct RichText {
raised: bool,
}

impl Default for RichText {
fn default() -> Self {
Self {
text: Default::default(),
size: Default::default(),
extra_letter_spacing: Default::default(),
line_height: Default::default(),
family: Default::default(),
text_style: Default::default(),
background_color: Default::default(),
expand_bg: 1.0,
text_color: Default::default(),
code: Default::default(),
strong: Default::default(),
weak: Default::default(),
strikethrough: Default::default(),
underline: Default::default(),
italics: Default::default(),
raised: Default::default(),
}
}
}

impl From<&str> for RichText {
#[inline]
fn from(text: &str) -> Self {
Expand Down

0 comments on commit 959187b

Please sign in to comment.