Implement Serialize/Deserialize for TextShape

This commit is contained in:
Emil Ernerfeldt 2022-02-22 13:20:46 +01:00
parent a90379ac8d
commit 76f564428b
3 changed files with 6 additions and 0 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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<Glyph>,
@ -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.