https://github.com/a-ludi/printed-text
Text layout engine on top of `printed` graphics package.
https://github.com/a-ludi/printed-text
pdf svg text-layout
Last synced: 4 months ago
JSON representation
Text layout engine on top of `printed` graphics package.
- Host: GitHub
- URL: https://github.com/a-ludi/printed-text
- Owner: a-ludi
- License: mit
- Created: 2021-07-19T16:19:19.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-05T14:15:26.000Z (over 3 years ago)
- Last Synced: 2025-10-25T15:52:36.489Z (8 months ago)
- Topics: pdf, svg, text-layout
- Language: D
- Homepage:
- Size: 1.1 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`printed-text`
==============
[](https://github.com/RichardLitt/standard-readme)

[](https://code.dlang.org/packages/printed-text)
> Text layout engine on top of `printed` graphics package.
`printed-text` provides a text layout engine on top of the graphics context API of `printed` for creating text documents in PDF, HTML or SVG format. It is intended to provide a barebones and extensible API.
Table of Contents
-----------------
- [Install](#install)
- [Usage](#usage)
- [Maintainer](#maintainer)
- [Contributing](#contributing)
- [License](#license)
Install
-------
With `dub add printed-text`.
With `dub.sdl`:
```sdl
dependency "printed-text" version=">=0.0.0"
```
With `dub.json`:
```json
"dependencies": { "printed-text": ">=0.0.0" }
```
Usage
-----
Here is a minimal example. More examples can be found under
[`docs/examples`](./docs/examples).
```d
import printed.canvas;
import printed.text;
void loremIpsum(IRenderingContext2D renderer, ITextLayouter textLayouter)
{
with (textLayouter)
{
textWidth = 150f; //mm
fontFace = "Arial";
fontSize = 10f; //pt
textLayouter.group({
fontSize = 16f; //pt
fontWeight = FontWeight.bold;
write("Lorem Ipsum\n");
});
write("\n")
write("Lorem ipsum dolor sit amet.");
foreach (block; layout())
block.renderWith(renderer);
}
}
```
Maintainer
----------
`printed-text` is being developed by Arne Ludwig <>.
Contributing
------------
Contributions are warmly welcome. Just create an [issue][gh-issues] or [pull request][gh-pr] on GitHub. If you submit a pull request please make sure that:
- the code compiles on Linux using the current release of [dmd][dmd-download],
- your code is covered with unit tests (if feasible) and
- `dub test` runs successfully.
[gh-issues]: https://github.com/a-ludi/printed-text/issues
[gh-pr]: https://github.com/a-ludi/printed-text/pulls
[dmd-download]: https://dlang.org/download.html#dmd
License
-------
This project is licensed under MIT License (see [LICENSE](./LICENSE)).