! Copyright (C) 2011-2012 John Benediktsson ! See http://factorcode.org/license.txt for BSD license USING: kernel fry make math sequences ui.text unicode 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 dup [ blank? ] find drop [ cut ] [ "" ] if* [ _ swap text-width ] bi@ ] map ; PRIVATE> : visual-wrap ( line font line-width -- lines ) [ string>elements ] dip wrap [ concat ] map ;