From fe7766b845cd921d99c89776363cc48e0884faba Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 4 Oct 2025 18:59:09 -0700 Subject: [PATCH] Code review fixes --- .../data_panel/data_panel_message_handler.rs | 8 +++----- .../document/overlays}/source-sans-pro-regular.ttf | Bin .../document/overlays/utility_types_vello.rs | 1 - node-graph/gcore/src/consts.rs | 7 ------- node-graph/gcore/src/render_complexity.rs | 2 +- node-graph/gcore/src/text.rs | 2 +- 6 files changed, 5 insertions(+), 15 deletions(-) rename {node-graph/gcore/src/text => editor/src/messages/portfolio/document/overlays}/source-sans-pro-regular.ttf (100%) diff --git a/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs b/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs index d3bdb75a05..52397da8ad 100644 --- a/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs @@ -546,13 +546,11 @@ impl TableRowLayout for Typography { "Typography" } fn identifier(&self) -> String { - "Typography".to_string() - } - fn element_widget(&self, _index: usize) -> WidgetHolder { - TextLabel::new("Not supported").widget_holder() + format!("Typography: {self:?}") } fn element_page(&self, _data: &mut LayoutData) -> Vec { - vec![LayoutGroup::Row { widgets: Vec::new() }] + let widgets = vec![TextLabel::new("TODO").widget_holder()]; + vec![LayoutGroup::Row { widgets }] } } diff --git a/node-graph/gcore/src/text/source-sans-pro-regular.ttf b/editor/src/messages/portfolio/document/overlays/source-sans-pro-regular.ttf similarity index 100% rename from node-graph/gcore/src/text/source-sans-pro-regular.ttf rename to editor/src/messages/portfolio/document/overlays/source-sans-pro-regular.ttf diff --git a/editor/src/messages/portfolio/document/overlays/utility_types_vello.rs b/editor/src/messages/portfolio/document/overlays/utility_types_vello.rs index 6c7c91b385..c188d3b574 100644 --- a/editor/src/messages/portfolio/document/overlays/utility_types_vello.rs +++ b/editor/src/messages/portfolio/document/overlays/utility_types_vello.rs @@ -9,7 +9,6 @@ use core::borrow::Borrow; use core::f64::consts::{FRAC_PI_2, PI, TAU}; use glam::{DAffine2, DVec2}; use graphene_std::Color; -use graphene_std::consts::SOURCE_SANS_FONT_DATA; use graphene_std::math::quad::Quad; use graphene_std::subpath::{self, Subpath}; use graphene_std::table::Table; diff --git a/node-graph/gcore/src/consts.rs b/node-graph/gcore/src/consts.rs index cec018c9e5..505dc81ccd 100644 --- a/node-graph/gcore/src/consts.rs +++ b/node-graph/gcore/src/consts.rs @@ -7,10 +7,3 @@ pub const LAYER_OUTLINE_STROKE_WEIGHT: f64 = 0.5; // Fonts pub const DEFAULT_FONT_FAMILY: &str = "Cabin"; pub const DEFAULT_FONT_STYLE: &str = "Regular (400)"; - -// Load Source Sans Pro font data -// TODO: Grab this from the node_modules folder (either with `include_bytes!` or ideally at runtime) instead of checking the font file into the repo. -// TODO: And maybe use the WOFF2 version (if it's supported) for its smaller, compressed file size. -pub const SOURCE_SANS_FONT_DATA: &[u8] = include_bytes!("text/source-sans-pro-regular.ttf"); -pub const SOURCE_SANS_FONT_FAMILY: &str = "Source Sans Pro"; -pub const SOURCE_SANS_FONT_STYLE: &str = "Regular (400)"; diff --git a/node-graph/gcore/src/render_complexity.rs b/node-graph/gcore/src/render_complexity.rs index 3f8e1e8f5a..abba3fbe5d 100644 --- a/node-graph/gcore/src/render_complexity.rs +++ b/node-graph/gcore/src/render_complexity.rs @@ -70,6 +70,6 @@ impl RenderComplexity for GradientStops { impl RenderComplexity for Typography { fn render_complexity(&self) -> usize { - 1 + self.layout.lines().map(|line| line.items().count()).sum() } } diff --git a/node-graph/gcore/src/text.rs b/node-graph/gcore/src/text.rs index 7077da5a56..155f021b22 100644 --- a/node-graph/gcore/src/text.rs +++ b/node-graph/gcore/src/text.rs @@ -83,7 +83,7 @@ impl fmt::Debug for Typography { impl PartialEq for Typography { fn eq(&self, _other: &Self) -> bool { - unimplemented!("Typography data type cannot be compared") + unimplemented!("Typography cannot be compared") } }