mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Add support for embedding bitmap fonts in C++
This commit is contained in:
parent
49b3e15bc8
commit
917cecff85
4 changed files with 141 additions and 8 deletions
|
@ -155,6 +155,7 @@ fn gen_corelib(
|
|||
"PointerEvent",
|
||||
"Rect",
|
||||
"SortOrder",
|
||||
"BitmapFont",
|
||||
]
|
||||
.iter()
|
||||
.chain(items.iter())
|
||||
|
|
|
@ -261,6 +261,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/// Registers a bitmap font for use with the software renderer.
|
||||
inline void register_bitmap_font(const cbindgen_private::BitmapFont &font)
|
||||
{
|
||||
cbindgen_private::slint_register_bitmap_font(&inner, &font);
|
||||
}
|
||||
|
||||
/// \private
|
||||
const cbindgen_private::WindowAdapterRcOpaque &handle() const { return inner; }
|
||||
|
||||
|
@ -715,12 +721,18 @@ public:
|
|||
|
||||
/// \private
|
||||
/// Internal function called by the view to register itself
|
||||
void attach_peer(private_api::ModelPeer p) { peers.push_back(std::move(p)); }
|
||||
void attach_peer(private_api::ModelPeer p)
|
||||
{
|
||||
peers.push_back(std::move(p));
|
||||
}
|
||||
|
||||
/// \private
|
||||
/// Internal function called from within bindings to register with the currently
|
||||
/// evaluating dependency and get notified when this model's row count changes.
|
||||
void track_row_count_changes() const { model_row_count_dirty_property.get(); }
|
||||
void track_row_count_changes() const
|
||||
{
|
||||
model_row_count_dirty_property.get();
|
||||
}
|
||||
|
||||
/// \private
|
||||
/// Internal function called from within bindings to register with the currently
|
||||
|
|
|
@ -122,6 +122,15 @@ pub unsafe extern "C" fn slint_register_font_from_data(
|
|||
)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_register_bitmap_font(
|
||||
win: *const WindowAdapterRcOpaque,
|
||||
font_data: &'static i_slint_core::graphics::BitmapFont,
|
||||
) {
|
||||
let window_adapter = &*(win as *const Rc<dyn WindowAdapter>);
|
||||
window_adapter.renderer().register_bitmap_font(font_data);
|
||||
}
|
||||
|
||||
#[cfg(feature = "testing")]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_testing_init_backend() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue