mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 14:36:16 +02:00
✨ Add label to wasm renderer
This commit is contained in:
parent
0325d43e96
commit
8c310e6e5c
2 changed files with 23 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue