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

TextLayout.getCaretInfo(hit) xAdvances on TrueType fonts are way off

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

      TextLayout.getCaretInfo(hit) is not returning the correct xAdvances that are listed when doing a TextLayout.toString. This bug is similiar to #4087651, but the font type is different and the mannerisms are different. Here's info gleaned from the TextLayout.toString() call :

      font=java.awt.Font[family=Courier New Italic,name=Courier New Italic,style=plain,size=18]
      glyphCount=18
      xAdvances={10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758,10.801758}

      TextHitInfo hit = new TextHitInfo(curPos[i], true);
      float[] cInfo = tl.getCaretInfo(hit);

      hit=0 position=250.52
      hit=1 position=198.65
      hit=2 position=208.53

      I'm expecting hit 1 to equal 0 and hit 2 to be the xAdvance of 10.801758.

      Source code has been attached.

      java full version "thanh:10/20/97-22:58"
      setenv JAVA_FONTS /usr/openwin/lib/X11/fonts/TrueType

            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: