mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 03:31:38 +02:00
✨ Load emoji font dynamically when initializing
This commit is contained in:
parent
56ecacee21
commit
2306df5fb7
6 changed files with 80 additions and 48 deletions
|
@ -6,14 +6,24 @@ use crate::STATE;
|
|||
use crate::shapes::FontFamily;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn store_font(a: u32, b: u32, c: u32, d: u32, weight: u32, style: u8) {
|
||||
pub extern "C" fn store_font(
|
||||
a: u32,
|
||||
b: u32,
|
||||
c: u32,
|
||||
d: u32,
|
||||
weight: u32,
|
||||
style: u8,
|
||||
is_emoji: bool,
|
||||
) {
|
||||
with_state!(state, {
|
||||
let id = uuid_from_u32_quartet(a, b, c, d);
|
||||
let font_bytes = mem::bytes();
|
||||
|
||||
let family = FontFamily::new(id, weight, style.into());
|
||||
let res = state
|
||||
.render_state()
|
||||
.fonts_mut()
|
||||
.add(family, &font_bytes, is_emoji);
|
||||
|
||||
let res = state.render_state().fonts_mut().add(family, &font_bytes);
|
||||
match res {
|
||||
Err(msg) => {
|
||||
eprintln!("{}", msg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue