getting typical font size for applet

Yes, I need to get typical font sizes from the browser. a 12pt in a 600x800 looks different than a 768x1200 browser. Or if you know another way to get the same size based on the browser?

I guess a way through java script to pass in the smaller font object.

I need to display 3 different font sizes in my applet embedded in the browser

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>> a 12pt in a 600x800 looks different than a 768x1200 browser
yes, but the font is still 12pt in size.
do you want to know the font size or resolution?
Use the FontMetrics class to get details about rendering a font on a particular screen.
nick5454Author Commented:
I use the smaller small, x-small descriptions. Will the font metrics do this for me
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

> I use the smaller small, x-small descriptions.

Sorry I'm not sure what you mean.

> Will the font metrics do this for me

The font metrics class will help you determine the size characters will be rendered at.
nick5454Author Commented:
smaller, x-smaller is html default sizes that are in relation to thew browser


I'm confused, are we talking about fonts in the applet, or the html?
As I said the font size is not related to resolution. you can get the browser base fontsize by using this javascript:

<script language="JavaScript">
function getDefaultFontSize() {
  var getElement = document.getElementsByTagName("html");
  var ele = getElement[0];
  if (document.defaultView) {    
    var currentFontSize = document.defaultView.getComputedStyle(ele, null).getPropertyValue(fontSize);  
  else if (ele.currentStyle) {    
    var currentFontSize = ele.currentStyle.fontSize;
  var currFontSize = parseInt(currentFontSize, 10);

  return( currFontSize );
  <p>abcdef ABCDEF 12345</p>
  <p>default font size: <script> document.write( getDefaultFontSize() ); </script></p>

you can change the IE's text size setting and refresh this page to see what you get. this is what I get from IE6:
large: 16pt, larger: 14pt, default: 12pt, smaller: 10pt, smallest: 9pt.

here is how you can communicate between javascript and applet:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to kennethxu

Please leave any comments here within the next seven days.


EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.