Skip to content

Commit

Permalink
use noto sans font
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Sep 15, 2024
1 parent 9430e7a commit a903e64
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Binary file added wasm/unavi-ui/NotoSans-Regular.ttf
Binary file not shown.
Binary file removed wasm/unavi-ui/Roboto-Regular.ttf
Binary file not shown.
6 changes: 4 additions & 2 deletions wasm/unavi-ui/src/text/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ use crate::bindings::{
wired::scene::mesh::Mesh,
};

const FONT: &[u8] = include_bytes!("../../Roboto-Regular.ttf");
const FONT: &[u8] = include_bytes!("../../NotoSans-Regular.ttf");

#[derive(Clone)]
pub struct Text(Rc<TextData>);

struct TextData {
font_size: Cell<f32>,
generator: RefCell<MeshGenerator<OwnedFace>>,
line_padding: Cell<f32>,
mesh: Mesh,
text: RefCell<String>,
thickness: Cell<f32>,
Expand Down Expand Up @@ -54,7 +55,7 @@ impl Text {
self.0.mesh.remove_primitive(primitive);
}

let line_padding = 1.25;
let line_padding = self.0.line_padding.get();
let mut total_line_height = 0.0;

for (i, mut data) in self
Expand Down Expand Up @@ -94,6 +95,7 @@ impl GuestText for Text {
let text = Self(Rc::new(TextData {
font_size: Cell::new(0.25),
generator: RefCell::new(MeshGenerator::new(FONT.to_owned())),
line_padding: Cell::new(1.15),
mesh,
text: RefCell::new(text),
thickness: Cell::default(),
Expand Down

0 comments on commit a903e64

Please sign in to comment.