status bar
git clone https://git.lucas.co/cce-status-interface.git
deps: drop glyphon, use cce-ui's cosmic-text re-export
cce-ui no longer depends on glyphon (a wgpu text renderer whose wgpu-side API
was unreachable once the Vulkan path replaced it) — it depends on cosmic-text
directly and re-exports it. Everything this crate named as `glyphon::` was a
cosmic-text re-export, so it now goes through `cce_ui::cosmic_text` and needs
no text-library dependency of its own. That also makes it impossible to drift
onto a second cosmic-text version: a FontSystem handed to cce-ui must be the
same type.
No behavior change — cosmic-text is pinned to the version glyphon resolved to
(=0.12.1) and shaping was verified identical glyph-for-glyph.
Co-Authored-By: Claude <[email protected]>
Cargo.toml | 1 -
src/config.rs | 12 ++++++------
src/main.rs | 12 ++++++------
src/modules.rs | 2 +-
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index afd6e89..50311dd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ wayland-client = { version = "0.31", features = ["system"] }
xkeysym = "0.2"
# Real dependency: stats.rs blocks on the async volume read.
pollster = "0.4"
-glyphon = "0.8"
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
diff --git a/src/config.rs b/src/config.rs
index ffdf400..aa5d79a 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -8,8 +8,8 @@
//! user's config (or collides with an unrelated key of the same name).
//!
//! Color space: text colors stay **raw sRGB** — they end up as `[u8; 3]` for
-//! glyphon (see `StyledLabel`), which expects sRGB. Quad/box colors are
-//! converted with [`cce_ui::color::srgb_to_linear`] because the wgpu pipeline
+//! cosmic-text (see `StyledLabel`), which expects sRGB. Quad/box colors are
+//! converted with [`cce_ui::color::srgb_to_linear`] because the Vulkan pipeline
//! samples them in linear space.
use std::collections::HashSet;
@@ -89,7 +89,7 @@ fn cfg_string(pointer: &str, legacy_key: &str) -> Option<String> {
pointer_or_fuzzy(&val, pointer, legacy_key).and_then(|v| v.as_str()).map(|s| s.to_string())
}
-/// A text color: raw sRGB RGB with alpha forced to 1.0 (glyphon consumes
+/// A text color: raw sRGB RGB with alpha forced to 1.0 (cosmic-text consumes
/// text colors as sRGB `[u8; 3]`; alpha is not carried by the text path).
pub(crate) fn text_color_from(val: &serde_json::Value, pointer: &str, legacy_key: &str) -> Option<[f32; 4]> {
let s = pointer_or_fuzzy(val, pointer, legacy_key)?.as_str()?;
@@ -97,7 +97,7 @@ pub(crate) fn text_color_from(val: &serde_json::Value, pointer: &str, legacy_key
Some([r, g, b, 1.0])
}
-/// A quad/box color: RGB converted sRGB→linear for the wgpu pipeline, alpha
+/// A quad/box color: RGB converted sRGB→linear for the Vulkan pipeline, alpha
/// kept raw.
pub(crate) fn quad_color_from(val: &serde_json::Value, pointer: &str, legacy_key: &str) -> Option<[f32; 4]> {
let s = pointer_or_fuzzy(val, pointer, legacy_key)?.as_str()?;
@@ -448,11 +448,11 @@ style {
let raw = 128.0f32 / 255.0;
let linear = cce_ui::color::srgb_to_linear(raw);
- // Text color: raw sRGB, alpha forced to 1.0 (glyphon takes sRGB u8).
+ // Text color: raw sRGB, alpha forced to 1.0 (cosmic-text takes sRGB u8).
let text = text_color_from(&val, "/style/status/normal_color", "status_normal_color").unwrap();
assert_rgba_close(text, [raw, raw, raw, 1.0]);
- // Quad color: RGB linearized for the wgpu pipeline, alpha raw.
+ // Quad color: RGB linearized for the Vulkan pipeline, alpha raw.
let quad = quad_color_from(&val, "/style/status/background_color", "status_background_color").unwrap();
assert_rgba_close(quad, [linear, linear, linear, raw]);
}
diff --git a/src/main.rs b/src/main.rs
index 917a9ef..858301c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -16,7 +16,7 @@ pub(crate) use tray::*;
use modules::{StatusModule, WindowModule, ClockModule, BatteryModule, VolumeModule, BrightnessModule, MemoryModule, CpuModule, TrayModule, LightSourceModule};
use std::collections::HashMap;
-use glyphon::{
+use cce_ui::cosmic_text::{
Attrs, Buffer, FontSystem, Metrics,
};
use cce_ui::color;
@@ -194,14 +194,14 @@ pub(crate) fn make_text_buffer(fs: &mut FontSystem, text: &str, size: f32, font_
let mut attrs = Attrs::new();
if let Some(ref font_name) = family_name {
let family = match font_name.as_str() {
- "monospace" => glyphon::Family::Name(cce_ui::layout::get_system_monospace_font()),
- "sans-serif" => glyphon::Family::SansSerif,
- "serif" => glyphon::Family::Serif,
- name => glyphon::Family::Name(name),
+ "monospace" => cce_ui::cosmic_text::Family::Name(cce_ui::layout::get_system_monospace_font()),
+ "sans-serif" => cce_ui::cosmic_text::Family::SansSerif,
+ "serif" => cce_ui::cosmic_text::Family::Serif,
+ name => cce_ui::cosmic_text::Family::Name(name),
};
attrs = attrs.family(family);
}
- buf.set_text(fs, text, attrs, glyphon::Shaping::Advanced);
+ buf.set_text(fs, text, attrs, cce_ui::cosmic_text::Shaping::Advanced);
buf.shape_until_scroll(fs, true);
buf
}
diff --git a/src/modules.rs b/src/modules.rs
index e183060..156569c 100644
--- a/src/modules.rs
+++ b/src/modules.rs
@@ -1,5 +1,5 @@
use std::collections::HashMap;
-use glyphon::FontSystem;
+use cce_ui::cosmic_text::FontSystem;
use cce_ui::color;
use cce_ui::widget::StyledLabel as Label;