fonts: Use IpcSharedMemory to send font data (#33530)

This changes modifes the way that font data is sent over IPC channels.
Instead of serializing the data or sending it via IPC byte senders, font
data is copied into shared memory and a copy of the handle is sent over
the channel.

There is also the idea of sending the file handle of the on disk data of
system fonts. This could be implemented as a further followup once there
is an abstraction in `ipc-channel` over file handles.

To accomplish this, a `FontData` abstraction is added, which also allows
caching an in-memory shared `Arc<Vec<u8>>` version of the data (neeeded
by some APIs). This could also be a place for caching font tables in the
future.

Finally, the `FontCacheThread` is renamed to the `SystemFontService`
while the proxy for this is now named `SystemFontServiceProxy`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Martin Robinson 2024-09-25 09:31:55 +02:00 committed by GitHub
parent 2c6d9a190f
commit ade902207f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 601 additions and 544 deletions

View file

@ -5,7 +5,6 @@
#![deny(unsafe_code)]
mod font;
mod font_cache_thread;
mod font_context;
mod font_store;
mod font_template;
@ -13,14 +12,15 @@ mod glyph;
#[allow(unsafe_code)]
pub mod platform;
mod shaper;
mod system_font_service;
pub use font::*;
pub use font_cache_thread::*;
pub use font_context::*;
pub use font_store::*;
pub use font_template::*;
pub use glyph::*;
pub use shaper::*;
pub use system_font_service::*;
use unicode_properties::{emoji, EmojiStatus, UnicodeEmoji};
/// Whether or not font fallback selection prefers the emoji or text representation