OLD | NEW |
---|---|
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 "platform/fonts/shaping/ShapeResultSpacing.h" | 5 #include "platform/fonts/shaping/ShapeResultSpacing.h" |
6 | 6 |
7 #include "platform/fonts/FontDescription.h" | 7 #include "platform/fonts/FontDescription.h" |
8 #include "platform/text/TextRun.h" | 8 #include "platform/text/TextRun.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 ShapeResultSpacing::ShapeResultSpacing(const TextRun& run, | 12 ShapeResultSpacing::ShapeResultSpacing(const TextRun& run, |
13 const FontDescription& fontDescription) | 13 const FontDescription& fontDescription) |
14 : m_textRun(run) | 14 : m_textRun(run) |
15 , m_letterSpacing(fontDescription.letterSpacing()) | 15 , m_letterSpacing(fontDescription.letterSpacing()) |
16 , m_wordSpacing(fontDescription.wordSpacing()) | 16 , m_wordSpacing(fontDescription.wordSpacing()) |
17 , m_expansion(run.expansion()) | 17 , m_expansion(run.expansion()) |
18 , m_expansionPerOpportunity(0) | 18 , m_expansionPerOpportunity(0) |
19 , m_expansionOpportunityCount(0) | 19 , m_expansionOpportunityCount(0) |
20 , m_textJustify(TextJustify::TextJustifyAuto) | 20 , m_textJustify(TextJustify::TextJustifyAuto) |
21 , m_hasSpacing(false) | 21 , m_hasSpacing(false) |
22 , m_normalizeSpace(run.normalizeSpace()) | 22 , m_normalizeSpace(run.normalizeSpace()) |
23 , m_allowTabs(run.allowTabs()) | 23 , m_allowTabs(run.allowTabs()) |
24 , m_isAfterExpansion(false) | 24 , m_isAfterExpansion(false) |
25 , m_isVerticalOffset(fontDescription.isVerticalAnyUpright()) | 25 , m_isVerticalOffset(fontDescription.isVerticalAnyUpright()) |
26 { | 26 { |
27 if (m_textRun.spacingDisabled()) | |
eae
2016/03/24 16:37:47
This only applies to SVG, right?
fs
2016/03/24 16:42:59
Yepp:
https://code.google.com/p/chromium/codesear
| |
28 return; | |
29 | |
27 if (!m_letterSpacing && !m_wordSpacing && !m_expansion) | 30 if (!m_letterSpacing && !m_wordSpacing && !m_expansion) |
28 return; | 31 return; |
29 | 32 |
30 m_hasSpacing = true; | 33 m_hasSpacing = true; |
31 | 34 |
32 if (!m_expansion) | 35 if (!m_expansion) |
33 return; | 36 return; |
34 | 37 |
35 // Setup for justifications (expansions.) | 38 // Setup for justifications (expansions.) |
36 m_textJustify = run.getTextJustify(); | 39 m_textJustify = run.getTextJustify(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 | 72 |
70 float ShapeResultSpacing::computeSpacing(const TextRun& run, size_t index, | 73 float ShapeResultSpacing::computeSpacing(const TextRun& run, size_t index, |
71 float& offset) | 74 float& offset) |
72 { | 75 { |
73 if (run.is8Bit()) | 76 if (run.is8Bit()) |
74 return computeSpacing(run.characters8(), run.length(), index, offset); | 77 return computeSpacing(run.characters8(), run.length(), index, offset); |
75 return computeSpacing(run.characters16(), run.length(), index, offset); | 78 return computeSpacing(run.characters16(), run.length(), index, offset); |
76 } | 79 } |
77 | 80 |
78 } // namespace blink | 81 } // namespace blink |
OLD | NEW |