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

Font substitution in TextLayout / LineBreakMeasurer is inconsistent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.2
    • 1.2.0, 1.2.2
    • client-libs
    • None
    • 2d
    • 1.2.2
    • generic, sparc
    • solaris_2.5, windows_nt

      If a Font is not specified directly (with the TextAttribute.FONT key) and TextLayout finds a character which is not displayable in the current Font, TextLayout will search for a Font which can display the character. The actual search is in SunGraphicsEnvironment.getBestFontFor. TextLayout uses maximal Font runs; that is, it displays as many characters as possible before switching Fonts.

      Here's the problem with this approach. Consider the text: AB<aleph><bet>AB - all in one style run with no Font specified. Suppose initially TextLayout selects a Font with Latin-1, but not Hebrew. The first two characters will be in this Font. Then it hits the Hebrew, and switches to a Font like Cyberbit. Then the second AB sequence is in a different Font than the first, even though they have the same style. This creates a bug in TextMeasurer, where text is measured in one Font and drawn in another.

      Once text is measured in a particular font, it should remain in that font.

            jraleysunw John Raley (Inactive)
            jraleysunw John Raley (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: