-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
DynamicFontTableProvider is not Send + Sync despite all current implementations of FontTableProvider being Send + Sync. This limits the user of the crate as Font<DynamicFontTableProvider> is also not Send + Sync so it can't easily be used in multi-threaded applications, without an unsafe impl. Because it is not Send, it cannot be made Sync with a Mutex either.
Suggested Fix
This is the current implementation:
pub struct DynamicFontTableProvider<'a> {
sfnt_version: u32,
provider: Box<dyn FontTableProvider + 'a>,
}And this is my suggested fix:
pub struct DynamicFontTableProvider<'a> {
sfnt_version: u32,
provider: Box<dyn FontTableProvider + Send + Sync + 'a>,
}Potential Downsides
Perhaps in the future there could be a FontTableProvider that isn't Send + Sync, in which case the DynamicFontTableProvider can't be used. Perhaps functions returning DynamicFontTableProvider, like FontData::table_provider could instead return a Send + Sync wrapper.
Metadata
Metadata
Assignees
Labels
No labels