Skip to content

io7m-com/jpita

Repository files navigation

jpita

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.jpita

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

jpita

Java functions to align and justify plain text.

Features

  • Full justification (flush left, flush right).
  • Left alignment (flush left, ragged right).
  • High coverage test suite.
  • OSGi-ready
  • JPMS-ready
  • ISC license.

Usage

Add a series of words to a JPAlignerType instance:

var a = JPAlignerBasic.create(80);

a.addWord("Hello");
a.addWord("World");
var s = a.finish();
var a = JPJustifierBasic.create(OVERFLOW_ANYWAY, JUSTIFY_UNDER_HALF, 80);

a.addWord("Hello");
a.breakLine();
a.addWord("World");
var s = a.finish();

The result of finish() is a list of justified and/or aligned lines of text.