Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4183540

calling getFontMetrics with very large font causes window manager to crash

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Won't Fix
    • Affects Version/s: 1.1.6, 1.1.8, 1.2.2
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.6, solaris_7

      Description

      Calling getFontMetrics(font) with a very large font causes the window
      manager to crash.

      When the below program is running getFontMetrics will take longer and longer to process as the font sizes increase. When font size 1000 is used the system
      hangs (can't do anything, system is pegged @100%) and eventually the window
      manager will crash.

      import java.awt.*;

      public class FontMetricsTest {

        public static void main(String args[]) {
                    
          int fontSize[] = {5,25,50,100,500,1000,10000,Integer.MAX_VALUE};
          Toolkit toolkit = Toolkit.getDefaultToolkit();
              
          for (int i = 0; i < fontSize.length; i++) {
           System.out.println("Font size: " + fontSize[i]);
           Font ft = new Font("TimesRoman", Font.PLAIN, fontSize[i]);
              
              FontMetrics fm = toolkit.getFontMetrics(ft);
      System.out.println("Font metrics: " + fm.toString());
          }
        }
      }

        Attachments

          Activity

            People

            • Assignee:
              rraysunw Richard Ray (Inactive)
              Reporter:
              mcolburnsunw Michael Colburn (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: