Code review fixes

This commit is contained in:
Adam
2025-10-04 18:59:09 -07:00
parent e6d6aa6873
commit fe7766b845
6 changed files with 5 additions and 15 deletions
@@ -546,13 +546,11 @@ impl TableRowLayout for Typography {
"Typography" "Typography"
} }
fn identifier(&self) -> String { fn identifier(&self) -> String {
"Typography".to_string() format!("Typography: {self:?}")
}
fn element_widget(&self, _index: usize) -> WidgetHolder {
TextLabel::new("Not supported").widget_holder()
} }
fn element_page(&self, _data: &mut LayoutData) -> Vec<LayoutGroup> { fn element_page(&self, _data: &mut LayoutData) -> Vec<LayoutGroup> {
vec![LayoutGroup::Row { widgets: Vec::new() }] let widgets = vec![TextLabel::new("TODO").widget_holder()];
vec![LayoutGroup::Row { widgets }]
} }
} }
@@ -9,7 +9,6 @@ use core::borrow::Borrow;
use core::f64::consts::{FRAC_PI_2, PI, TAU}; use core::f64::consts::{FRAC_PI_2, PI, TAU};
use glam::{DAffine2, DVec2}; use glam::{DAffine2, DVec2};
use graphene_std::Color; use graphene_std::Color;
use graphene_std::consts::SOURCE_SANS_FONT_DATA;
use graphene_std::math::quad::Quad; use graphene_std::math::quad::Quad;
use graphene_std::subpath::{self, Subpath}; use graphene_std::subpath::{self, Subpath};
use graphene_std::table::Table; use graphene_std::table::Table;
-7
View File
@@ -7,10 +7,3 @@ pub const LAYER_OUTLINE_STROKE_WEIGHT: f64 = 0.5;
// Fonts // Fonts
pub const DEFAULT_FONT_FAMILY: &str = "Cabin"; pub const DEFAULT_FONT_FAMILY: &str = "Cabin";
pub const DEFAULT_FONT_STYLE: &str = "Regular (400)"; 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)";
+1 -1
View File
@@ -70,6 +70,6 @@ impl RenderComplexity for GradientStops {
impl RenderComplexity for Typography { impl RenderComplexity for Typography {
fn render_complexity(&self) -> usize { fn render_complexity(&self) -> usize {
1 self.layout.lines().map(|line| line.items().count()).sum()
} }
} }
+1 -1
View File
@@ -83,7 +83,7 @@ impl fmt::Debug for Typography {
impl PartialEq for Typography { impl PartialEq for Typography {
fn eq(&self, _other: &Self) -> bool { fn eq(&self, _other: &Self) -> bool {
unimplemented!("Typography data type cannot be compared") unimplemented!("Typography cannot be compared")
} }
} }