impl AsRef<[u8]> for FontData (#5757)

* [x] I have followed the instructions in the PR template

This PR implements `AsRef<[u8]>` for `FontData`, allowing it to be
passed into `fontdb`'s
[`Source`](https://docs.rs/fontdb/0.16.2/fontdb/enum.Source.html) type.
This would allow `egui` and `cosmic_text` to share font data with
eachother
This commit is contained in:
StratusFearMe21 2025-03-20 04:03:17 -06:00 committed by GitHub
parent 1545dec7a8
commit 52732b23a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -144,6 +144,12 @@ impl FontData {
}
}
impl AsRef<[u8]> for FontData {
fn as_ref(&self) -> &[u8] {
self.font.as_ref()
}
}
// ----------------------------------------------------------------------------
/// Extra scale and vertical tweak to apply to all text of a certain font.