Re: working with text extent

From: David B. Reusch <dbr_at_nyahnyahspammersnyahnyah>
Date: Tue, 16 Dec 2008 15:00:38 -0500

Thanks but I don't think that's going to help. I know how to control
the height, but I don't know how to retrieve spatial extent from an
existing text string. A given string with a given fontheight produces a
text object of a certain width (and presumably it's the fontheight high,
though I'm guessing gsnMaximize can change that). I can picture
empirical ways to calculate the width based on the number of characters
and more info about the font, but ideally I'd just like to query a text
object and get its width extent.

After that, I still need to figure out if it's too wide for my page,
then what to do about it if it is.

At the moment I've just gone with two possible cases (two fontheight
settings) that I can choose between when the script runs. It works but
it's not as flexible as I'd like.

I was thinking I might be able to use getvalues on the text string in
question, once that object is identified somehow. My experience with
get/setvalues is *very* limited and the HLU manuals do not look very
inviting at first glance. Also, whatever I end up with, I'd like it to
work for the title in a panel plot and the text I'm adding with
gsn_text_ndc in my other plot.

thanks,
dave

Debasish Pai Mazumder said the following on 12/16/2008 2:28 PM:
> Dear Dave Reusch,
>
> You can use "tiMainFontHeightF", "tiXAxisFontHeightF", "tiYAxisFontHeightF",
> "tiMainFontAspectF", "tiXAxisFontAspectF", "tiYAxisFontAspectF" to control
> the height/width of the title string.
>
> Please also check the webpage
>
> http://www.ncl.ucar.edu/Document/Graphics/Resources/ti.shtml
>
> Thanks
>
> Debasish
>
>
>
>
> -----Original Message-----
> From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On Behalf
> Of David B. Reusch
> Sent: Tuesday, December 16, 2008 7:26 AM
> To: ncl-talk_at_ucar.edu
> Subject: working with text extent
>
> Hello,
>
> I am running into problems with title strings that are too long (they
> get truncated by the side margins on each end) and am seeking a way to
> dynamically adjust my textsize so that the resulting title will fit on
> the pagewidth. These titles are done in two different plot settings:
> associated with panel plots and as text I'm adding myself in NDC
> coordinates. I create lots of plots and the title text depends on the
> particular plot. I'm picturing iteratively adjusting the text height
> until my title text fits, or possibly just rescaling a text object to
> make it fit. Either way, I'm not at all clear how to proceed. For
> example, I wonder whether objects can be deleted after creation but
> before the draw is done? Not sure this would help but it seems like one
> possible approach (create, check size, delete if too big, try again...).
>
> I see txPosXF and txPosYF resources for position but nothing directly
> reflecting height/width of the text object.
>
> Hope this is clear and thanks in advance for any advice, etc.,
>
> Dave Reusch
>
>

-- 
517 Deike Building
Earth & Environmental Systems Institute
Penn State University
University Park, PA 16802
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 16 2008 - 13:00:38 MST

This archive was generated by hypermail 2.2.0 : Sat Dec 20 2008 - 12:36:21 MST