Problem translating Rebol 3 text using GOB

I am trying to better understand the Rebol 3 graphics at a lower level (i.e. do not use the R3-GUI). I am having a problem displaying text in a drawing.

It works:

REBOL []

par: make system/standard/para []

gob-svg: make gob! [ ;this GOB is just for SVG graphics
    offset: 0x0
    size: 640x480
    draw: none
]

rt: bind/only [
    size 18 para par text "This is a test!"
] import 'text

gob-svg/draw: bind compose/only [
    box 20x20 50x50 1 text 100x100 640x480 anti-aliased rt
] import 'draw 

view gob-svg

This does not work:

REBOL []

par: make system/standard/para []

gob-svg: make gob! [ ;this GOB is just for SVG graphics
    offset: 0x0
    size: 640x480
    draw: none
]

gob-svg/draw: bind compose/only [
    box 20x20 50x50 1 text 100x100 640x480 anti-aliased (
        bind/only compose [
            size 18 para (par) text "This is a test!"
        ] import 'text
    )
] import 'draw

view gob-svg

Any ideas on what I'm doing wrong? Should the second script be functionally equivalent to the first?

Thanks.

+4
source share
1 answer

Cyphre (Richard Smolak) answered my question in AltMe. The summary is that I had to do the / binding only , not just the bind . He also cleaned up my example, such as eliminating an unnecessary essay. See his full answer below:

ddharing: :

par: make system/standard/para []

gob-svg: make gob! [;this GOB is just for SVG graphics
    offset: 0x0
    size: 640x480
    draw: none
]

gob-svg/draw: bind/only compose/only [
    box 20x20 50x50 1
    text 100x100 640x480 vectorial (
        bind [
            size 18
            para par
            text "This is a test!"
        ] import 'text
    )
] import 'draw

view gob-svg

DRAW I, R3-GUI. . : https://github.com/saphirion/r3-gui/blob/master/source/gfx-pre.r3.

r3-gui... gfx-pre.r3 script , TO-TEXT TO-DRAW .

"" DRAW ( command!), :

do %gfx-pre.r3

par: make system/standard/para []

gob-svg: make gob! [;this GOB is just for SVG graphics
    offset: 0x0
    size: 640x480
    draw: none
]

gob-svg/draw: to-draw [
    box 20x20 50x50
    text 100x100 640x480 vectorial [
        size 18
        para par
        "This is a test!"
    ]
] copy []

view gob-svg

R3 DRAW : http://www.rebol.com/r3/docs/view/draw.html.

+3
source

All Articles