cleanup
This commit is contained in:
parent
b41388c3ed
commit
251785db67
|
@ -101,7 +101,7 @@ impl CanvasRenderingContext2D {
|
||||||
pub fn measure_text(&self, string: &str) -> TextMetrics {
|
pub fn measure_text(&self, string: &str) -> TextMetrics {
|
||||||
TextMetrics { width: self.layout_text(string).width() }
|
TextMetrics { width: self.layout_text(string).width() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fill_layout(&mut self, layout: &Layout, transform: Transform2DF) {
|
pub fn fill_layout(&mut self, layout: &Layout, transform: Transform2DF) {
|
||||||
let paint_id = self.scene.push_paint(&self.current_state.fill_paint);
|
let paint_id = self.scene.push_paint(&self.current_state.fill_paint);
|
||||||
drop(self.scene.push_layout(&layout,
|
drop(self.scene.push_layout(&layout,
|
||||||
|
@ -124,7 +124,7 @@ impl CanvasRenderingContext2D {
|
||||||
TextAlign::Right => position.set_x(position.x() - layout.width()),
|
TextAlign::Right => position.set_x(position.x() - layout.width()),
|
||||||
TextAlign::Center => position.set_x(position.x() - layout.width() * 0.5),
|
TextAlign::Center => position.set_x(position.x() - layout.width() * 0.5),
|
||||||
}
|
}
|
||||||
|
|
||||||
let transform = Transform2DF::from_translation(position).post_mul(&self.current_state
|
let transform = Transform2DF::from_translation(position).post_mul(&self.current_state
|
||||||
.transform);
|
.transform);
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ impl CanvasRenderingContext2D {
|
||||||
paint_id));
|
paint_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layout_text(&self, string: &str) -> Layout {
|
fn layout_text(&self, string: &str) -> Layout {
|
||||||
skribo::layout(&TextStyle { size: self.current_state.font_size },
|
skribo::layout(&TextStyle { size: self.current_state.font_size },
|
||||||
&self.current_state.font_collection,
|
&self.current_state.font_collection,
|
||||||
string)
|
string)
|
||||||
|
|
Loading…
Reference in New Issue