diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-12-15 11:11:57 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-12-15 11:11:57 +0100 |
| commit | ae38be9097bbb32142ef776e77e627ac12379000 (patch) | |
| tree | f365a348d4c77d2d607d37fee3bc65a601d00a64 /src/frame.rs | |
| parent | fe21c4d399d291e75165b664762f0aa8bdc4724a (diff) | |
Set Rules Episode IV: A New Fold
Diffstat (limited to 'src/frame.rs')
| -rw-r--r-- | src/frame.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/frame.rs b/src/frame.rs index 29125962..46f23446 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -107,6 +107,11 @@ impl Frame { wrapper.push(Point::zero(), Element::Group(group)); *self = wrapper; } + + /// Link the whole frame to a resource. + pub fn link(&mut self, url: impl Into<String>) { + self.push(Point::zero(), Element::Link(url.into(), self.size)); + } } impl Debug for Frame { @@ -180,7 +185,7 @@ pub struct Text { impl Text { /// The width of the text run. pub fn width(&self) -> Length { - self.glyphs.iter().map(|g| g.x_advance.to_length(self.size)).sum() + self.glyphs.iter().map(|g| g.x_advance.resolve(self.size)).sum() } } |
