mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
Add support for embedding data in generated C++ code
This allows compiling with SIXTYFPS_EMBED_RESOURCES=true and images/fonts are embedded as inline variables. Generated data is emitted into the header file as inline uint8_t sfps_embedded_resources_123[789] = { 0x1, 0x2, 0x3, };
This commit is contained in:
parent
30e79d3ea2
commit
c91a38cdce
4 changed files with 101 additions and 5 deletions
|
@ -81,6 +81,20 @@ pub unsafe extern "C" fn sixtyfps_register_font_from_path(
|
|||
)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_register_font_from_data(
|
||||
data: sixtyfps_corelib::slice::Slice<'static, u8>,
|
||||
error_str: *mut sixtyfps_corelib::SharedString,
|
||||
) {
|
||||
core::ptr::write(
|
||||
error_str,
|
||||
match crate::backend().register_font_from_memory(data.as_slice()) {
|
||||
Ok(()) => Default::default(),
|
||||
Err(err) => err.to_string().into(),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(feature = "testing")]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_testing_init_backend() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue