You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/02/10 07:56:41 UTC

[1/2] git commit: [flex-tlf] [refs/heads/develop] - FLEX-34020 In TLF truncation, these static variables got re-used by the various attempts at composing different lengths of text to see what would fit. Changed to instance vars and all tests still passe

Updated Branches:
  refs/heads/develop 53a58595e -> db303b541


FLEX-34020 In TLF truncation, these static variables got re-used by the various attempts at composing different lengths of text to see what would fit.  Changed to instance vars and all tests still passed.


Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/f8c83695
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/f8c83695
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/f8c83695

Branch: refs/heads/develop
Commit: f8c8369543a5a92f0727cce8330de8d4ecf8670c
Parents: 53a5859
Author: Alex Harui <ah...@apache.org>
Authored: Sun Feb 9 22:54:14 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Feb 9 22:54:14 2014 -0800

----------------------------------------------------------------------
 textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/f8c83695/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as b/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
index b738cac..c59999b 100644
--- a/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
+++ b/textLayout/src/flashx/textLayout/factory/TextLineFactoryBase.as
@@ -84,9 +84,9 @@ package flashx.textLayout.factory
 		static tlf_internal var _factoryComposer:SimpleCompose;
 
 		/** @private */		
-		static protected var _truncationLineIndex:int; 	// used during truncation
+		protected var _truncationLineIndex:int; 	// used during truncation
 		/** @private */		
-		static protected var _pass0Lines:Array; 		// used during truncation
+		protected var _pass0Lines:Array; 		// used during truncation
 		
 		/** @private return the next factory composer that will be used */
 		static tlf_internal function peekFactoryCompose():SimpleCompose


[2/2] git commit: [flex-tlf] [refs/heads/develop] - FLEX-33985 In RTL text, computing the next/previous atom is much more tricky

Posted by ah...@apache.org.
FLEX-33985 In RTL text, computing the next/previous atom is much more tricky


Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/db303b54
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/db303b54
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/db303b54

Branch: refs/heads/develop
Commit: db303b5410522441a7afaeb7553bb4222735ecaf
Parents: f8c8369
Author: Alex Harui <ah...@apache.org>
Authored: Sun Feb 9 22:55:19 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Feb 9 22:55:19 2014 -0800

----------------------------------------------------------------------
 .../textLayout/elements/ParagraphElement.as     | 119 ++++++++++++++-----
 1 file changed, 90 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/db303b54/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/elements/ParagraphElement.as b/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
index 896f873..fbf2e68 100644
--- a/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
+++ b/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
@@ -481,26 +481,59 @@ package flashx.textLayout.elements
 			if (ContainerController.tlf_internal::usesDiscretionaryHyphens)
 			{
 				var textBlock:TextBlock = getTextBlock();
+                var isRTL:Boolean = textBlock.bidiLevel == 1;
 				var tl:TextLine = textBlock.getTextLineAtCharIndex(relativePosition);
 				var currentAtomIndex:int = tl.getAtomIndexAtCharIndex(relativePosition);
-				if (currentAtomIndex == 0)
-				{
-					tl = tl.previousLine;
-					if (!tl)
-						return -1;
-					// need this when 0x2028 line separator in use
-					if (tl.textBlockBeginIndex + tl.rawTextLength == relativePosition)
-						return tl.textBlockBeginIndex + tl.rawTextLength - 1;
-					return tl.textBlockBeginIndex + tl.rawTextLength;
-				}
-				while (--relativePosition)
-				{
-					if (tl.getAtomIndexAtCharIndex(relativePosition) < currentAtomIndex)
-						break;
-				}
+                trace("relpos", relativePosition, "atomIndex", currentAtomIndex);
+                if (isRTL)
+                {
+                   var foo:int = getTextBlock().findPreviousAtomBoundary(relativePosition);
+                   if (currentAtomIndex == 0)
+                   {
+                       // when cursor is left of all characters (end of line)
+                       // atomIndex is 0, so compensate
+                       if (tl.atomCount > 0)
+                       {
+                           while (--relativePosition)
+                           {
+                               if (tl.getAtomIndexAtCharIndex(relativePosition) != currentAtomIndex)
+                                   break;
+                           }
+                       }
+                   }
+                   else
+                   {
+                       while (--relativePosition)
+                       {
+                           if (tl.getAtomIndexAtCharIndex(relativePosition) != currentAtomIndex)
+                               break;
+                       }
+                   }
+                   trace("previous", relativePosition, foo);
+                }
+                else
+                {
+    				if (currentAtomIndex == 0)
+    				{
+    					tl = tl.previousLine;
+    					if (!tl)
+    						return -1;
+    					// need this when 0x2028 line separator in use
+    					if (tl.textBlockBeginIndex + tl.rawTextLength == relativePosition)
+    						return tl.textBlockBeginIndex + tl.rawTextLength - 1;
+    					return tl.textBlockBeginIndex + tl.rawTextLength;
+    				}
+    				while (--relativePosition)
+    				{
+    					if (tl.getAtomIndexAtCharIndex(relativePosition) < currentAtomIndex)
+    						break;
+    				}
+                }
 				return relativePosition;
 			}
-			return getTextBlock().findPreviousAtomBoundary(relativePosition);
+            var pos:int = getTextBlock().findPreviousAtomBoundary(relativePosition);
+            trace("previous", relativePosition, pos);
+			return pos;
 		}
 
 		/** 
@@ -526,23 +559,51 @@ package flashx.textLayout.elements
 			if (ContainerController.tlf_internal::usesDiscretionaryHyphens)
 			{
 				var textBlock:TextBlock = getTextBlock();
+                var isRTL:Boolean = textBlock.bidiLevel == 1;
 				var tl:TextLine = textBlock.getTextLineAtCharIndex(relativePosition);
 				var currentAtomIndex:int = tl.getAtomIndexAtCharIndex(relativePosition);
-				if (currentAtomIndex == tl.atomCount - 1)
-				{
-					tl = tl.nextLine;
-					if (!tl)
-						return -1;
-					return tl.textBlockBeginIndex;
-				}
-				while (++relativePosition)
-				{
-					if (tl.getAtomIndexAtCharIndex(relativePosition) > currentAtomIndex)
-						break;
-				}
+                trace("relpos", relativePosition, "atomIndex", currentAtomIndex);
+                if (isRTL)
+                {
+                    var foo:int = getTextBlock().findNextAtomBoundary(relativePosition);
+                    if (currentAtomIndex == 0)
+                    {
+                        while (++relativePosition)
+                        {
+                            if (tl.getAtomIndexAtCharIndex(relativePosition) != currentAtomIndex)
+                                break;
+                        }
+                    }
+                    else
+                    {
+                        while (++relativePosition)
+                        {
+                            if (tl.getAtomIndexAtCharIndex(relativePosition) != currentAtomIndex)
+                                break;
+                        }
+                    }
+                    trace("next", relativePosition, foo);
+                }
+                else
+                {
+    				if (currentAtomIndex == tl.atomCount - 1)
+    				{
+    					tl = tl.nextLine;
+    					if (!tl)
+    						return -1;
+    					return tl.textBlockBeginIndex;
+    				}
+    				while (++relativePosition)
+    				{
+    					if (tl.getAtomIndexAtCharIndex(relativePosition) > currentAtomIndex)
+    						break;
+    				}
+                }
 				return relativePosition;
 			}
-			return getTextBlock().findNextAtomBoundary(relativePosition);
+			var pos:int = getTextBlock().findNextAtomBoundary(relativePosition);
+            trace("next", relativePosition, pos);
+            return pos;
 		}
 		
 		/** @private */