summaryrefslogtreecommitdiff
path: root/src/size.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-06-22 12:51:06 +0200
committerLaurenz <laurmaedje@gmail.com>2019-06-22 12:51:06 +0200
commitc7ee2b393a369325b3578557e045f2ff94ceab8f (patch)
tree063e371b764b119e378644817cc556c397ebd9dd /src/size.rs
parentf6fe3b5cdd2805f3975985752f9cb0e04e3daf49 (diff)
Fix top-left text alignment 📐
Diffstat (limited to 'src/size.rs')
-rw-r--r--src/size.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/size.rs b/src/size.rs
index e1f54a4f..674abdb5 100644
--- a/src/size.rs
+++ b/src/size.rs
@@ -42,11 +42,7 @@ impl Size {
/// Create a size from an amount of points.
#[inline]
- pub fn points(points: f32) -> Size { Size { points } }
-
- /// Create a size from an amount of inches.
- #[inline]
- pub fn inches(inches: f32) -> Size { Size { points: 72.0 * inches } }
+ pub fn pt(points: f32) -> Size { Size { points } }
/// Create a size from an amount of millimeters.
#[inline]
@@ -56,13 +52,13 @@ impl Size {
#[inline]
pub fn cm(cm: f32) -> Size { Size { points: 28.3465 * cm } }
- /// Convert this size into points.
+ /// Create a size from an amount of inches.
#[inline]
- pub fn to_points(&self) -> f32 { self.points }
+ pub fn inches(inches: f32) -> Size { Size { points: 72.0 * inches } }
- /// Convert this size into inches.
+ /// Convert this size into points.
#[inline]
- pub fn to_inches(&self) -> f32 { self.points * 0.0138889 }
+ pub fn to_pt(&self) -> f32 { self.points }
/// Convert this size into millimeters.
#[inline]
@@ -71,6 +67,10 @@ impl Size {
/// Convert this size into centimeters.
#[inline]
pub fn to_cm(&self) -> f32 { self.points * 0.0352778 }
+
+ /// Convert this size into inches.
+ #[inline]
+ pub fn to_inches(&self) -> f32 { self.points * 0.0138889 }
}
impl Size2D {