changeset 5211:50c8083b3df6

RT-33194: Wrapping width affects not always
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Mon, 30 Sep 2013 19:35:19 -0700
parents a984a34eca51
children d049142f7145
files modules/graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java	Mon Sep 30 14:12:34 2013 -0700
+++ b/modules/graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java	Mon Sep 30 19:35:19 2013 -0700
@@ -164,7 +164,7 @@
 
     public boolean setWrapWidth(float newWidth) {
         float oldWidth = this.wrapWidth;
-        this.wrapWidth = newWidth;
+        this.wrapWidth = Math.max(0, newWidth);
 
         boolean needsLayout = true;
         if (lines != null && oldWidth != 0 && newWidth != 0) {
@@ -1181,7 +1181,7 @@
             }
 
             computeSideBearings(line);
-            
+
             /* Set run location */
             float runX = lineX;
             TextRun[] lineRuns = line.getRuns();
@@ -1192,7 +1192,7 @@
                 runX += run.getWidth();
             }
             if (i + 1 < lines.length) {
-                lineY = Math.max(lineY, lineY + bounds.getHeight() + spacing);                
+                lineY = Math.max(lineY, lineY + bounds.getHeight() + spacing);
             } else {
                 lineY += (bounds.getHeight() - line.getLeading());
             }
@@ -1211,7 +1211,7 @@
         if (strike == null) {
             return null;
         }
-        
+
         boolean underline = (type & TYPE_UNDERLINE) != 0;
         boolean hasUnderline = (flags & FLAGS_CACHED_UNDERLINE) != 0;
         boolean strikethrough = (type & TYPE_STRIKETHROUGH) != 0;
@@ -1221,7 +1221,7 @@
             /* Return last cached value */
             return visualBounds;
         }
-        
+
         flags &= ~(FLAGS_CACHED_STRIKETHROUGH | FLAGS_CACHED_UNDERLINE);
         if (underline) flags |= FLAGS_CACHED_UNDERLINE;
         if (strikethrough) flags |= FLAGS_CACHED_STRIKETHROUGH;
@@ -1283,7 +1283,7 @@
                 }
             }
         }
-        
+
         if (xMin < xMax && yMin < yMax) {
             visualBounds.setBounds(xMin, yMin, xMax, yMax);
         }