! Copyright (C) 2011-2012 John Benediktsson ! See http://factorcode.org/license.txt for BSD license USING: kernel fry make math sequences ui.text unicode.categories wrap ; IN: pdf.wrap : word-split1 ( string -- before after/f ) dup word-index [ cut ] [ f ] if* ; : word-split ( string -- seq ) [ word-split, ] { } make ; elements ( string font -- elements ) [ word-split ] dip '[ dup word-split1 "" or [ _ swap text-width ] bi@ ] map ; PRIVATE> : visual-wrap ( line font line-width -- lines ) [ string>elements ] dip dup wrap [ concat ] map ;