Allow configuration of default font
This commit is contained in:
parent
e1062a02d1
commit
d96ced8e2d
8 changed files with 39 additions and 14 deletions
|
|
@ -22,13 +22,16 @@ pub struct Pipeline {
|
|||
}
|
||||
|
||||
impl Pipeline {
|
||||
pub fn new(device: &mut wgpu::Device) -> Self {
|
||||
pub fn new(device: &mut wgpu::Device, default_font: Option<&[u8]>) -> Self {
|
||||
// TODO: Font customization
|
||||
let font_source = font::Source::new();
|
||||
|
||||
let default_font = font_source
|
||||
.load(&[font::Family::SansSerif, font::Family::Serif])
|
||||
.unwrap_or_else(|_| FALLBACK_FONT.to_vec());
|
||||
let default_font =
|
||||
default_font.map(|slice| slice.to_vec()).unwrap_or_else(|| {
|
||||
font_source
|
||||
.load(&[font::Family::SansSerif, font::Family::Serif])
|
||||
.unwrap_or_else(|_| FALLBACK_FONT.to_vec())
|
||||
});
|
||||
|
||||
let load_glyph_brush = |font: Vec<u8>| {
|
||||
let builder =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue