VMD-L Mailing List
From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri Aug 11 2006 - 23:15:27 CDT
- Next message: John Stone: "Re: right alignment for numbers in color bar"
- Previous message: John Stone: "Re: Axes dilema"
- In reply to: Yongcheng Zhou: "right alignment for numbers in color bar"
- Next in thread: John Stone: "Re: right alignment for numbers in color bar"
- Reply: John Stone: "Re: right alignment for numbers in color bar"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi,
I believe the root of the problem here is twofold:
1) The Hershey font used by the "draw text" command is a proportional
font and not a fixed font, which means that the widths of the various
characters are slightly different, and thus even with justified text you
can get different spacings. In particular, the width of the "." and " "
characters differ from the width of the numeric characters. The numeric
characters are all the same, so we might be able to cure this by hacking
the Hershey font and modifying the width of the " " and "." characters
to match the width of the numbers in a future version of VMD.
2) The result of the format command isn't quoted, so the
spaces may be getting eliminated by Tcl. The format command
is indeed working correctly and is padding with spaces however.
Of the two, 1) is the major problem. I'll see what I can do...
John
On Fri, Aug 11, 2006 at 07:38:38PM -0400, Yongcheng Zhou wrote:
>
> Dear folks,
>
> It seems that the color_bar plugin
>
> http://www.ks.uiuc.edu/Research/vmd/plugins/colorscalebar/
>
> can generate a color bar with right aligned numbers. However,
> with color_scale_bar_new.tcl, I can only generate a color bar
> with central aligned numbers.
>
> This is the command in this tcl file to `draw' numbers:
>
> draw text " $coord_x $coord_y $use_z" [format %6.2f $cur_text]
>
> If this was in C language, then the numbers will be right alignd by
> default. But it is not.
>
> Is is possible to change this tcl file to generage right aligned numbers?
>
>
> Thanks a lot.
>
> Yongcheng
>
> ----
> Zhou Yongcheng <zhouyon1_at_math.msu.edu>
> Department of Mathematics
> Michigan State University
> East Lansing, MI 48824
-- NIH Resource for Macromolecular Modeling and Bioinformatics Beckman Institute for Advanced Science and Technology University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801 Email: johns_at_ks.uiuc.edu Phone: 217-244-3349 WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
- Next message: John Stone: "Re: right alignment for numbers in color bar"
- Previous message: John Stone: "Re: Axes dilema"
- In reply to: Yongcheng Zhou: "right alignment for numbers in color bar"
- Next in thread: John Stone: "Re: right alignment for numbers in color bar"
- Reply: John Stone: "Re: right alignment for numbers in color bar"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]