[go: up one dir, main page]

unicode-linebreak 0.1.0

Implementation of the Unicode Line Breaking Algorithm
Documentation

unicode-linebreak

Implementation of the Line Breaking Algorithm described in Unicode Standard Annex #14.

Build Status Documentation

Given an input text, locates "line break opportunities", or positions appropriate for wrapping lines when displaying text.

Example

use unicode_linebreak::{linebreaks, BreakOpportunity::{Mandatory, Allowed}};

let text = "a b \nc";
assert!(linebreaks(text).eq(vec![
	(2, Allowed),   // May break after first space
	(5, Mandatory), // Must break after line feed
	(6, Mandatory)  // Must break at end of text, so that there always is at least one LB
]));