summaryrefslogtreecommitdiff
path: root/src/geom
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-25 20:48:38 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-25 20:48:38 +0100
commitb0f4b13f6d4a1fe7742707d08e11ba03f3542b58 (patch)
tree13704c92d6e9f2b85f487533c2f0d1ca7cf58d84 /src/geom
parentefde5cac88078f10485f715be66a27efba2f23d8 (diff)
Basic justification
Diffstat (limited to 'src/geom')
-rw-r--r--src/geom/em.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/geom/em.rs b/src/geom/em.rs
index af6be706..b9f1d897 100644
--- a/src/geom/em.rs
+++ b/src/geom/em.rs
@@ -27,6 +27,11 @@ impl Em {
Self(Scalar(units.into() / units_per_em))
}
+ /// Create an em length from a length at the given font size.
+ pub fn from_length(length: Length, font_size: Length) -> Self {
+ Self(Scalar(length / font_size))
+ }
+
/// Convert to a length at the given font size.
pub fn resolve(self, font_size: Length) -> Length {
self.get() * font_size