Move pooling of line wrappers into FontCache

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-08-25 17:28:25 +02:00
co-authored by Nathan Sobo
parent 0c9e72cce7
commit 1aa1e6c6ab
5 changed files with 65 additions and 60 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ use crate::{
vector::{vec2f, Vector2F},
},
json::{ToJson, Value},
text_layout::{Line, LineWrapper, ShapedBoundary},
text_layout::{Line, ShapedBoundary},
DebugContext, Element, Event, EventContext, LayoutContext, PaintContext, SizeConstraint,
};
use serde_json::json;
@@ -60,7 +60,7 @@ impl Element for Text {
.unwrap();
let line_height = cx.font_cache.line_height(font_id, self.font_size);
let mut wrapper = LineWrapper::acquire(font_id, self.font_size, cx.font_system.clone());
let mut wrapper = cx.font_cache.line_wrapper(font_id, self.font_size);
let mut lines = Vec::new();
let mut line_count = 0;
let mut max_line_width = 0_f32;