diff --git a/epaint/src/shape.rs b/epaint/src/shape.rs index d097b8c2..40c9b3fe 100644 --- a/epaint/src/shape.rs +++ b/epaint/src/shape.rs @@ -506,6 +506,7 @@ impl Rounding { /// How to paint some text on screen. #[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct TextShape { /// Top left corner of the first character. pub pos: Pos2, diff --git a/epaint/src/text/font.rs b/epaint/src/text/font.rs index 47b41adf..d2f29267 100644 --- a/epaint/src/text/font.rs +++ b/epaint/src/text/font.rs @@ -9,6 +9,7 @@ use std::collections::BTreeSet; // ---------------------------------------------------------------------------- #[derive(Clone, Copy, Debug, Default, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct UvRect { /// X/Y offset for nice rendering (unit: points). pub offset: Vec2, diff --git a/epaint/src/text/text_layout_types.rs b/epaint/src/text/text_layout_types.rs index 0b608df0..95488ea6 100644 --- a/epaint/src/text/text_layout_types.rs +++ b/epaint/src/text/text_layout_types.rs @@ -261,6 +261,7 @@ impl TextFormat { /// /// You can create a [`Galley`] using [`crate::Fonts::layout_job`]; #[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Galley { /// The job that this galley is the result of. /// Contains the original string and style sections. @@ -294,6 +295,7 @@ pub struct Galley { } #[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Row { /// One for each `char`. pub glyphs: Vec, @@ -316,6 +318,7 @@ pub struct Row { /// The tessellated output of a row. #[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct RowVisuals { /// The tessellated text, using non-normalized (texel) UV coordinates. /// That is, you need to divide the uv coordinates by the texture size. @@ -341,6 +344,7 @@ impl Default for RowVisuals { } #[derive(Copy, Clone, Debug, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Glyph { pub chr: char, /// Relative to the galley position.