mirror of
https://github.com/typst/typst
synced 2025-08-20 17:58:32 +08:00
Safer conversion from Length
to Em
This commit is contained in:
parent
05f276c933
commit
b1d9519fe7
@ -77,8 +77,8 @@ impl Length {
|
||||
}
|
||||
|
||||
/// Expresses this length in em's of the provided outer text size.
|
||||
pub fn to_em(&self, text_size: Abs) -> Em {
|
||||
self.em + Em::new(self.abs / text_size)
|
||||
pub fn to_em(&self, font_size: Abs) -> Em {
|
||||
self.em + Em::from_length(self.abs, font_size)
|
||||
}
|
||||
|
||||
/// Fails with an error if the length has a non-zero font-relative part.
|
||||
|
Loading…
x
Reference in New Issue
Block a user