some updates to the webpage
[PyX.git] / examples / text / textbox.txt
blob8883eb37811672781a4af2f409e2bcc1cdbbc5e0
1 Enlarge the surrounding of a textbox
3 ! This example introduces the concept of the `textbox`, which is a canvas-like
4 structure containing the text and its surrounding path and reference point. We
5 demonstrate how to enlarge the surrounding box a little and use it as a
6 decoration of the path. ...
8 ! The `textbox` is a specialized version of the [`box` concept
9 ../../roadmap.html] which has been introduced into PyX in a preliminary
10 version. In the example, we obtain the bounding box (this is a `bbox` instance,
11 not to be mixed up with the `box`) and enlarge it a bit. We then draw the path
12 of the bounding box.
14 ! In future releases of PyX, the boxes will have generic support for enlarging.
15 The syntax will then be
17     tpath = tbox.enlarged(3*unit.x_pt).path()
19 ! An alternative, geometrically different approach to enlarging the textbox path
20 is via an appropriate transformation, such as
22     tbox = text.text(0, 0, r"Boxed text", [text.halign.boxcenter, text.valign.middle])
23     tpath = tbox.path().transformed(trafo.scale(1.5, 1.5, 0, 0))