Merge remote-tracking branch 'origin/main' into cache

# Conflicts:
#	crates/gpui/src/window.rs
This commit is contained in:
Antonio Scandurra 2024-01-12 14:31:13 +01:00
commit 94293b3bf9
73 changed files with 2531 additions and 1824 deletions

View file

@ -65,6 +65,9 @@ impl TextSystem {
}
}
pub fn all_font_families(&self) -> Vec<String> {
self.platform_text_system.all_font_families()
}
pub fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> Result<()> {
self.platform_text_system.add_fonts(fonts)
}
@ -368,28 +371,20 @@ impl TextSystem {
self.line_layout_cache.finish_frame(reused_views)
}
pub fn line_wrapper(
self: &Arc<Self>,
font: Font,
font_size: Pixels,
) -> Result<LineWrapperHandle> {
pub fn line_wrapper(self: &Arc<Self>, font: Font, font_size: Pixels) -> LineWrapperHandle {
let lock = &mut self.wrapper_pool.lock();
let font_id = self.font_id(&font)?;
let font_id = self.resolve_font(&font);
let wrappers = lock
.entry(FontIdWithSize { font_id, font_size })
.or_default();
let wrapper = wrappers.pop().map(anyhow::Ok).unwrap_or_else(|| {
Ok(LineWrapper::new(
font_id,
font_size,
self.platform_text_system.clone(),
))
})?;
let wrapper = wrappers.pop().unwrap_or_else(|| {
LineWrapper::new(font_id, font_size, self.platform_text_system.clone())
});
Ok(LineWrapperHandle {
LineWrapperHandle {
wrapper: Some(wrapper),
text_system: self.clone(),
})
}
}
pub fn raster_bounds(&self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {