#unicode #text #layout

unicode-linebreak

Implementation of the Unicode Line Breaking Algorithm

4 releases

0.1.2 Jul 25, 2021
0.1.1 Jan 30, 2021
0.1.0 Jun 23, 2019
0.0.1 Dec 10, 2018

#20 in Internationalization (i18n)

Download history 5050/week @ 2021-08-11 12190/week @ 2021-08-18 13329/week @ 2021-08-25 10837/week @ 2021-09-01 14155/week @ 2021-09-08 13772/week @ 2021-09-15 11099/week @ 2021-09-22 14125/week @ 2021-09-29 15156/week @ 2021-10-06 14028/week @ 2021-10-13 13716/week @ 2021-10-20 11959/week @ 2021-10-27 13458/week @ 2021-11-03 12629/week @ 2021-11-10 15347/week @ 2021-11-17 10294/week @ 2021-11-24

53,810 downloads per month
Used in 74 crates (2 directly)

Apache-2.0

70KB
485 lines

unicode-linebreak

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

test 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
]));

No runtime deps

~135KB