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 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 { | 102 { |
103 ASSERT(typesettingFeatures & (Kerning | Ligatures)); | 103 ASSERT(typesettingFeatures & (Kerning | Ligatures)); |
104 | 104 |
105 if (!glyphBuffer) | 105 if (!glyphBuffer) |
106 return 0; | 106 return 0; |
107 | 107 |
108 unsigned glyphBufferSize = glyphBuffer->size(); | 108 unsigned glyphBufferSize = glyphBuffer->size(); |
109 if (glyphBuffer->size() <= lastGlyphCount + 1) | 109 if (glyphBuffer->size() <= lastGlyphCount + 1) |
110 return 0; | 110 return 0; |
111 | 111 |
112 GlyphBufferAdvance* advances = glyphBuffer->advances(0); | 112 FloatSize* advances = glyphBuffer->advances(0); |
113 float widthDifference = 0; | 113 float widthDifference = 0; |
114 for (unsigned i = lastGlyphCount; i < glyphBufferSize; ++i) | 114 for (unsigned i = lastGlyphCount; i < glyphBufferSize; ++i) |
115 widthDifference -= advances[i].width(); | 115 widthDifference -= advances[i].width(); |
116 | 116 |
117 for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) { | 117 for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) { |
118 int spaceOffset = charactersTreatedAsSpace[i].first; | 118 int spaceOffset = charactersTreatedAsSpace[i].first; |
119 const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = cha
ractersTreatedAsSpace[i].second; | 119 const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = cha
ractersTreatedAsSpace[i].second; |
120 if (spaceOffset && !originalAdvances.characterIsSpace) | 120 if (spaceOffset && !originalAdvances.characterIsSpace) |
121 glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.ad
vanceBeforeCharacter); | 121 glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.ad
vanceBeforeCharacter); |
122 glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtC
haracter); | 122 glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtC
haracter); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 unsigned oldSize = glyphBuffer.size(); | 331 unsigned oldSize = glyphBuffer.size(); |
332 advance(m_currentCharacter + 1, &glyphBuffer); | 332 advance(m_currentCharacter + 1, &glyphBuffer); |
333 float w = 0; | 333 float w = 0; |
334 for (unsigned i = oldSize; i < glyphBuffer.size(); ++i) | 334 for (unsigned i = oldSize; i < glyphBuffer.size(); ++i) |
335 w += glyphBuffer.advanceAt(i).width(); | 335 w += glyphBuffer.advanceAt(i).width(); |
336 width = w; | 336 width = w; |
337 return glyphBuffer.size() > oldSize; | 337 return glyphBuffer.size() > oldSize; |
338 } | 338 } |
339 | 339 |
340 } | 340 } |
OLD | NEW |