Handbook Glossary
factorcode.org
text


Vocabulary
pdf.layout

Definition
IN: pdf.layout

TUPLE: text string style ;


Methods
USING: accessors kernel math pdf.canvas pdf.layout pdf.wrap
sequences ;

M: text pdf-render
[ style>> set-style ] keep [
over x>> 0 > [
2dup text-fits? [
over [ font>> ] [ avail-width ] bi visual-wrap
unclip [ "" concat-as ] dip
] [ over line-break f ] if
] [ f ] if [
[ { } ] [ over [ font>> ] [ width ] bi visual-wrap ]
if-empty
] dip [ prefix ] when* over avail-lines short cut
[ draw-text ] [ "" concat-as ] bi*
] change-string dup string>> empty? [ drop f ] when ;


USING: accessors kernel pdf.canvas pdf.layout sequences
splitting ui.text ;

M: text pdf-width
[ style>> set-style ] keep [ font>> ] [ string>> ] bi*
string-lines [ dupd text-width ] map nip supremum ;