diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-23 13:18:20 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-23 13:21:44 +0200 |
| commit | 0806af4aecc9414962b13894a2a3c4befd2ca3c8 (patch) | |
| tree | 0267109894f9cf4b74fe2663a2e29cf589d75b44 /src/layout/frame.rs | |
| parent | c0377de653ed7c0ae0e253724cbbb622125fbd3f (diff) | |
Kerned PDF output
Diffstat (limited to 'src/layout/frame.rs')
| -rw-r--r-- | src/layout/frame.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/layout/frame.rs b/src/layout/frame.rs index 0c307dd4..e52e2751 100644 --- a/src/layout/frame.rs +++ b/src/layout/frame.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; use super::{Constrained, Constraints}; use crate::color::Color; use crate::font::FaceId; -use crate::geom::{Length, Path, Point, Size}; +use crate::geom::{Em, Length, Path, Point, Size}; use crate::image::ImageId; /// A finished layout with elements at fixed positions. @@ -130,27 +130,15 @@ pub struct Text { pub glyphs: Vec<Glyph>, } -impl Text { - /// Encode the glyph ids into a big-endian byte buffer. - pub fn encode_glyphs_be(&self) -> Vec<u8> { - let mut bytes = Vec::with_capacity(2 * self.glyphs.len()); - for glyph in &self.glyphs { - bytes.push((glyph.id >> 8) as u8); - bytes.push((glyph.id & 0xff) as u8); - } - bytes - } -} - /// A glyph in a run of shaped text. #[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)] pub struct Glyph { /// The glyph's index in the face. pub id: u16, /// The advance width of the glyph. - pub x_advance: Length, + pub x_advance: Em, /// The horizontal offset of the glyph. - pub x_offset: Length, + pub x_offset: Em, } /// A geometric shape. |
