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

Use glyph bounding boxes to get visual bounds

XMLWordPrintable

      Presently we use the outline shape of the glyphs as part of the process to calculate visual bounds.
      We've always done it this way even though its relatively expensive and was one of the reasons
      logical bounds is the default
      For FX 2.0, in order to calcuate dirty regions we needed to add a less expensive way to get
      the pixels touched than that so added code that uses the font's glyph bounding box under
      http://javafx-jira.kenai.com/browse/RT-14432
      In that JIRA it was noted "We could also potentially hook up the node's visual bounds to the same code"

      I've been under the impression we actually did that to save getting the outline shape but apparently not.

      I don't think it makes sense for text where we are stroking since (a) we are already getting the shape
      and (b) we need to apply the stroke.

      But for the common FILL case we apparently could.

      The way this would work is that the calculation of visual bounds would create a union of the glyph bounding boxes
      and return that as the bounds. It should be a lot faster than what we have now.

      The principal risk is if fonts turn out to regularly report inaccurate bounds.
      So far we haven't seen problems from too small bounds but the feature is lightly used.
      But we'd also now have to worry about too loose bounds resulting in a string bounds that's too loose/large.
      We'd have to experiment to see.

            yaow Yao Wang (Inactive)
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: