From 22f95979085b47cdfb5ff72ea1f48b90f45afe0b Mon Sep 17 00:00:00 2001 From: jkds Date: Mon, 5 Jan 2026 18:20:29 +0100 Subject: [PATCH] app: rename text2 => text --- bin/app/src/main.rs | 4 ++-- bin/app/src/{text2 => text}/atlas.rs | 0 bin/app/src/{text2 => text}/editor/android.rs | 2 +- bin/app/src/{text2 => text}/editor/mod.rs | 0 bin/app/src/{text2 => text}/editor/parley.rs | 2 +- bin/app/src/{text2 => text}/mod.rs | 0 bin/app/src/{text2 => text}/render.rs | 0 bin/app/src/ui/chatview/page.rs | 16 ++++++++-------- bin/app/src/ui/edit/behave.rs | 2 +- bin/app/src/ui/edit/mod.rs | 12 ++++++------ bin/app/src/ui/emoji_picker/emoji.rs | 6 +++--- bin/app/src/ui/text.rs | 8 ++++---- 12 files changed, 26 insertions(+), 26 deletions(-) rename bin/app/src/{text2 => text}/atlas.rs (100%) rename bin/app/src/{text2 => text}/editor/android.rs (99%) rename bin/app/src/{text2 => text}/editor/mod.rs (100%) rename bin/app/src/{text2 => text}/editor/parley.rs (99%) rename bin/app/src/{text2 => text}/mod.rs (100%) rename bin/app/src/{text2 => text}/render.rs (100%) diff --git a/bin/app/src/main.rs b/bin/app/src/main.rs index 34e4962f2..7366bf194 100644 --- a/bin/app/src/main.rs +++ b/bin/app/src/main.rs @@ -45,7 +45,7 @@ mod pubsub; //mod ringbuf; mod scene; mod shape; -mod text2; +mod text; mod ui; mod util; @@ -115,7 +115,7 @@ impl God { // Abort the application on panic right away std::panic::set_hook(Box::new(panic_hook)); - text2::init_txt_ctx(); + text::init_txt_ctx(); let file_logging_guard = logger::setup_logging(); info!(target: "main", "Creating the app"); diff --git a/bin/app/src/text2/atlas.rs b/bin/app/src/text/atlas.rs similarity index 100% rename from bin/app/src/text2/atlas.rs rename to bin/app/src/text/atlas.rs diff --git a/bin/app/src/text2/editor/android.rs b/bin/app/src/text/editor/android.rs similarity index 99% rename from bin/app/src/text2/editor/android.rs rename to bin/app/src/text/editor/android.rs index be92ced56..607118dfe 100644 --- a/bin/app/src/text2/editor/android.rs +++ b/bin/app/src/text/editor/android.rs @@ -24,7 +24,7 @@ use crate::{ gfx::Point, mesh::Color, prop::{PropertyAtomicGuard, PropertyColor, PropertyFloat32, PropertyStr}, - text2::{TextContext, TEXT_CTX}, + text::{TextContext, TEXT_CTX}, }; use std::cmp::{max, min}; diff --git a/bin/app/src/text2/editor/mod.rs b/bin/app/src/text/editor/mod.rs similarity index 100% rename from bin/app/src/text2/editor/mod.rs rename to bin/app/src/text/editor/mod.rs diff --git a/bin/app/src/text2/editor/parley.rs b/bin/app/src/text/editor/parley.rs similarity index 99% rename from bin/app/src/text2/editor/parley.rs rename to bin/app/src/text/editor/parley.rs index 92711e58a..a4c392c83 100644 --- a/bin/app/src/text2/editor/parley.rs +++ b/bin/app/src/text/editor/parley.rs @@ -20,7 +20,7 @@ use crate::{ gfx::Point, mesh::Color, prop::{PropertyAtomicGuard, PropertyColor, PropertyFloat32, PropertyStr}, - text2::{TextContext, FONT_STACK, TEXT_CTX}, + text::{TextContext, FONT_STACK, TEXT_CTX}, }; pub struct Editor { diff --git a/bin/app/src/text2/mod.rs b/bin/app/src/text/mod.rs similarity index 100% rename from bin/app/src/text2/mod.rs rename to bin/app/src/text/mod.rs diff --git a/bin/app/src/text2/render.rs b/bin/app/src/text/render.rs similarity index 100% rename from bin/app/src/text2/render.rs rename to bin/app/src/text/render.rs diff --git a/bin/app/src/ui/chatview/page.rs b/bin/app/src/ui/chatview/page.rs index 08fd93ee3..6e542bc2f 100644 --- a/bin/app/src/ui/chatview/page.rs +++ b/bin/app/src/ui/chatview/page.rs @@ -38,7 +38,7 @@ use crate::{ gfx::{gfxtag, DrawInstruction, ManagedTexturePtr, Point, Rectangle, RenderApi}, mesh::{Color, MeshBuilder, COLOR_CYAN, COLOR_GREEN, COLOR_RED, COLOR_WHITE}, prop::{PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr}, - text2, + text, util::enumerate_mut, }; @@ -137,7 +137,7 @@ impl PrivMessage { .push(DrawInstruction::Draw(mesh.alloc(render_api).draw_with_textures(vec![]))); } - let mut txt_ctx = text2::TEXT_CTX.get().await; + let mut txt_ctx = text::TEXT_CTX.get().await; // Timestamp layout let timestr = Self::gen_timestr(self.timestamp); @@ -187,13 +187,13 @@ impl PrivMessage { // Render timestamp let timestamp_instrs = - text2::render_layout(×tamp_layout, render_api, gfxtag!("chatview_privmsg_ts")); + text::render_layout(×tamp_layout, render_api, gfxtag!("chatview_privmsg_ts")); all_instrs.extend(timestamp_instrs); // Render message text offset by timestamp_width all_instrs.push(DrawInstruction::Move(Point::new(timestamp_width, 0.))); let text_instrs = - text2::render_layout(&text_layout, render_api, gfxtag!("chatview_privmsg_text")); + text::render_layout(&text_layout, render_api, gfxtag!("chatview_privmsg_text")); all_instrs.extend(text_instrs); self.mesh_cache = Some(all_instrs.clone()); @@ -276,7 +276,7 @@ impl DateMessage { let datestr = Self::datestr(self.timestamp); - let mut txt_ctx = text2::TEXT_CTX.get().await; + let mut txt_ctx = text::TEXT_CTX.get().await; let layout = txt_ctx.make_layout( &datestr, timestamp_color, @@ -288,7 +288,7 @@ impl DateMessage { ); drop(txt_ctx); - let mut txt_instrs = text2::render_layout(&layout, render_api, gfxtag!("chatview_datemsg")); + let mut txt_instrs = text::render_layout(&layout, render_api, gfxtag!("chatview_datemsg")); let mut instrs = Vec::with_capacity(1 + txt_instrs.len()); instrs.push(DrawInstruction::Move(Point::new(0., -line_height))); instrs.append(&mut txt_instrs); @@ -492,7 +492,7 @@ impl FileMessage { let file_strs = Self::filestr(&self.file_url, &self.status); let mut layouts = Vec::with_capacity(file_strs.len()); - let mut txt_ctx = text2::TEXT_CTX.get().await; + let mut txt_ctx = text::TEXT_CTX.get().await; for file_str in &file_strs { let layout = txt_ctx.make_layout( file_str, @@ -513,7 +513,7 @@ impl FileMessage { all_instrs.push(DrawInstruction::Move(Point::new(0., -line_height))); let instrs = - text2::render_layout(&layout, render_api, gfxtag!("chatview_filemsg_text")); + text::render_layout(&layout, render_api, gfxtag!("chatview_filemsg_text")); all_instrs.extend(instrs); } diff --git a/bin/app/src/ui/edit/behave.rs b/bin/app/src/ui/edit/behave.rs index 150625062..f62316a64 100644 --- a/bin/app/src/ui/edit/behave.rs +++ b/bin/app/src/ui/edit/behave.rs @@ -24,7 +24,7 @@ use std::sync::{atomic::Ordering, Arc}; use crate::{ gfx::{Point, Rectangle}, prop::{PropertyAtomicGuard, PropertyFloat32, PropertyPtr, PropertyRect, Role}, - text2::Editor, + text::Editor, }; use super::EditorHandle; diff --git a/bin/app/src/ui/edit/mod.rs b/bin/app/src/ui/edit/mod.rs index 2dcb40066..3129ff4f3 100644 --- a/bin/app/src/ui/edit/mod.rs +++ b/bin/app/src/ui/edit/mod.rs @@ -46,7 +46,7 @@ use crate::{ PropertyFloat32, PropertyPtr, PropertyRect, PropertyStr, PropertyUint32, Role, }, scene::{MethodCallSub, Pimpl, SceneNodePtr, SceneNodeWeak}, - text2::{self, Editor}, + text::{self, Editor}, ExecutorPtr, }; @@ -516,7 +516,7 @@ impl BaseEdit { match key { 'a' => { if action_mod { - let mut txt_ctx = text2::TEXT_CTX.get().await; + let mut txt_ctx = text::TEXT_CTX.get().await; let mut editor = self.lock_editor().await; let mut drv = editor.driver(&mut txt_ctx).unwrap(); @@ -565,7 +565,7 @@ impl BaseEdit { t!("handle_key({:?}, {:?}) action_mod={action_mod}", key, mods); - let mut txt_ctx = text2::TEXT_CTX.get().await; + let mut txt_ctx = text::TEXT_CTX.get().await; let mut editor = self.lock_editor().await; let mut drv = editor.driver(&mut txt_ctx).unwrap(); @@ -935,7 +935,7 @@ impl BaseEdit { let mut editor = self.lock_editor().await; // The below lines rely on parley driver which android does not use - //let mut txt_ctx = text2::TEXT_CTX.get().await; + //let mut txt_ctx = text::TEXT_CTX.get().await; //let mut drv = editor.driver(&mut txt_ctx).unwrap(); //drv.extend_selection_to_point(clip_mouse_pos.x, clip_mouse_pos.y); let layout = editor.layout(); @@ -1106,7 +1106,7 @@ impl BaseEdit { let layout = editor.layout(); let mut render_instrs = - text2::render_layout(layout, &self.render_api, gfxtag!("chatedit_txt_mesh")); + text::render_layout(layout, &self.render_api, gfxtag!("chatedit_txt_mesh")); instrs.append(&mut render_instrs); instrs @@ -1681,7 +1681,7 @@ impl UIObject for BaseEdit { self.abs_to_local(&mut mouse_pos); { - let mut txt_ctx = text2::TEXT_CTX.get().await; + let mut txt_ctx = text::TEXT_CTX.get().await; let mut editor = self.lock_editor().await; let mut drv = editor.driver(&mut txt_ctx).unwrap(); drv.move_to_point(mouse_pos.x, mouse_pos.y); diff --git a/bin/app/src/ui/emoji_picker/emoji.rs b/bin/app/src/ui/emoji_picker/emoji.rs index 90f8b31da..c40966ae3 100644 --- a/bin/app/src/ui/emoji_picker/emoji.rs +++ b/bin/app/src/ui/emoji_picker/emoji.rs @@ -27,7 +27,7 @@ use std::{ use crate::{ gfx::{gfxtag, DrawInstruction, DrawMesh, Rectangle, RenderApi}, mesh::{MeshBuilder, COLOR_WHITE}, - text2, + text, }; use super::default; @@ -85,13 +85,13 @@ impl EmojiMeshes { /// Make mesh for this emoji centered at (0, 0) async fn gen_emoji_mesh(&self, emoji: &str) -> DrawMesh { //d!("rendering emoji: '{emoji}'"); - let mut txt_ctx = text2::TEXT_CTX.get().await; + let mut txt_ctx = text::TEXT_CTX.get().await; // The params here don't actually matter since we're talking about BMP fixed sizes let layout = txt_ctx.make_layout(emoji, COLOR_WHITE, self.emoji_size, 1., 1., None, &[]); drop(txt_ctx); - let instrs = text2::render_layout(&layout, &self.render_api, gfxtag!("emoji_mesh")); + let instrs = text::render_layout(&layout, &self.render_api, gfxtag!("emoji_mesh")); // Extract the mesh from the draw instructions // For a single emoji, we should get exactly one Draw instruction with a mesh diff --git a/bin/app/src/ui/text.rs b/bin/app/src/ui/text.rs index 343b478f9..69920b229 100644 --- a/bin/app/src/ui/text.rs +++ b/bin/app/src/ui/text.rs @@ -30,7 +30,7 @@ use crate::{ PropertyRect, PropertyStr, PropertyUint32, Role, }, scene::{Pimpl, SceneNodeWeak}, - text2::{self, TEXT_CTX}, + text::{self, TEXT_CTX}, util::i18n::I18nBabelFish, ExecutorPtr, }; @@ -128,12 +128,12 @@ impl Text { txt_ctx.make_layout(&text, text_color, font_size, lineheight, window_scale, None, &[]) }; - let mut debug_opts = text2::DebugRenderOptions::OFF; + let mut debug_opts = text::DebugRenderOptions::OFF; if self.debug.get() { - debug_opts |= text2::DebugRenderOptions::BASELINE; + debug_opts |= text::DebugRenderOptions::BASELINE; } - text2::render_layout_with_opts(&layout, debug_opts, &self.render_api, gfxtag!("text")) + text::render_layout_with_opts(&layout, debug_opts, &self.render_api, gfxtag!("text")) } #[instrument(target = "ui::text")]