Index: Source/platform/fonts/Character.cpp |
diff --git a/Source/platform/fonts/Character.cpp b/Source/platform/fonts/Character.cpp |
index dec8b4d2728d522557ba00831ed7228dcce4429f..b66c828674ec5a09311f656a474fa4fdce487fdb 100644 |
--- a/Source/platform/fonts/Character.cpp |
+++ b/Source/platform/fonts/Character.cpp |
@@ -261,32 +261,40 @@ bool Character::isCJKIdeographOrSymbol(UChar32 c) |
return valueInIntervalList(cjkSymbolRanges, c); |
} |
-unsigned Character::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion) |
+unsigned Character::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, const ETextJustify textJustify) |
{ |
unsigned count = 0; |
- if (direction == LTR) { |
- for (size_t i = 0; i < length; ++i) { |
- if (treatAsSpace(characters[i])) { |
- count++; |
- isAfterExpansion = true; |
- } else { |
- isAfterExpansion = false; |
- } |
- } |
+ if (textJustify == JustifyDistribute) { |
+ count = length - 1; |
} else { |
- for (size_t i = length; i > 0; --i) { |
- if (treatAsSpace(characters[i - 1])) { |
- count++; |
- isAfterExpansion = true; |
- } else { |
- isAfterExpansion = false; |
+ if (direction == LTR) { |
+ for (size_t i = 0; i < length; ++i) { |
+ if (treatAsSpace(characters[i])) |
+ count++; |
+ } |
+ } else { |
+ for (size_t i = length; i > 0; --i) { |
+ if (treatAsSpace(characters[i - 1])) |
+ count++; |
} |
} |
} |
+ if (direction == LTR) { |
+ if (treatAsSpace(characters[length - 1])) |
leviw_travelin_and_unemployed
2014/08/18 17:55:43
int lastCharacter = (direction == ltr) ? length -
dw.im
2014/08/21 00:20:55
Cool!
|
+ isAfterExpansion = true; |
+ else |
+ isAfterExpansion = false; |
+ } else { |
+ if (treatAsSpace(characters[0])) |
+ isAfterExpansion = true; |
+ else |
+ isAfterExpansion = false; |
+ } |
+ |
return count; |
} |
-unsigned Character::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion) |
+unsigned Character::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, const ETextJustify textJustify) |
{ |
static bool expandAroundIdeographs = FontPlatformFeatures::canExpandAroundIdeographsInComplexText(); |
unsigned count = 0; |