font browser
fix: render UI text via a resolved font family (was invisible)
rebuild_text_items built glyphon buffers with a bare Attrs::new(), which did not resolve to a loaded font family in this environment — cosmic-text shaped empty runs and no UI text rendered at all. Route label buffers through cce_ui's shared get_text_buffer with "monospace" (resolves to a named, loaded font), matching the other apps. Verified by screenshot: font list, buttons, style/size controls and preview text now render. Also adds an opt-in CCE_PAINT_WALK display_list() for the Phase 3 single paint path.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
src/main.rs | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 464d23a..bf74a9c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -434,14 +434,16 @@ impl TypefaceApp {
}, None));
}
- // Convert TextLabels to text_items
- let scale = cce_ui::scale::scale_factor();
+ // Convert TextLabels to text_items via cce-ui's shared buffer factory, which resolves the
+ // font family to an actually-loaded font. (Building buffers with a bare `Attrs::new()`
+ // doesn't resolve a family — cosmic-text then shaped empty runs and nothing rendered.)
for (label, bounds) in labels {
- let physical_size = label.font_size * scale;
- let metrics = Metrics::new(physical_size, physical_size * 1.4);
- let mut buf = Buffer::new(font_system, metrics);
- buf.set_text(font_system, &label.text, Attrs::new(), glyphon::Shaping::Advanced);
- buf.shape_until_scroll(font_system, true);
+ let buf = cce_ui::backend::window_runner::get_text_buffer(
+ font_system,
+ &label.text,
+ label.font_size,
+ Some("monospace"),
+ );
self.text_items.push(TextItem {
buffer: buf,
x: label.x,
@@ -471,6 +473,15 @@ impl Application for TypefaceApp {
quads.extend(self.root_window.all_rounded_quads(&self.ui_context));
}
+ fn display_list(&mut self) -> Option<cce_ui::scene::paint::DisplayList> {
+ // Opt-in A/B for the Phase 3 single paint path (CCE_PAINT_WALK); default-on once verified.
+ if std::env::var("CCE_PAINT_WALK").is_err() {
+ return None;
+ }
+ let root: *mut (dyn cce_ui::widget::Element + 'static) = self.root_window.as_ptr_mut();
+ Some(cce_ui::scene::painter::paint_tree(&self.ui_context, root))
+ }
+
fn new(_qh: &QueueHandle<EngineState<Self>>, _sender: calloop::channel::Sender<Self::Message>) -> Self {
cce_ui::scale::set_scale_factor(1.0);
// Parse command line arguments