| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 (UChar32*)cjkSymbolRanges, cjkSymbolRangesCount, c, keyExtractorUChar32)
; | 593 (UChar32*)cjkSymbolRanges, cjkSymbolRangesCount, c, keyExtractorUChar32)
; |
| 594 // Exact matches are CJK Symbols | 594 // Exact matches are CJK Symbols |
| 595 if (*boundingCharacter == c) | 595 if (*boundingCharacter == c) |
| 596 return true; | 596 return true; |
| 597 bool isEndOfRange = ((boundingCharacter - cjkSymbolRanges) % 2); | 597 bool isEndOfRange = ((boundingCharacter - cjkSymbolRanges) % 2); |
| 598 if (*boundingCharacter < c) | 598 if (*boundingCharacter < c) |
| 599 return !isEndOfRange; | 599 return !isEndOfRange; |
| 600 return isEndOfRange; | 600 return isEndOfRange; |
| 601 } | 601 } |
| 602 | 602 |
| 603 unsigned Font::expansionOpportunityCount(const LChar* characters, size_t length,
TextDirection direction, bool& isAfterExpansion) | 603 unsigned Font::expansionOpportunityCount(const LChar* characters, size_t length,
TextDirection direction, bool& isAfterExpansion, bool distributeJustification) |
| 604 { | 604 { |
| 605 unsigned count = 0; | 605 unsigned count = 0; |
| 606 if (direction == LTR) { | 606 if (direction == LTR) { |
| 607 for (size_t i = 0; i < length; ++i) { | 607 for (size_t i = 0; i < length; ++i) { |
| 608 if (treatAsSpace(characters[i])) { | 608 if (treatAsSpace(characters[i]) || distributeJustification) |
| 609 count++; | 609 count++; |
| 610 isAfterExpansion = true; | |
| 611 } else | |
| 612 isAfterExpansion = false; | |
| 613 } | 610 } |
| 611 if (treatAsSpace(characters[length - 1])) |
| 612 isAfterExpansion = true; |
| 613 else |
| 614 isAfterExpansion = false; |
| 614 } else { | 615 } else { |
| 615 for (size_t i = length; i > 0; --i) { | 616 for (size_t i = length; i > 0; --i) { |
| 616 if (treatAsSpace(characters[i - 1])) { | 617 if (treatAsSpace(characters[i - 1]) || distributeJustification) |
| 617 count++; | 618 count++; |
| 618 isAfterExpansion = true; | |
| 619 } else | |
| 620 isAfterExpansion = false; | |
| 621 } | 619 } |
| 620 if (treatAsSpace(characters[0])) |
| 621 isAfterExpansion = true; |
| 622 else |
| 623 isAfterExpansion = false; |
| 622 } | 624 } |
| 623 return count; | 625 return count; |
| 624 } | 626 } |
| 625 | 627 |
| 626 unsigned Font::expansionOpportunityCount(const UChar* characters, size_t length,
TextDirection direction, bool& isAfterExpansion) | 628 // FIXME: need to take care of text-justify:distribute case |
| 629 unsigned Font::expansionOpportunityCount(const UChar* characters, size_t length,
TextDirection direction, bool& isAfterExpansion, bool distributeJustification) |
| 627 { | 630 { |
| 628 static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText(
); | 631 static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText(
); |
| 629 unsigned count = 0; | 632 unsigned count = 0; |
| 630 if (direction == LTR) { | 633 if (direction == LTR) { |
| 631 for (size_t i = 0; i < length; ++i) { | 634 for (size_t i = 0; i < length; ++i) { |
| 632 UChar32 character = characters[i]; | 635 UChar32 character = characters[i]; |
| 633 if (treatAsSpace(character)) { | 636 if (treatAsSpace(character)) { |
| 634 count++; | 637 count++; |
| 635 isAfterExpansion = true; | 638 isAfterExpansion = true; |
| 636 continue; | 639 continue; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 } | 691 } |
| 689 | 692 |
| 690 void Font::willUseFontData() const | 693 void Font::willUseFontData() const |
| 691 { | 694 { |
| 692 const FontFamily& family = fontDescription().family(); | 695 const FontFamily& family = fontDescription().family(); |
| 693 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami
lyIsEmpty()) | 696 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami
lyIsEmpty()) |
| 694 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f
amily.family()); | 697 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f
amily.family()); |
| 695 } | 698 } |
| 696 | 699 |
| 697 } | 700 } |
| OLD | NEW |