Index: Source/platform/fonts/Character.cpp |
diff --git a/Source/platform/fonts/Character.cpp b/Source/platform/fonts/Character.cpp |
index 40ccd3ee22fecd4196832e4db6ffed5b7cd1903f..8848ba04d59d3716704a3f65c5cbbabe0dee3f1a 100644 |
--- a/Source/platform/fonts/Character.cpp |
+++ b/Source/platform/fonts/Character.cpp |
@@ -272,32 +272,32 @@ 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 bool distributeJustification) |
{ |
unsigned count = 0; |
if (direction == LTR) { |
for (size_t i = 0; i < length; ++i) { |
- if (treatAsSpace(characters[i])) { |
+ if (treatAsSpace(characters[i]) || distributeJustification) |
count++; |
- isAfterExpansion = true; |
- } else { |
- isAfterExpansion = false; |
- } |
} |
+ if (treatAsSpace(characters[length - 1])) |
+ isAfterExpansion = true; |
+ else |
+ isAfterExpansion = false; |
} else { |
for (size_t i = length; i > 0; --i) { |
- if (treatAsSpace(characters[i - 1])) { |
+ if (treatAsSpace(characters[i - 1]) || distributeJustification) |
count++; |
- isAfterExpansion = true; |
- } else { |
- isAfterExpansion = false; |
- } |
} |
+ 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 bool distributeJustification) |
{ |
static bool expandAroundIdeographs = FontPlatformFeatures::canExpandAroundIdeographsInComplexText(); |
unsigned count = 0; |