Handbook
Glossary
pdf-render ( canvas obj -- remain/f )
Vocabulary
pdf
.
layout
Inputs
canvas
an
object
obj
an
object
Outputs
remain/f
an
object
Definition
IN:
pdf.layout
GENERIC:
pdf-render
( canvas obj -- remain/f )
Methods
USING:
kernel
math
pdf.canvas
pdf.layout
;
M:
br
pdf-render
[
f
set-style
]
dip
over
avail-lines
0
>
[
drop
?break
f
]
[
nip
]
if
;
USING:
accessors
kernel
pdf.canvas
pdf.layout
sequences
;
M:
div
pdf-render
[
style>>
set-style
]
keep
swap
[
pdf-render
drop
]
curry
each
f
;
USING:
kernel
pdf.layout
;
M:
f
pdf-render
2drop
f
;
USING:
accessors
kernel
math
math.order
pdf.canvas
pdf.layout
;
M:
hr
pdf-render
[
f
set-style
]
dip
[
[
dup
0
>
pick
avail-lines
0
>
and
]
[
over
avail-width
over
min
[
-
]
keep
[
overd
[
draw-line
]
[
inc-x
]
2bi
]
unless-zero
dup
0
>
[
over
line-break
]
when
]
while
]
change-width
nip
dup
width>>
0
>
and*
;
USING:
accessors
kernel
pdf.canvas
pdf.layout
pdf.wrap
sequences
;
M:
p
pdf-render
[
style>>
set-style
]
keep
[
over
?line-break
over
[
font>>
]
[
avail-width
]
bi
visual-wrap
over
avail-lines
index-or-length
cut
[
draw-text
]
[
""
concat-as
]
bi*
]
change-string
dup
string>>
empty?
[
drop
f
]
when
;
USING:
accessors
kernel
pdf.layout
;
M:
pb
pdf-render
dup
used?>>
[
f
>>used?
drop
f
]
[
t
>>used?
]
if
nip
;
USING:
accessors
combinators
kernel
math
pdf.layout
sequences
;
M:
table-cell
pdf-render
{
[
width>>
>>col-width
0
>>x
drop
]
[
[
[
dupd
pdf-render
]
map
nip
]
change-contents
[
contents>>
[
]
any?
]
1guard
]
[
width>>
table-cell-padding
+
swap
margin>>
[
+
]
change-left
drop
]
}
2cleave
;
USING:
accessors
arrays
combinators
kernel
locals.backend
math.order
pdf.canvas
pdf.layout
sequences
;
M:
table-row
pdf-render
{
[
drop
?line-break
]
[
over
y>>
load-local
over
y>>
1array
load-local
-1
get-local
0
get-local
[
2
load-locals
-1
get-local
0
get-local
[
2
load-locals
-1
get-local
[
load-local
0
get-local
>>y
1
drop-locals
]
curry
dip
dupd
pdf-render
over
y>>
0
get-local
local-value
max
0
get-local
set-local-value
2
drop-locals
]
curry
curry
map
swap
0
get-local
local-value
>>y
drop
2
drop-locals
]
curry
curry
change-cells
[
cells>>
[
]
any?
]
1guard
2
drop-locals
]
[
drop
margin>>
54
>>left
drop
]
[
drop
dup
width>>
>>col-width
[
?line-break
]
[
table-cell-padding
inc-y
]
bi
]
}
2cleave
;
USING:
accessors
combinators
kernel
pdf.layout
sequences
;
M:
table
pdf-render
{
[
dup
widths?>>
[
2drop
]
[
t
>>widths?
rows>>
set-col-widths
]
if
]
[
[
dup
rows>>
empty?
[
t
]
[
[
rows>>
first
dupd
pdf-render
]
1check
]
if
]
[
[
rest
]
change-rows
]
until
nip
dup
rows>>
[
drop
f
]
[
drop
]
if-empty
]
}
2cleave
;
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
index-or-length
cut
[
draw-text
]
[
""
concat-as
]
bi*
]
change-string
dup
string>>
empty?
[
drop
f
]
when
;