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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/CaseMappingHarfBuzzBufferFiller.cpp

Issue 2386333002: reflow comments in platform/fonts (Closed)
Patch Set: comments Created 4 years, 2 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "CaseMappingHarfBuzzBufferFiller.h" 5 #include "CaseMappingHarfBuzzBufferFiller.h"
6 6
7 #include "wtf/text/WTFString.h" 7 #include "wtf/text/WTFString.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 ASSERT(caseMappedText.length() == bufferLength); 46 ASSERT(caseMappedText.length() == bufferLength);
47 ASSERT(!caseMappedText.is8Bit()); 47 ASSERT(!caseMappedText.is8Bit());
48 hb_buffer_add_utf16(m_harfBuzzBuffer, 48 hb_buffer_add_utf16(m_harfBuzzBuffer,
49 toUint16(caseMappedText.characters16()), bufferLength, 49 toUint16(caseMappedText.characters16()), bufferLength,
50 startIndex, numCharacters); 50 startIndex, numCharacters);
51 } 51 }
52 } 52 }
53 53
54 // TODO(drott): crbug.com/623940 Fix lack of context sensitive case mapping here . 54 // TODO(drott): crbug.com/623940 Fix lack of context sensitive case mapping
55 // here.
55 void CaseMappingHarfBuzzBufferFiller::fillSlowCase(CaseMapIntend caseMapIntend, 56 void CaseMappingHarfBuzzBufferFiller::fillSlowCase(CaseMapIntend caseMapIntend,
56 AtomicString locale, 57 AtomicString locale,
57 const UChar* buffer, 58 const UChar* buffer,
58 unsigned bufferLength, 59 unsigned bufferLength,
59 unsigned startIndex, 60 unsigned startIndex,
60 unsigned numCharacters) { 61 unsigned numCharacters) {
61 // Record pre-context. 62 // Record pre-context.
62 hb_buffer_add_utf16(m_harfBuzzBuffer, toUint16(buffer), bufferLength, 63 hb_buffer_add_utf16(m_harfBuzzBuffer, toUint16(buffer), bufferLength,
63 startIndex, 0); 64 startIndex, 0);
64 65
65 for (unsigned charIndex = startIndex; 66 for (unsigned charIndex = startIndex;
66 charIndex < startIndex + numCharacters;) { 67 charIndex < startIndex + numCharacters;) {
67 unsigned newCharIndex = charIndex; 68 unsigned newCharIndex = charIndex;
68 U16_FWD_1(buffer, newCharIndex, numCharacters); 69 U16_FWD_1(buffer, newCharIndex, numCharacters);
69 String charByChar(&buffer[charIndex], newCharIndex - charIndex); 70 String charByChar(&buffer[charIndex], newCharIndex - charIndex);
70 String caseMappedChar; 71 String caseMappedChar;
71 if (caseMapIntend == CaseMapIntend::UpperCase) 72 if (caseMapIntend == CaseMapIntend::UpperCase)
72 caseMappedChar = charByChar.upper(locale); 73 caseMappedChar = charByChar.upper(locale);
73 else 74 else
74 caseMappedChar = charByChar.lower(locale); 75 caseMappedChar = charByChar.lower(locale);
75 76
76 for (unsigned j = 0; j < caseMappedChar.length();) { 77 for (unsigned j = 0; j < caseMappedChar.length();) {
77 UChar32 codepoint = 0; 78 UChar32 codepoint = 0;
78 U16_NEXT(caseMappedChar.characters16(), j, caseMappedChar.length(), 79 U16_NEXT(caseMappedChar.characters16(), j, caseMappedChar.length(),
79 codepoint); 80 codepoint);
80 // Add all characters of the case mapping result at the same cluster posit ion. 81 // Add all characters of the case mapping result at the same cluster
82 // position.
81 hb_buffer_add(m_harfBuzzBuffer, codepoint, charIndex); 83 hb_buffer_add(m_harfBuzzBuffer, codepoint, charIndex);
82 } 84 }
83 charIndex = newCharIndex; 85 charIndex = newCharIndex;
84 } 86 }
85 87
86 // Record post-context 88 // Record post-context
87 hb_buffer_add_utf16(m_harfBuzzBuffer, toUint16(buffer), bufferLength, 89 hb_buffer_add_utf16(m_harfBuzzBuffer, toUint16(buffer), bufferLength,
88 startIndex + numCharacters, 0); 90 startIndex + numCharacters, 0);
89 } 91 }
90 92
91 } // namespace blink 93 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698