Switch to persistent printer with queue
This commit is contained in:
parent
0ea4cf1d22
commit
6555e9c0bd
14 changed files with 221 additions and 76 deletions
|
|
@ -1,25 +1,25 @@
|
|||
use showbits_common::{Node, Tree, WidgetExt, color::WHITE, widgets::Typst};
|
||||
use taffy::style_helpers::percent;
|
||||
use taffy::{prelude::length, style_helpers::percent};
|
||||
|
||||
use crate::printer::Printer;
|
||||
use crate::persistent_printer::PersistentPrinter;
|
||||
|
||||
use super::{Context, Drawing};
|
||||
use super::{Context, Drawing, FEED};
|
||||
|
||||
pub struct TypstDrawing(pub String);
|
||||
|
||||
impl Drawing for TypstDrawing {
|
||||
fn draw(&self, printer: &mut Printer, ctx: &mut Context) -> anyhow::Result<()> {
|
||||
fn draw(&self, printer: &mut PersistentPrinter, ctx: &mut Context) -> anyhow::Result<()> {
|
||||
let mut tree = Tree::<Context>::new(WHITE);
|
||||
|
||||
let typst = Typst::new(self.0.clone()).node().register(&mut tree)?;
|
||||
|
||||
let root = Node::empty()
|
||||
.with_size_width(percent(1.0))
|
||||
.with_padding_bottom(length(FEED))
|
||||
.and_child(typst)
|
||||
.register(&mut tree)?;
|
||||
|
||||
printer.print_tree(&mut tree, ctx, root)?;
|
||||
printer.feed()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue