OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008 Holger Hans Peter Freyther | 3 * Copyright (C) 2008 Holger Hans Peter Freyther |
4 * Copyright (C) 2014 Google Inc. All rights reserved. | 4 * Copyright (C) 2014 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 m_fallbackFonts->add(fontData); | 98 m_fallbackFonts->add(fontData); |
99 } | 99 } |
100 | 100 |
101 float SimpleShaper::adjustSpacing(float width, const CharacterData& charData) | 101 float SimpleShaper::adjustSpacing(float width, const CharacterData& charData) |
102 { | 102 { |
103 // Account for letter-spacing. | 103 // Account for letter-spacing. |
104 if (width) | 104 if (width) |
105 width += m_font->fontDescription().letterSpacing(); | 105 width += m_font->fontDescription().letterSpacing(); |
106 | 106 |
107 bool isExpansionOpportunity = Character::treatAsSpace(charData.character) ||
(m_run.textJustify() == TextJustifyDistribute); | 107 bool isExpansionOpportunity = Character::treatAsSpace(charData.character) ||
(m_run.textJustify() == TextJustifyDistribute); |
108 if (isExpansionOpportunity) { | 108 if (isExpansionOpportunity || (m_run.textJustify() == TextJustifyAuto && Cha
racter::isCJKIdeographOrSymbol(charData.character))) { |
109 // Distribute the run's total expansion evenly over all expansion opport
unities in the run. | 109 // Distribute the run's total expansion evenly over all expansion opport
unities in the run. |
110 if (m_expansion) { | 110 if (m_expansion) { |
111 if (!isExpansionOpportunity && !m_isAfterExpansion) { | 111 if (!isExpansionOpportunity && !m_isAfterExpansion) { |
112 // Take the expansion opportunity before this ideograph. | 112 // Take the expansion opportunity before this ideograph. |
113 m_expansion -= m_expansionPerOpportunity; | 113 m_expansion -= m_expansionPerOpportunity; |
114 m_runWidthSoFar += m_expansionPerOpportunity; | 114 m_runWidthSoFar += m_expansionPerOpportunity; |
115 } | 115 } |
116 if (m_run.allowsTrailingExpansion() | 116 if (m_run.allowsTrailingExpansion() |
117 || (m_run.ltr() && charData.characterOffset + charData.clusterLe
ngth < static_cast<size_t>(m_run.length())) | 117 || (m_run.ltr() && charData.characterOffset + charData.clusterLe
ngth < static_cast<size_t>(m_run.length())) |
118 || (m_run.rtl() && charData.characterOffset)) { | 118 || (m_run.rtl() && charData.characterOffset)) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 float initialWidth = m_runWidthSoFar; | 242 float initialWidth = m_runWidthSoFar; |
243 | 243 |
244 if (!advance(m_currentCharacter + 1)) | 244 if (!advance(m_currentCharacter + 1)) |
245 return false; | 245 return false; |
246 | 246 |
247 width = m_runWidthSoFar - initialWidth; | 247 width = m_runWidthSoFar - initialWidth; |
248 return true; | 248 return true; |
249 } | 249 } |
250 | 250 |
251 } // namespace blink | 251 } // namespace blink |
OLD | NEW |