summaryrefslogtreecommitdiff
path: root/src/layout/text.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-10-13 13:10:21 +0200
committerLaurenz <laurmaedje@gmail.com>2019-10-13 13:10:21 +0200
commit7c0899b5373cdc4f1083a0a8515856207c431423 (patch)
treeee1ecade4022f1fa3f666feb55097f7bdcae69ed /src/layout/text.rs
parent5c04185892947969005ffcf6412d7190dafb3a79 (diff)
Run rustfmt 🚿
Diffstat (limited to 'src/layout/text.rs')
-rw-r--r--src/layout/text.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/layout/text.rs b/src/layout/text.rs
index cf258029..27b65d56 100644
--- a/src/layout/text.rs
+++ b/src/layout/text.rs
@@ -1,9 +1,8 @@
use toddle::query::{FontQuery, SharedFontLoader};
-use toddle::tables::{Header, CharMap, HorizontalMetrics};
+use toddle::tables::{CharMap, Header, HorizontalMetrics};
-use crate::size::{Size, Size2D};
use super::*;
-
+use crate::size::{Size, Size2D};
/// The context for text layouting.
#[derive(Copy, Clone)]
@@ -53,7 +52,8 @@ pub fn layout_text(text: &str, ctx: TextContext) -> LayoutResult<Layout> {
let font_unit_to_size = |x| Size::pt(font_unit_ratio * x);
// Add the char width to the total box width.
- let glyph = font.read_table::<CharMap>()?
+ let glyph = font
+ .read_table::<CharMap>()?
.get(character)
.expect("layout text: font should have char");
@@ -61,7 +61,7 @@ pub fn layout_text(text: &str, ctx: TextContext) -> LayoutResult<Layout> {
font.read_table::<HorizontalMetrics>()?
.get(glyph)
.expect("layout text: font should have glyph")
- .advance_width as f32
+ .advance_width as f32,
);
let char_width = glyph_width * ctx.style.font_size;