Repository: flex-tlf
Updated Branches:
  refs/heads/develop 8dc66d8c9 -> e10a51adc


FLEX-34098 and FLEX-33985:  Fix more cases in the discretionary hyphens 
workaround


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

Branch: refs/heads/develop
Commit: e10a51adc5e91d21a34adc157e862b80a6071b0d
Parents: 8dc66d8
Author: Alex Harui <[email protected]>
Authored: Mon Mar 17 13:24:27 2014 -0700
Committer: Alex Harui <[email protected]>
Committed: Mon Mar 17 13:24:27 2014 -0700

----------------------------------------------------------------------
 .../src/flashx/textLayout/elements/ParagraphElement.as  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/e10a51ad/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 c2d343b..f4579fc 100644
--- a/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
+++ b/textLayout/src/flashx/textLayout/elements/ParagraphElement.as
@@ -481,10 +481,10 @@ 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);
                 //trace("relpos", relativePosition, "atomIndex", 
currentAtomIndex);
+                var isRTL:Boolean = tl.getAtomBidiLevel(currentAtomIndex) == 1;
                 if (isRTL)
                 {
                    var foo:int = 
getTextBlock().findPreviousAtomBoundary(relativePosition);
@@ -509,6 +509,8 @@ package flashx.textLayout.elements
                                break;
                        }
                    }
+                   if (CharacterUtil.isLowSurrogate(getText(relativePosition, 
relativePosition + 1).charCodeAt(0)))
+                       relativePosition--;
                    //trace("previous", relativePosition, foo);
                 }
                 else
@@ -528,6 +530,8 @@ package flashx.textLayout.elements
                                        if 
(tl.getAtomIndexAtCharIndex(relativePosition) < currentAtomIndex)
                                                break;
                                }
+                    if (CharacterUtil.isLowSurrogate(getText(relativePosition, 
relativePosition + 1).charCodeAt(0)))
+                        relativePosition--;
                 }
                                return relativePosition;
                        }
@@ -559,10 +563,10 @@ 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);
                 //trace("relpos", relativePosition, "atomIndex", 
currentAtomIndex);
+                var isRTL:Boolean = tl.getAtomBidiLevel(currentAtomIndex) == 1;
                 if (isRTL)
                 {
                     var foo:int = 
getTextBlock().findNextAtomBoundary(relativePosition);
@@ -582,6 +586,8 @@ package flashx.textLayout.elements
                                 break;
                         }
                     }
+                    if 
(CharacterUtil.isHighSurrogate(getText(relativePosition, relativePosition + 
1).charCodeAt(0)))
+                        relativePosition++;
                     //trace("next", relativePosition, foo);
                 }
                 else
@@ -598,6 +604,8 @@ package flashx.textLayout.elements
                                        if 
(tl.getAtomIndexAtCharIndex(relativePosition) > currentAtomIndex)
                                                break;
                                }
+                    if 
(CharacterUtil.isHighSurrogate(getText(relativePosition, relativePosition + 
1).charCodeAt(0)))
+                        relativePosition++;
                 }
                                return relativePosition;
                        }

Reply via email to