Re: Write vertical text

Hi Romaric,

> Finally, it's not very easy to write text, even horizontally !

Why not use the the Python code Tom sent you:

  from subs import *
  m = makeMaps('x','x','y','y')
  d = makeDisplay2D(m)
  d.drawString('my string', [0, 0], up=[-.1, 0., 0.], base=[0., .1, 0.] )
  d.showDisplay()

That's pretty easy. For more info on the drawString() function he
calls, see:

  http://www.ssec.wisc.edu/~tomw/visadtutor/doc/subs.html#drawString

You said you didn't want to use Python, but that's the way to
make things easy.

> I read test 45 and 69, it looks like difficult (for me)...
> This is my code :
>
>   TextType text = new TextType("Hello World");

The String passed to the TextType constructor is the name of the
type, not the String to be displayed on the screen. This should be
clear from reading Test45.java and Test69.java.

>   FieldImpl text_field = new FieldImpl(text);

Try:

  Text t = new Text(text, "Hello World");

To locate this text on the screen, you can either put in a Tuple
with two Reals whose RealTypes are mapped to XAxis and YAxis, or
just include an array of ConstantMaps to XAxis and YAxis in your
call to addReference().

>    DataReferenceImpl ref_text_field = new DataReferenceImpl("ref_text_field");
>    ref_text_field.setData(text_field);
>    display.addReference(ref_text_field, null);

Good luck,
Bill


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: