Files
adminandClaude Opus 5.5 a45e8b2382 Restore Riposte from the copy installed in ReaderJS
The GitHub repository (github.com/Alpaq92/Riposte) is gone with the suspended
account. These are the files npm installed for ReaderJS from commit
307ef7dfd9c5e8c0c07a840874e013cf94a85ada, so this is that commit's packaged content, without its history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:26:53 +01:00

22 lines
724 B
JavaScript

// engine/graphics/render.js
// Run a PostScript program against a Driver. Sets the base CTM that maps
// PostScript's y-up, bottom-left user space to the device's y-down, top-left
// space (the Y-flip), scaled by `scale`.
import { VM } from '../vm.js';
import { SVGDriver } from './svg-driver.js';
export function renderToDriver(src, driver, { width = 612, height = 792, scale = 1, out } = {}) {
const vm = new VM({ driver, out });
vm.gstate.ctm = [scale, 0, 0, -scale, 0, height];
driver.beginPage(width, height);
vm.runString(src);
driver.endPage();
return vm;
}
export function renderToSVG(src, opts = {}) {
const driver = new SVGDriver();
renderToDriver(src, driver, opts);
return driver.toSVG();
}