Remove Mutex from FontSystem
This commit is contained in:
parent
46e9ef0246
commit
384c5c1fdc
16 changed files with 109 additions and 96 deletions
|
|
@ -139,7 +139,10 @@ impl Application for Window {
|
|||
.family(cosmic_text::Family::Monospace);
|
||||
|
||||
let mut editor = SyntaxEditor::new(
|
||||
Buffer::new(&FONT_SYSTEM.lock().unwrap(), FontSize::Body.to_metrics()),
|
||||
Buffer::new(
|
||||
&mut FONT_SYSTEM.lock().unwrap(),
|
||||
FontSize::Body.to_metrics(),
|
||||
),
|
||||
&SYNTAX_SYSTEM,
|
||||
"base16-eighties.dark",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl Text {
|
|||
let mut line = BufferLine::new(string, AttrsList::new(Attrs::new()));
|
||||
|
||||
//TODO: do we have to immediately shape?
|
||||
line.shape(&FONT_SYSTEM.lock().unwrap());
|
||||
line.shape(&mut FONT_SYSTEM.lock().unwrap());
|
||||
|
||||
let text = Self {
|
||||
line,
|
||||
|
|
@ -186,7 +186,7 @@ where
|
|||
};
|
||||
|
||||
cache.with_pixels(
|
||||
&FONT_SYSTEM.lock().unwrap(),
|
||||
&mut FONT_SYSTEM.lock().unwrap(),
|
||||
cache_key,
|
||||
glyph_color,
|
||||
|pixel_x, pixel_y, color| {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ fn main() {
|
|||
let line_x = 8.0 * display_scale;
|
||||
|
||||
let mut editor = SyntaxEditor::new(
|
||||
Buffer::new(&font_system, font_sizes[font_size_i]),
|
||||
Buffer::new(&mut font_system, font_sizes[font_size_i]),
|
||||
&syntax_system,
|
||||
"base16-eighties.dark",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ fn main() {
|
|||
];
|
||||
let font_size_default = 1; // Body
|
||||
|
||||
let mut buffer = Buffer::new(&font_system, font_sizes[font_size_default]);
|
||||
let mut buffer = Buffer::new(&mut font_system, font_sizes[font_size_default]);
|
||||
buffer
|
||||
.borrow_with(&mut font_system)
|
||||
.set_size(window.width() as f32, window.height() as f32);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ fn main() {
|
|||
.unwrap();
|
||||
|
||||
let mut editor = Editor::new(Buffer::new(
|
||||
&font_system,
|
||||
&mut font_system,
|
||||
Metrics::new(32.0, 44.0).scale(display_scale),
|
||||
));
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ fn main() {
|
|||
let metrics = Metrics::new(14.0, 20.0);
|
||||
|
||||
// A Buffer provides shaping and layout for a UTF-8 string, create one per text widget
|
||||
let mut buffer = Buffer::new(&font_system, metrics);
|
||||
let mut buffer = Buffer::new(&mut font_system, metrics);
|
||||
|
||||
let mut buffer = buffer.borrow_with(&mut font_system);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue