From 65f60d1565b4e9c7343a81175cfae1a656c04e7a Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 19 Oct 2022 13:29:50 -0600 Subject: [PATCH] Log font families again --- examples/editor-libcosmic/src/text_box.rs | 2 +- src/buffer.rs | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/examples/editor-libcosmic/src/text_box.rs b/examples/editor-libcosmic/src/text_box.rs index 2988d87..ffdb464 100644 --- a/examples/editor-libcosmic/src/text_box.rs +++ b/examples/editor-libcosmic/src/text_box.rs @@ -197,7 +197,7 @@ where */ let duration = instant.elapsed(); - log::debug!("redraw: {:?}", duration); + log::trace!("redraw: {:?}", duration); } fn on_event( diff --git a/src/buffer.rs b/src/buffer.rs index 452cd5f..ea37355 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -568,6 +568,20 @@ impl<'a> TextBuffer<'a> { } } new_cursor_opt = Some(TextCursor::new(new_cursor_line, new_cursor_glyph)); + + if let Some(glyph) = line.glyphs.get(new_cursor_glyph) { + let text_line = &self.text_lines[line.line_i.get()]; + let text_glyph = &text_line[glyph.start..glyph.end]; + log::debug!( + "{}, {}: '{}' ('{}'): '{}' ({:?})", + new_cursor_line, + new_cursor_glyph, + glyph.font.info.family, + glyph.font.info.post_script_name, + text_glyph, + text_glyph + ); + } } line_y += line_height; @@ -581,9 +595,7 @@ impl<'a> TextBuffer<'a> { } let duration = instant.elapsed(); - log::debug!("click({}, {}): {:?}", mouse_x, mouse_y, duration); - - println!("cursor {:?} select {:?}", self.cursor, self.select_opt); + log::trace!("click({}, {}): {:?}", mouse_x, mouse_y, duration); } /// Draw the buffer