Paginated document layout engine: format-neutral page-model IR with SVG/PDF backends.
Dependencies
///|
test "build a one-page model" {
let model = @pagelayout.PageModel::new()
let font = model.add_font({ family: "Carlito", bold: false, italic: false, })
let page = @pagelayout.Page::{ width_pt: 612, height_pt: 792, items: [], }
page.items.push(
Text({
font,
size_pt: 12,
x_pt: 72,
baseline_pt: 82.5,
text: "Hi",
advances_pt: [6.5, 6.5],
color: @pagelayout.black,
}),
)
model.pages.push(page)
inspect(model.pages.length(), content="1")
}///|
test "unit conversions" {
inspect(@pagelayout.Twips(1440).to_pt(), content="72")
inspect(@pagelayout.HalfPoints(24).to_pt(), content="12")
inspect(@pagelayout.Emu(914400).to_pt(), content="72")
inspect(@pagelayout.EighthPoints(4).to_pt(), content="0.5")
}#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn EighthPoints::equal(EighthPoints, EighthPoints) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn EighthPoints::not_equal(x : EighthPoints, y : EighthPoints) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn EighthPoints::to_json(EighthPoints) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn EighthPoints::to_repr(EighthPoints) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn HalfPoints::equal(HalfPoints, HalfPoints) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn HalfPoints::not_equal(x : HalfPoints, y : HalfPoints) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn HalfPoints::to_json(HalfPoints) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn HalfPoints::to_repr(HalfPoints) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn LinkRegion::equal(LinkRegion, LinkRegion) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn LinkRegion::not_equal(x : LinkRegion, y : LinkRegion) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn LinkRegion::to_json(LinkRegion) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn LinkRegion::to_repr(LinkRegion) -> ReprInstall
Download zipPaginated document layout engine: format-neutral page-model IR with SVG/PDF backends.
Dependencies