| 91 | const PX_PT: f32 = Self::PX_IN / 72.0; |
| 92 | |
| 93 | pub fn to_px(&self) -> Option<f32> { |
| 94 | match self { |
| 95 | Self::Zero(_) => Some(0.0), |
| 96 | Self::Cm(d) => Some(Into::<f32>::into(*d) * Self::PX_CM), |
| 97 | Self::Mm(d) => Some(Into::<f32>::into(*d) * Self::PX_MM), |
| 98 | Self::Q(d) => Some(Into::<f32>::into(*d) * Self::PX_Q), |
| 99 | Self::In(d) => Some(Into::<f32>::into(*d) * Self::PX_IN), |
| 100 | Self::Pc(d) => Some(Into::<f32>::into(*d) * Self::PX_PC), |
| 101 | Self::Pt(d) => Some(Into::<f32>::into(*d) * Self::PX_PT), |
| 102 | _ => None, |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | impl From<Length> for f32 { |