pdf.canvas: add concept of line-height multiplier.
parent
014eaa51f3
commit
29e15fef76
|
@ -2,11 +2,13 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license
|
! See http://factorcode.org/license.txt for BSD license
|
||||||
|
|
||||||
USING: accessors assocs colors.constants combinators fonts fry
|
USING: accessors assocs colors.constants combinators fonts fry
|
||||||
io io.styles kernel math math.order pdf.text pdf.wrap sequences
|
io io.styles kernel math math.order namespaces pdf.text pdf.wrap
|
||||||
ui.text ;
|
sequences ui.text ;
|
||||||
|
|
||||||
IN: pdf.canvas
|
IN: pdf.canvas
|
||||||
|
|
||||||
|
SYMBOL: +line-height+
|
||||||
|
|
||||||
TUPLE: margin left right top bottom ;
|
TUPLE: margin left right top bottom ;
|
||||||
|
|
||||||
C: <margin> margin
|
C: <margin> margin
|
||||||
|
@ -87,11 +89,18 @@ foreground background page-color inset line-height metrics ;
|
||||||
: inc-y ( canvas n -- )
|
: inc-y ( canvas n -- )
|
||||||
'[ _ + ] change-y drop ;
|
'[ _ + ] change-y drop ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: (line-height) ( canvas -- n )
|
||||||
|
line-height>> +line-height+ get [ * >integer ] when* ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
: line-height ( canvas -- n )
|
: line-height ( canvas -- n )
|
||||||
[ line-height>> ] [ inset>> first 2 * ] bi + ;
|
[ (line-height) ] [ inset>> first 2 * ] bi + ;
|
||||||
|
|
||||||
: line-break ( canvas -- )
|
: line-break ( canvas -- )
|
||||||
[ line-height>> ] keep [ + ] change-y 0 >>x
|
[ (line-height) ] keep [ + ] change-y 0 >>x
|
||||||
dup metrics>> height>> >>line-height drop ;
|
dup metrics>> height>> >>line-height drop ;
|
||||||
|
|
||||||
: ?line-break ( canvas -- )
|
: ?line-break ( canvas -- )
|
||||||
|
|
Loading…
Reference in New Issue