| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 0x1F110, 0x1F129, | 265 0x1F110, 0x1F129, |
| 266 0x1F130, 0x1F149, | 266 0x1F130, 0x1F149, |
| 267 0x1F150, 0x1F169, | 267 0x1F150, 0x1F169, |
| 268 0x1F170, 0x1F189, | 268 0x1F170, 0x1F189, |
| 269 0x1F200, 0x1F6FF | 269 0x1F200, 0x1F6FF |
| 270 }; | 270 }; |
| 271 | 271 |
| 272 return valueInIntervalList(cjkSymbolRanges, c); | 272 return valueInIntervalList(cjkSymbolRanges, c); |
| 273 } | 273 } |
| 274 | 274 |
| 275 unsigned Character::expansionOpportunityCount(const LChar* characters, size_t le
ngth, TextDirection direction, bool& isAfterExpansion) | 275 unsigned Character::expansionOpportunityCount(const LChar* characters, size_t le
ngth, TextDirection direction, bool& isAfterExpansion, const bool distributeJust
ification) |
| 276 { | 276 { |
| 277 unsigned count = 0; | 277 unsigned count = 0; |
| 278 if (direction == LTR) { | 278 if (direction == LTR) { |
| 279 for (size_t i = 0; i < length; ++i) { | 279 for (size_t i = 0; i < length; ++i) { |
| 280 if (treatAsSpace(characters[i])) { | 280 if (treatAsSpace(characters[i]) || distributeJustification) |
| 281 count++; | 281 count++; |
| 282 isAfterExpansion = true; | |
| 283 } else { | |
| 284 isAfterExpansion = false; | |
| 285 } | |
| 286 } | 282 } |
| 283 if (treatAsSpace(characters[length - 1])) |
| 284 isAfterExpansion = true; |
| 285 else |
| 286 isAfterExpansion = false; |
| 287 } else { | 287 } else { |
| 288 for (size_t i = length; i > 0; --i) { | 288 for (size_t i = length; i > 0; --i) { |
| 289 if (treatAsSpace(characters[i - 1])) { | 289 if (treatAsSpace(characters[i - 1]) || distributeJustification) |
| 290 count++; | 290 count++; |
| 291 isAfterExpansion = true; | |
| 292 } else { | |
| 293 isAfterExpansion = false; | |
| 294 } | |
| 295 } | 291 } |
| 292 if (treatAsSpace(characters[0])) |
| 293 isAfterExpansion = true; |
| 294 else |
| 295 isAfterExpansion = false; |
| 296 } | 296 } |
| 297 return count; | 297 return count; |
| 298 } | 298 } |
| 299 | 299 |
| 300 unsigned Character::expansionOpportunityCount(const UChar* characters, size_t le
ngth, TextDirection direction, bool& isAfterExpansion) | 300 unsigned Character::expansionOpportunityCount(const UChar* characters, size_t le
ngth, TextDirection direction, bool& isAfterExpansion, const bool distributeJust
ification) |
| 301 { | 301 { |
| 302 static bool expandAroundIdeographs = FontPlatformFeatures::canExpandAroundId
eographsInComplexText(); | 302 static bool expandAroundIdeographs = FontPlatformFeatures::canExpandAroundId
eographsInComplexText(); |
| 303 unsigned count = 0; | 303 unsigned count = 0; |
| 304 if (direction == LTR) { | 304 if (direction == LTR) { |
| 305 for (size_t i = 0; i < length; ++i) { | 305 for (size_t i = 0; i < length; ++i) { |
| 306 UChar32 character = characters[i]; | 306 UChar32 character = characters[i]; |
| 307 if (treatAsSpace(character)) { | 307 if (treatAsSpace(character)) { |
| 308 count++; | 308 count++; |
| 309 isAfterExpansion = true; | 309 isAfterExpansion = true; |
| 310 continue; | 310 continue; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 { | 377 { |
| 378 return normalizeSpacesInternal(characters, length); | 378 return normalizeSpacesInternal(characters, length); |
| 379 } | 379 } |
| 380 | 380 |
| 381 String Character::normalizeSpaces(const UChar* characters, unsigned length) | 381 String Character::normalizeSpaces(const UChar* characters, unsigned length) |
| 382 { | 382 { |
| 383 return normalizeSpacesInternal(characters, length); | 383 return normalizeSpacesInternal(characters, length); |
| 384 } | 384 } |
| 385 | 385 |
| 386 } | 386 } |
| OLD | NEW |