graphitepdf-primitives 0.1.0

Primitive element type constants and shared foundational types for graphitepdf.
Documentation
  • Coverage
  • 0%
    0 out of 48 items documented0 out of 0 items with examples
  • Size
  • Source code size: 8.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 716.43 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • admirsaheta/graphite-pdf
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • admirsaheta

Overview

graphitepdf-primitives provides the common low-level vocabulary used by higher-level GraphitePDF crates without pulling in layout or PDF-specific policy.


Scope

graphitepdf-primitives contains:

  • document element tags such as Document, Page, View, and Text
  • geometry types such as Bounds, Point, and Size
  • basic units and color types such as Pt and Color

Installation

cargo add graphitepdf-primitives

API Summary

Category Items
Element tags Document, Page, View, Text
Geometry Bounds, Point, Size
Units and color Pt, Color

Example

use graphitepdf_primitives::{Bounds, Color, Document, Page, Point, Pt, Size, Text, View};

fn main() {
    assert_eq!(Document, "DOCUMENT");
    assert_eq!(Page, "PAGE");
    assert_eq!(View, "VIEW");
    assert_eq!(Text, "TEXT");

    let origin = Point::new(0.0, 0.0);
    let page_size = Size::new(595.0, 842.0);
    let bounds = Bounds::new(origin, page_size);
    let accent = Color::rgb(212, 88, 26);
    let font_size = Pt::new(12.0);

    assert_eq!(bounds.size.width, 595.0);
    assert_eq!(accent.red, 212);
    assert_eq!(font_size.value(), 12.0);
}

Design Principles

  • keep foundational APIs renderer-agnostic
  • expose explicit data structures over implicit conversions
  • avoid unnecessary dependencies
  • make shared document and layout types easy to reuse

Role In GraphitePDF

This crate sits at the base of the GraphitePDF stack and gives downstream crates a stable set of shared low-level types.


License

MIT