Add more unifont symbols

This commit is contained in:
Joscha 2024-03-09 19:01:14 +01:00
parent 757b401b2d
commit bd069e8f26
4 changed files with 6 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1,3 +1,5 @@
pub const UNIFONT: &[u8] = include_bytes!("../data/unifont-15.1.05.otf");
pub const UNIFONT_JP: &[u8] = include_bytes!("../data/unifont_jp-15.1.05.otf");
pub const UNIFONT_UPPER: &[u8] = include_bytes!("../data/unifont_upper-15.1.05.otf");
pub const UNIFONT_NAME: &str = "Unifont";
pub const UNIFONT_SIZE: f32 = 16.0;

View file

@ -1,6 +1,6 @@
use cosmic_text::{Attrs, AttrsOwned, Buffer, Family, FontSystem, Metrics, Shaping, SwashCache};
use palette::Srgba;
use showbits_assets::{UNIFONT, UNIFONT_NAME, UNIFONT_SIZE};
use showbits_assets::{UNIFONT, UNIFONT_JP, UNIFONT_NAME, UNIFONT_SIZE, UNIFONT_UPPER};
use taffy::{
prelude::{AvailableSpace, Size},
Layout,
@ -20,6 +20,8 @@ impl FontStuff {
let mut font_system = FontSystem::new();
let db = font_system.db_mut();
db.load_font_data(UNIFONT.to_vec());
db.load_font_data(UNIFONT_JP.to_vec());
db.load_font_data(UNIFONT_UPPER.to_vec());
db.set_monospace_family(UNIFONT_NAME);
Self {
@ -61,7 +63,7 @@ impl Text {
metrics: Self::default_metrics(),
default_attrs: AttrsOwned::new(Self::default_attrs()),
chunks: vec![],
shaping: Shaping::Basic,
shaping: Shaping::Advanced,
color: color::BLACK,
}
}