mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
✨ Add label to wasm renderer
This commit is contained in:
@@ -23,6 +23,9 @@ use options::RenderOptions;
|
||||
pub use blend::BlendMode;
|
||||
pub use images::*;
|
||||
|
||||
const DEFAULT_FONT_BYTES: &[u8] =
|
||||
include_bytes!("../../frontend/resources/fonts/RobotoMono-Regular.ttf");
|
||||
|
||||
pub(crate) struct RenderState {
|
||||
gpu_state: GpuState,
|
||||
options: RenderOptions,
|
||||
@@ -58,7 +61,7 @@ impl RenderState {
|
||||
|
||||
let mut font_provider = skia::textlayout::TypefaceFontProvider::new();
|
||||
let default_font = skia::FontMgr::default()
|
||||
.new_from_data(include_bytes!("fonts/RobotoMono-Regular.ttf"), None)
|
||||
.new_from_data(DEFAULT_FONT_BYTES, None)
|
||||
.expect("Failed to load font");
|
||||
font_provider.register_typeface(default_font, "robotomono-regular");
|
||||
|
||||
@@ -289,6 +292,8 @@ impl RenderState {
|
||||
self.render_debug();
|
||||
}
|
||||
|
||||
debug::render_wasm_label(self);
|
||||
|
||||
self.flush();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user