Bladeren bron

app: rename text2 => text

jkds 7 maanden geleden
bovenliggende
commit
22f9597908

+ 2 - 2
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");

+ 0 - 0
bin/app/src/text2/atlas.rs → bin/app/src/text/atlas.rs


+ 1 - 1
bin/app/src/text2/editor/android.rs → 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};
 

+ 0 - 0
bin/app/src/text2/editor/mod.rs → bin/app/src/text/editor/mod.rs


+ 1 - 1
bin/app/src/text2/editor/parley.rs → 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 {

+ 0 - 0
bin/app/src/text2/mod.rs → bin/app/src/text/mod.rs


+ 0 - 0
bin/app/src/text2/render.rs → bin/app/src/text/render.rs


+ 8 - 8
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(&timestamp_layout, render_api, gfxtag!("chatview_privmsg_ts"));
+            text::render_layout(&timestamp_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);
         }
 

+ 1 - 1
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;

+ 6 - 6
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);

+ 3 - 3
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

+ 4 - 4
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")]