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

TextLayout.getBlackBoxBounds() values questionable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.2.0
    • 1.2.0
    • client-libs
    • 2d
    • 1.2beta4
    • sparc
    • solaris_2.6
    • Verified

      The values that are getting returned for the TextLayout.getBlackBoxBounds api are questionable. I'm created a layout with the TimesRoman font size 24 and the getBlackBoxBounds is returning (116.0625, -21.7265625, 86.70703125, 16.640625).

      Font f = new Font("TimesRoman",Font.BOLD,24);
      TextLayout tls = new TextLayout("TextLayout", f);
      g2.setColor(Color.black);
      g2.drawString(tls, 10.0f, tls.getAscent() );
      g2.draw(tls.getBlackBoxBounds(0, 4));
      Rectangle2D r = tls.getBlackBoxBounds(0, 4).getBounds2D();
      System.out.println("BoxBounds=( " + r.getX() + "," + r.getY() + "," +
                         r.getWidth() + "," + r.getHeight() + ")");

            jkaulorcl Jeet Kaul (Inactive)
            blichtensunw Brian Lichtenwalter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: