.. page-title: Box example: text.box text.box ======== Example of text formatting -------------------------- .. figure:: text.png :align: center most of the formatting capabilities of Window.Text To run this example you will need the following file(s): `./text.box <./text.box>`__. If the example requires more than one file, then you should put them into the same directory. You can then launch Box with ``box -l g ./text.box``. .. raw:: html
include "g"
w2 = Window["eps", .File["text.eps"], (200, 200), .Res[1]]
w3 = Window["pdf", .File["text.pdf"], (200, 200), .Res[1]]
w = Window[]
pl = w.Poly[Style[.Border[1]], color.yellow
(50, 50), (150, 50), (150, 150), (50, 150)]
\ w.Circle[Color[color.red, .a=0.5], 1, pl]
\ w.Text[.Font["Times", 8], color.black
Style[.Border[0.2, color.blue]]
pl.Get[1], .From[(1, 1)], "A"; pl.Get[2], .From[(0, 1)], "B";
pl.Get[3], .From[(0, 0)], "C"; pl.Get[4], .From[(1, 0)], "D";
pl.Get[(1.5, 0.5)], .From[(0.5, 0.5)],
Style[.Border[0]]
"one_{subscript} and one^{superscript}\n"_
"plus 1 + a + a^2 + ... + a^n\n"_
" = (a^{n+1} - 1)/(a - 1)\n"_
"sub_script super^script\n"_
"\\n, ^^ and __ do the magic!"]
\ w2.Put[w]
\ w3.Put[w]