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

Side by Side Diff: Source/platform/fonts/UTF16TextIterator.h

Issue 1227883003: Handle U+3099/309A Kana Voiced Sound Marks in complex path (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Mac fails with 1px diff Created 5 years, 5 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
« no previous file with comments | « Source/platform/fonts/Character.cpp ('k') | Source/platform/fonts/UTF16TextIterator.cpp » ('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) Research In Motion Limited 2011. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 27 matching lines...) Expand all
38 UTF16TextIterator(const UChar*, int offset, int endOffset, int length); 38 UTF16TextIterator(const UChar*, int offset, int endOffset, int length);
39 39
40 inline bool consume(UChar32& character) 40 inline bool consume(UChar32& character)
41 { 41 {
42 if (m_offset >= m_endOffset) 42 if (m_offset >= m_endOffset)
43 return false; 43 return false;
44 44
45 character = *m_characters; 45 character = *m_characters;
46 m_currentGlyphLength = 1; 46 m_currentGlyphLength = 1;
47 47
48 if (character < hiraganaLetterSmallACharacter || consumeSlowCase(charact er)) { 48 if (!U16_IS_SURROGATE(character) || consumeSurrogatePair(character)) {
49 // TODO(kojii): This looks broken, we should actually check whether
drott 2015/07/17 15:15:58 Minor: I'd suggest to move this comment to a bug r
kojii 2015/07/17 16:32:58 Moved to crbug.com/511306, thanks for the advice!
50 // the *next* character is U_GC_M_MASK or not.
51 // Also this is redundant with what HarfBuzzShaper does. Either one
52 // should be removed once the simple path is gone: crbug.com/404597
49 if (U_GET_GC_MASK(character) & U_GC_M_MASK) 53 if (U_GET_GC_MASK(character) & U_GC_M_MASK)
50 consumeMultipleUChar(); 54 consumeMultipleUChar();
51 return true; 55 return true;
52 } 56 }
53 57
54 return false; 58 return false;
55 } 59 }
56 60
57 void advance() 61 void advance()
58 { 62 {
59 m_characters += m_currentGlyphLength; 63 m_characters += m_currentGlyphLength;
60 m_offset += m_currentGlyphLength; 64 m_offset += m_currentGlyphLength;
61 } 65 }
62 66
63 int offset() const { return m_offset; } 67 int offset() const { return m_offset; }
64 const UChar* characters() const { return m_characters; } 68 const UChar* characters() const { return m_characters; }
65 const UChar* glyphEnd() const { return m_characters + m_currentGlyphLength; } 69 const UChar* glyphEnd() const { return m_characters + m_currentGlyphLength; }
66 // FIXME: Only used by SimpleShaper, should be removed once the SimpleShaper 70 // FIXME: Only used by SimpleShaper, should be removed once the SimpleShaper
67 // is removed. 71 // is removed.
68 unsigned glyphLength() const { return m_currentGlyphLength; } 72 unsigned glyphLength() const { return m_currentGlyphLength; }
69 73
70 private: 74 private:
71 bool consumeSlowCase(UChar32&); 75 bool consumeSurrogatePair(UChar32&);
72 void consumeMultipleUChar(); 76 void consumeMultipleUChar();
73 UChar32 normalizeVoicingMarks();
74 77
75 const UChar* m_characters; 78 const UChar* m_characters;
76 const UChar* m_charactersEnd; 79 const UChar* m_charactersEnd;
77 int m_offset; 80 int m_offset;
78 int m_endOffset; 81 int m_endOffset;
79 unsigned m_currentGlyphLength; 82 unsigned m_currentGlyphLength;
80 }; 83 };
81 84
82 } 85 }
83 86
84 #endif 87 #endif
OLDNEW
« no previous file with comments | « Source/platform/fonts/Character.cpp ('k') | Source/platform/fonts/UTF16TextIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698