Reading this from Packagist? This repository publishes twice. The TypeScript engine below is the npm package. What Composer installs is
coolms/document-fonts: the 24 font files inassets/fontsand the manifest that names them, with no PHP and no autoloader. It exists so a PHP application can reach the same fonts, from the same version, without a Node toolchain. If you are looking for a document layout library for PHP, this is not one.
Framework-agnostic vanilla TypeScript document layout engine: OOXML model, deterministic text measurement from font files, and pagination with reflow. Zero runtime dependencies — the arithmetic is ours, so the browser and the server agree by construction.
The engine decides where a line breaks and where a page ends. If that arithmetic came from a library, the browser and the server would each get whatever version they resolved, and a document would paginate one way in the editor and another way in the PDF. Owning the arithmetic is what makes the two agree by construction, so the absence of dependencies is the feature rather than an economy.
Text measurement reads the font files in assets/fonts directly -- the metrics
come from the same faces the renderer uses, not from a table that can drift away
from them.
The engine, from npm:
npm install @coolms/document-engineThe fonts, from Packagist:
composer require coolms/document-fontsThat gives you vendor/coolms/document-fonts/assets/fonts/ -- the 24 faces
and fonts.manifest.json. Serve them at whatever URL your application uses;
CoolMS serves them under the admin at assets/document-fonts/.
import { ... } from '@coolms/document-engine';npm run build |
tsc -p tsconfig.build.json |
npm run test |
vitest run |
npm run test:watch |
vitest |
npm run typecheck |
tsc --noEmit |
npm run audit:claims |
node tools/audit-claims.mjs |
npm: Node >=20. No runtime dependencies; TypeScript and vitest are dev-only.
Composer: none. The package declares no PHP constraint because it contains no PHP -- it is font files and a JSON manifest, and constraining a runtime it never invokes would refuse installations for no reason.
develop is the default and where work lands; main carries releases. The package is a pre-release and carries no compatibility promise.
MIT — see LICENSE, which covers this package's own code.
The font files under assets/fonts are third-party and carry their own terms.
assets/fonts/fonts.manifest.json records where each one came from: Liberation,
Carlito and Caladea were extracted from the gotenberg/gotenberg:8 image
(Debian packages fonts-liberation, fonts-crosextra-carlito,
fonts-crosextra-caladea), and Gelasio came from the designer's own repository
under OFL-1.1. They are vendored rather than installed because the browser and
the renderer must shape text from the same bytes or the page boundaries
diverge.