height of text

A

Andrew Poulos

Within text in a P element is it possible to know the height, width, and
relative position of individual letters?

Andrew Poulos
 
G

Gregor Kofler

Andrew Poulos meinte:
Within text in a P element is it possible to know the height, width, and
relative position of individual letters?

No. Since you can't access the metrics of a single letter.

Gregor
 
S

SAM

D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
Andrew Poulos meinte:

No. Since you can't access the metrics of a single letter.

But, given the name/ID of the P element, I suppose that one might by DOM
methods get its text, insert <span> </span> around the target letter,
and access the metrics of that span.
 
G

Gregor Kofler

Dr J R Stockton meinte:
In comp.lang.javascript message <[email protected]>,


But, given the name/ID of the P element, I suppose that one might by DOM
methods get its text, insert <span> </span> around the target letter,
and access the metrics of that span.

Indeed, this could work, depending on what you accept as "letter
position, width, height". The OP didn't state, what he tries to achieve.

Gregor
 
S

SAM

Le 9/6/09 1:14 PM, Dr J R Stockton a écrit :
In comp.lang.javascript message <[email protected]>,


But, given the name/ID of the P element, I suppose that one might by DOM
methods get its text, insert <span> </span> around the target letter,
and access the metrics of that span.

Pomme + plus (Apple +) hop! enlarge characters

Pomme + moins (Apple key -) hop! smalest

My Safari displays letters bigest than my Firefox
(I fixed them like that)
Windows displays same character in same font bigger than Mac

No you can't pronostic which will be the size (in pixels) of any
character displayed on the user's screen.

But yes you may get an approach of the size of a span with one character
test. (the size of the box of the span, not this of the letter)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,271
Latest member
BuyAtenaLabsCBD

Latest Threads

Top