Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 0.43 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Java Font Size vs HTML Font Size
  2. Font font = new Font(fontName, fontWeight, fontSize);
  3.        
  4. Java assumes 72 dpi screen resolution Windows uses 96 dpi or 120 dpi depending
  5. on your font size setting in the display properties.
  6.        
  7. instead of using getNormalizingTransform() you have to use getScreenResolution()
  8.        
  9. int screenRes = Toolkit.getDefaultToolkit().getScreenResolution();
  10. int fontSize = (int)Math.round(12.0 * screenRes / 72.0);