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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 && !m_run.spacingDisabled(); | 181 && !m_run.spacingDisabled(); |
182 | 182 |
183 const SimpleFontData* primaryFont = m_font->primaryFont(); | 183 const SimpleFontData* primaryFont = m_font->primaryFont(); |
184 const SimpleFontData* lastFontData = primaryFont; | 184 const SimpleFontData* lastFontData = primaryFont; |
185 bool normalizeSpace = m_run.normalizeSpace(); | 185 bool normalizeSpace = m_run.normalizeSpace(); |
186 | 186 |
187 CharacterData charData; | 187 CharacterData charData; |
188 while (textIterator.consume(charData.character, charData.clusterLength)) { | 188 while (textIterator.consume(charData.character, charData.clusterLength)) { |
189 charData.characterOffset = textIterator.currentCharacter(); | 189 charData.characterOffset = textIterator.currentCharacter(); |
190 | 190 |
191 const GlyphData glyphData = glyphDataForCharacter(charData, normalizeSpa ce); | 191 GlyphData glyphData = glyphDataForCharacter(charData, normalizeSpace); |
192 | |
193 // Some fonts do not have a glyph for zero-width-space, | |
194 // in that case use the space character and override the width. | |
195 float width; | |
196 if (!glyphData.glyph && Character::treatAsZeroWidthSpaceInComplexScript( charData.character)) { | |
197 charData.character = space; | |
198 glyphData = glyphDataForCharacter(charData); | |
199 width = 0; | |
200 } else { | |
201 width = characterWidth(charData.character, glyphData); | |
202 } | |
203 | |
192 Glyph glyph = glyphData.glyph; | 204 Glyph glyph = glyphData.glyph; |
193 const SimpleFontData* fontData = glyphData.fontData; | 205 const SimpleFontData* fontData = glyphData.fontData; |
194 ASSERT(fontData); | 206 ASSERT(fontData); |
195 | 207 |
196 // Now that we have a glyph and font data, get its width. | 208 // Now that we have a glyph and font data, get its width. |
Dominik Röttsches
2014/09/26 12:56:31
This redundant comment can go away now.
| |
197 float width = characterWidth(charData.character, glyphData); | |
198 | |
199 if (m_fallbackFonts && lastFontData != fontData && width) { | 209 if (m_fallbackFonts && lastFontData != fontData && width) { |
200 lastFontData = fontData; | 210 lastFontData = fontData; |
201 cacheFallbackFont(fontData, primaryFont); | 211 cacheFallbackFont(fontData, primaryFont); |
202 } | 212 } |
203 | 213 |
204 if (hasExtraSpacing) | 214 if (hasExtraSpacing) |
205 width = adjustSpacing(width, charData, *fontData, glyphBuffer); | 215 width = adjustSpacing(width, charData, *fontData, glyphBuffer); |
206 | 216 |
207 if (m_accountForGlyphBounds) | 217 if (m_accountForGlyphBounds) |
208 updateGlyphBounds(glyphData, width, !charData.characterOffset); | 218 updateGlyphBounds(glyphData, width, !charData.characterOffset); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 float initialWidth = m_runWidthSoFar; | 258 float initialWidth = m_runWidthSoFar; |
249 | 259 |
250 if (!advance(m_currentCharacter + 1)) | 260 if (!advance(m_currentCharacter + 1)) |
251 return false; | 261 return false; |
252 | 262 |
253 width = m_runWidthSoFar - initialWidth; | 263 width = m_runWidthSoFar - initialWidth; |
254 return true; | 264 return true; |
255 } | 265 } |
256 | 266 |
257 } // namespace blink | 267 } // namespace blink |
OLD | NEW |