text.box

Example of text formatting

../../_images/text.png

most of the formatting capabilities of Window.Text To run this example you will need the following file(s): ./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.

include "g"

w = Window[][
  BBox[(0, 0), (200, 200)]
  (pl = Poly[Style[Border[1, color.black], color.yellow]
             (50, 50), (150, 50), (150, 150), (50, 150)])

  Circles[Color[color.red, .a=0.5], 1
          pl.Get[0], pl.Get[1], pl.Get[2], pl.Get[3]]

  font = Font["Times", 8, color.black]
  Texts[font, Style[Border[0.2, color.blue]]
        pl.Get[0], From[(1, 1)], "A"; pl.Get[1], From[(0, 1)], "B";
        pl.Get[2], From[(0, 0)], "C"; pl.Get[3], From[(1, 0)], "D"]

  Texts[font
        pl.Get[(0.5, 0.5)], From[(0.5, 0.5)],
        "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!"]
]

w.Save["text.pdf"]
w.Save["text.png", Window["rgb24", .Res[Dpi[60]]]]

Table Of Contents



This Page



Get The figure description language: Box at SourceForge.net. Fast, secure and Free Open Source software downloads