From e2acb29d3e4ef69a533522a24d0cf0c645011071 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 9 Dec 2024 10:56:25 +0700 Subject: [PATCH] Consistently use `FontWeight` as the name Right now, there are uses of `Weight` from Fontique, `TextWeight` from Masonry, and `FontWeight` from Parley. We should just use a single name. --- masonry/examples/hello_masonry.rs | 5 ++--- masonry/src/lib.rs | 2 +- masonry/src/widget/variable_label.rs | 9 ++++----- xilem/examples/mason.rs | 4 ++-- xilem/examples/variable_clock.rs | 7 +++---- xilem/src/lib.rs | 2 +- xilem/src/view/label.rs | 10 +++++----- xilem/src/view/variable_label.rs | 13 ++++++------- 8 files changed, 24 insertions(+), 28 deletions(-) diff --git a/masonry/examples/hello_masonry.rs b/masonry/examples/hello_masonry.rs index a464ef444..80ecbd260 100644 --- a/masonry/examples/hello_masonry.rs +++ b/masonry/examples/hello_masonry.rs @@ -10,8 +10,7 @@ use masonry::dpi::LogicalSize; use masonry::text::StyleProperty; use masonry::widget::{Button, Flex, Label, RootWidget}; -use masonry::{Action, AppDriver, DriverCtx, WidgetId}; -use parley::fontique::Weight; +use masonry::{Action, AppDriver, DriverCtx, FontWeight, WidgetId}; use winit::window::Window; const VERTICAL_WIDGET_SPACING: f64 = 20.0; @@ -35,7 +34,7 @@ fn main() { let label = Label::new("Hello") .with_style(StyleProperty::FontSize(32.0)) // Ideally there's be an Into in Parley for this - .with_style(StyleProperty::FontWeight(Weight::BOLD)); + .with_style(StyleProperty::FontWeight(FontWeight::BOLD)); let button = Button::new("Say hello"); // Arrange the two widgets vertically, with some padding diff --git a/masonry/src/lib.rs b/masonry/src/lib.rs index 27b6b31a4..a948bb28d 100644 --- a/masonry/src/lib.rs +++ b/masonry/src/lib.rs @@ -177,8 +177,8 @@ pub use vello::kurbo; pub use cursor_icon::{CursorIcon, ParseError as CursorIconParseError}; pub use kurbo::{Affine, Insets, Point, Rect, Size, Vec2}; -pub use parley::fontique::Weight as TextWeight; pub use parley::layout::Alignment as TextAlignment; +pub use parley::style::FontWeight; pub use vello::peniko::{Color, Gradient}; pub use action::Action; diff --git a/masonry/src/widget/variable_label.rs b/masonry/src/widget/variable_label.rs index a624cce84..4171b9572 100644 --- a/masonry/src/widget/variable_label.rs +++ b/masonry/src/widget/variable_label.rs @@ -6,7 +6,6 @@ use std::cmp::Ordering; use accesskit::{Node, Role}; -use parley::fontique::Weight; use smallvec::{smallvec, SmallVec}; use tracing::{trace_span, Span}; use vello::kurbo::{Point, Size}; @@ -15,8 +14,8 @@ use vello::Scene; use crate::text::{ArcStr, StyleProperty}; use crate::widget::WidgetMut; use crate::{ - AccessCtx, AccessEvent, BoxConstraints, EventCtx, LayoutCtx, PaintCtx, PointerEvent, QueryCtx, - RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, + AccessCtx, AccessEvent, BoxConstraints, EventCtx, FontWeight, LayoutCtx, PaintCtx, + PointerEvent, QueryCtx, RegisterCtx, TextEvent, Update, UpdateCtx, Widget, WidgetId, }; use super::{Label, WidgetPod}; @@ -142,7 +141,7 @@ impl VariableLabel { pub fn from_label_pod(label: WidgetPod