diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-11-20 16:36:22 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-11-20 16:36:22 +0100 |
| commit | f105663037c44740b5aa02dea72a9b368bc003e0 (patch) | |
| tree | ee97638bfba2be3cfba8c1191919447262f181d0 /src/export | |
| parent | 2e6e6244ccf73795d7d74cbc286fb0b43b404315 (diff) | |
Basic image support 🖼
- [image] function
- Image rendering in tests
- Supports JPEG and PNG
- No PDF export so far
Diffstat (limited to 'src/export')
| -rw-r--r-- | src/export/pdf.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/export/pdf.rs b/src/export/pdf.rs index 763cea8a..cb05dee0 100644 --- a/src/export/pdf.rs +++ b/src/export/pdf.rs @@ -148,6 +148,10 @@ impl<'a> PdfExporter<'a> { text = text.tm(1.0, 0.0, 0.0, 1.0, x as f32, y as f32); text = text.tj(&shaped.encode_glyphs_be()); } + + LayoutElement::Image(_image) => { + // TODO: Write image. + } } } @@ -280,12 +284,13 @@ fn remap_fonts(layouts: &[BoxLayout]) -> (HashMap<FaceId, usize>, Vec<FaceId>) { // each text element to find out which face is uses. for layout in layouts { for (_, element) in &layout.elements { - let LayoutElement::Text(shaped) = element; - to_pdf.entry(shaped.face).or_insert_with(|| { - let next_id = to_layout.len(); - to_layout.push(shaped.face); - next_id - }); + if let LayoutElement::Text(shaped) = element { + to_pdf.entry(shaped.face).or_insert_with(|| { + let next_id = to_layout.len(); + to_layout.push(shaped.face); + next_id + }); + } } } |
