linebreak 1.1.0

Generates line breaking points based on Unicode® Standard Annex #14


To use this package, run the following command in your project's root directory:

Unicode line breaking algorithm

This implements the Unicode line breaking algorithm from annex 14. The currently implemented version is based on the Unicode 7.0.0 standard and uses the table based approximate algorithm.

Citing from the standard:

Line breaking, also known as word wrapping, is the process of breaking a section of text into lines such that it will fit in the available width of a page, window or other display area. The Unicode Line Breaking Algorithm performs part of this process. Given an input text, it produces a set of positions called "break opportunities" that are appropriate points to begin a new line. The selection of actual line break positions from the set of break opportunities is not covered by the Unicode Line Breaking Algorithm, but is in the domain of higher level software with knowledge of the available width and the display size of the text.

This library has been ported from the CoffeeScript implementation by Devon Govett: linebreak

Build Status

Example

import linebreak;
import std.algorithm : equal, map;

auto text = "Hello, world!\nThis is an (English) example.";
auto broken = text
	.lineBreakRange
	.map!(lb => lb.text);

assert(broken.equal([
	"Hello, ", "world!\n", "This ", "is ", "an ", "(English) ", "example."
]));
Authors:
  • Devon Govett
  • Sönke Ludwig
Dependencies:
none
Versions:
1.1.0 2018-Apr-05
1.0.0 2018-Apr-04
~master 2018-Apr-05
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 2 downloads this month

  • 62 downloads total

Score:
0.5
Short URL:
linebreak.dub.pm