By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,625 Members | 2,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,625 IT Pros & Developers. It's quick & easy.

Size of a string in px/pt

P: n/a
Hi people,

I want to get the size(width and height) of a complete string.

Say, if I use "font: 12px tahoma;", how many pixels will the string "hello
people" take when rendered ?

I need this measurement, to position text around a circle, such that the
text lies just outside the circle. Given the radius and angle I can find out
the x-coordinate of the text-start position if the text is on the right
side. But, if I want t find the x-coordinate of the text on the left side, I
need to subtract the width of the text from the x- coordinate obtained.

Please give me some way of doing what I want, gurus!

Thanks,
Vyapak
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
In article <10*********************@news1.news.adelphia.net >,
"Vyapak Vikrant" <vy***********@hotmail.com> wrote:
I want to get the size(width and height) of a complete string.

Say, if I use "font: 12px tahoma;", how many pixels will the string "hello
people" take when rendered ?

I need this measurement, to position text around a circle, such that the
text lies just outside the circle. Given the radius and angle I can find out
the x-coordinate of the text-start position if the text is on the right
side. But, if I want t find the x-coordinate of the text on the left side, I
need to subtract the width of the text from the x- coordinate obtained.

Please give me some way of doing what I want, gurus!


Isn't this easier?
<http://www.meyerweb.com/eric/css/edge/curvelicious/demo.html>
<http://www.meyerweb.com/eric/css/edge/raggedfloat/demo.html>
<http://www.meyerweb.com/eric/css/edge/slantastic/demo.html>

--
Kris
kr*******@xs4all.netherlands (nl)
Jul 20 '05 #2

P: n/a
Thanks for your prompt reply, Kris!

However, this is not what I am looking for. I need to dynamically generate a
circle of variable radius(I'm using VML for that) and then place the text
labels around it.

To see what I'm attempting to do, have a look at
http://www.dundas.com/Charting/Galle...rPolyLineHoriz .
How can I find out the x,y, width and height of the text on the left hand
side, i.e. for Japan/Sweden/Russia/Spain....

Thanks,
Vyapak
Isn't this easier?
<http://www.meyerweb.com/eric/css/edge/curvelicious/demo.html>
<http://www.meyerweb.com/eric/css/edge/raggedfloat/demo.html>
<http://www.meyerweb.com/eric/css/edge/slantastic/demo.html>

--
Kris
kr*******@xs4all.netherlands (nl)

Jul 20 '05 #3

P: n/a
"Vyapak Vikrant" <vy***********@hotmail.com> wrote:
Say, if I use "font: 12px tahoma;", how many pixels will the string "hello
people" take when rendered ?


This depends on the specific properties of the specific font, and also the
the actual string, since in Tahoma, and most other fonts, characters have
different widths. Various CSS properties (such as padding and letter-
spacing) might also have an effect on the width. The height depends on the
font size and on the value of the line-height property. But the width is
considerably more difficult; there's no way finding it out in CSS.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #4

P: n/a
In article <6B*********************@news1.news.adelphia.net >,
"Vyapak Vikrant" <vy***********@hotmail.com> wrote:

[determining width of arbitrary string of text to locate it around a
circle]
Isn't this easier?
<http://www.meyerweb.com/eric/css/edge/curvelicious/demo.html>
<http://www.meyerweb.com/eric/css/edge/raggedfloat/demo.html>
<http://www.meyerweb.com/eric/css/edge/slantastic/demo.html>
Thanks for your prompt reply, Kris!

However, this is not what I am looking for. I need to dynamically generate a
circle of variable radius(I'm using VML for that) and then place the text
labels around it.

To see what I'm attempting to do, have a look at
http://www.dundas.com/Charting/Galle...rPolyLineHoriz .
Generated charts? Doesn't the documentation go about this?
How can I find out the x,y, width and height of the text on the left hand
side, i.e. for Japan/Sweden/Russia/Spain....


Ah.. Bob.. Pie.. Piiieee

Pie, right?

Generate an image server side. ALT and LONGDESC can be set as well.
Additionlly, you may wish to repeat the data in an alternative format,
like a TABLE.

--
Kris
kr*******@xs4all.netherlands (nl)
Jul 20 '05 #5

P: n/a
Thanks for the alternatives... I think Im asking in the wrong place...

"Kris" <kr*******@xs4all.netherlands> wrote in message
news:kr*****************************@news1.news.xs 4all.nl...
In article <6B*********************@news1.news.adelphia.net >,
"Vyapak Vikrant" <vy***********@hotmail.com> wrote:

[determining width of arbitrary string of text to locate it around a
circle]
Isn't this easier?
<http://www.meyerweb.com/eric/css/edge/curvelicious/demo.html>
<http://www.meyerweb.com/eric/css/edge/raggedfloat/demo.html>
<http://www.meyerweb.com/eric/css/edge/slantastic/demo.html>
Thanks for your prompt reply, Kris!

However, this is not what I am looking for. I need to dynamically
generate a circle of variable radius(I'm using VML for that) and then place the text labels around it.

To see what I'm attempting to do, have a look at
http://www.dundas.com/Charting/Galle...rPolyLineHoriz .
Generated charts? Doesn't the documentation go about this?
How can I find out the x,y, width and height of the text on the left

hand side, i.e. for Japan/Sweden/Russia/Spain....


Ah.. Bob.. Pie.. Piiieee

Pie, right?

Generate an image server side. ALT and LONGDESC can be set as well.
Additionlly, you may wish to repeat the data in an alternative format,
like a TABLE.

--
Kris
kr*******@xs4all.netherlands (nl)

Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.