www.webdeveloper.com
Results 1 to 5 of 5

Thread: Calculate width of letter

  1. #1
    Join Date
    Sep 2006
    Location
    Cleveland
    Posts
    579

    Question Calculate width of letter

    Is there a way to calculate the width of a letter based upon the font,size, bold and other properties???

    Thanks for the answer

  2. #2
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Possibly by puting it inside a span and testing the size of the span.

    Of course you also need to allow for when the letter doesn't have a font or size such as when it has a voice and pitch instead. You also can't rely on what you put in your stylesheet since your visitors can easily change it to suit themselves.
    Stephen

  3. #3
    Join Date
    Sep 2006
    Location
    Cleveland
    Posts
    579
    felgall

    Thanks for the reply. I was actually wondering if there was a way to do it on the fly. If some one at some time did some sort of averaging of letter widths. I do at this point calculate the height of the lement based upon the font size but the width is eluding me.

  4. #4
    Join Date
    Jan 2005
    Posts
    3,067
    Quote Originally Posted by thechasboi
    Is there a way to calculate the width of a letter based upon the font,size, bold and other properties???

    Thanks for the answer
    It would vary by font-style, so doing it without using a span as Felgall suggested would be almost impossible.

  5. #5
    Join Date
    Sep 2006
    Location
    Cleveland
    Posts
    579
    konithomimo

    Inserting text or letters into a span is not a bad idea but it is extrememly time consuming. I was hoping there was a different way of achieving this goal. Thanks for the answer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles