Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: trunk/Source/platform/fonts/Font.cpp

Issue 146503002: Revert 165189 "Rendering text-justify:distribute for 8 bit chara..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/Source/platform/fonts/Font.h ('k') | trunk/Source/platform/fonts/WidthIterator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 0x1F110, 0x1F129, 519 0x1F110, 0x1F129,
520 0x1F130, 0x1F149, 520 0x1F130, 0x1F149,
521 0x1F150, 0x1F169, 521 0x1F150, 0x1F169,
522 0x1F170, 0x1F189, 522 0x1F170, 0x1F189,
523 0x1F200, 0x1F6FF 523 0x1F200, 0x1F6FF
524 }; 524 };
525 525
526 return valueInIntervalList(cjkSymbolRanges, c); 526 return valueInIntervalList(cjkSymbolRanges, c);
527 } 527 }
528 528
529 unsigned Font::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, bool distributeJustification) 529 unsigned Font::expansionOpportunityCount(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
530 { 530 {
531 unsigned count = 0; 531 unsigned count = 0;
532 if (direction == LTR) { 532 if (direction == LTR) {
533 for (size_t i = 0; i < length; ++i) { 533 for (size_t i = 0; i < length; ++i) {
534 if (treatAsSpace(characters[i]) || distributeJustification) 534 if (treatAsSpace(characters[i])) {
535 count++; 535 count++;
536 isAfterExpansion = true;
537 } else
538 isAfterExpansion = false;
536 } 539 }
537 if (treatAsSpace(characters[length - 1]))
538 isAfterExpansion = true;
539 else
540 isAfterExpansion = false;
541 } else { 540 } else {
542 for (size_t i = length; i > 0; --i) { 541 for (size_t i = length; i > 0; --i) {
543 if (treatAsSpace(characters[i - 1]) || distributeJustification) 542 if (treatAsSpace(characters[i - 1])) {
544 count++; 543 count++;
544 isAfterExpansion = true;
545 } else
546 isAfterExpansion = false;
545 } 547 }
546 if (treatAsSpace(characters[0]))
547 isAfterExpansion = true;
548 else
549 isAfterExpansion = false;
550 } 548 }
551 return count; 549 return count;
552 } 550 }
553 551
554 // FIXME: need to take care of text-justify:distribute case 552 unsigned Font::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
555 unsigned Font::expansionOpportunityCount(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion, bool distributeJustification)
556 { 553 {
557 static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText( ); 554 static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText( );
558 unsigned count = 0; 555 unsigned count = 0;
559 if (direction == LTR) { 556 if (direction == LTR) {
560 for (size_t i = 0; i < length; ++i) { 557 for (size_t i = 0; i < length; ++i) {
561 UChar32 character = characters[i]; 558 UChar32 character = characters[i];
562 if (treatAsSpace(character)) { 559 if (treatAsSpace(character)) {
563 count++; 560 count++;
564 isAfterExpansion = true; 561 isAfterExpansion = true;
565 continue; 562 continue;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 614 }
618 615
619 void Font::willUseFontData() const 616 void Font::willUseFontData() const
620 { 617 {
621 const FontFamily& family = fontDescription().family(); 618 const FontFamily& family = fontDescription().family();
622 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty()) 619 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty())
623 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family()); 620 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family());
624 } 621 }
625 622
626 } 623 }
OLDNEW
« no previous file with comments | « trunk/Source/platform/fonts/Font.h ('k') | trunk/Source/platform/fonts/WidthIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698