Skip to content

Text layout engine on top of `printed` graphics package.

License

Notifications You must be signed in to change notification settings

a-ludi/printed-text

Repository files navigation

printed-text

standard-readme compliant GitHub DUB

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

With dub add printed-text.

With dub.sdl:

dependency "printed-text" version=">=0.0.0"

With dub.json:

"dependencies": { "printed-text": ">=0.0.0" }

Usage

Here is a minimal example. More examples can be found under docs/examples.

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 <[email protected]>.

Contributing

Contributions are warmly welcome. Just create an issue or pull request on GitHub. If you submit a pull request please make sure that:

  • the code compiles on Linux using the current release of dmd,
  • your code is covered with unit tests (if feasible) and
  • dub test runs successfully.

License

This project is licensed under MIT License (see LICENSE).

About

Text layout engine on top of `printed` graphics package.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages