Libunibreak is an implementation of the line breaking and word breaking algorithms as described in Unicode Standard Annex 14 and Unicode Standard Annex 29. It is designed to be used in a generic text renderer. FBReader is one real-world example, and the Enlightenment Foundation Libraries are another. You may also check some simple sample code, like showbreak and breaktext.