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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 GlyphBufferAdvance* 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 if (!ltr) | |
118 glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount); | |
119 | |
120 fontData->applyTransforms(glyphBuffer->glyphs(lastGlyphCount), advances + la
stGlyphCount, glyphBufferSize - lastGlyphCount, typesettingFeatures); | |
121 | |
122 if (!ltr) | |
123 glyphBuffer->reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount); | |
124 | |
125 for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) { | 117 for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) { |
126 int spaceOffset = charactersTreatedAsSpace[i].first; | 118 int spaceOffset = charactersTreatedAsSpace[i].first; |
127 const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = cha
ractersTreatedAsSpace[i].second; | 119 const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = cha
ractersTreatedAsSpace[i].second; |
128 if (spaceOffset && !originalAdvances.characterIsSpace) | 120 if (spaceOffset && !originalAdvances.characterIsSpace) |
129 glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.ad
vanceBeforeCharacter); | 121 glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.ad
vanceBeforeCharacter); |
130 glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtC
haracter); | 122 glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtC
haracter); |
131 } | 123 } |
132 charactersTreatedAsSpace.clear(); | 124 charactersTreatedAsSpace.clear(); |
133 | 125 |
134 for (unsigned i = lastGlyphCount; i < glyphBufferSize; ++i) | 126 for (unsigned i = lastGlyphCount; i < glyphBufferSize; ++i) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 unsigned oldSize = glyphBuffer.size(); | 331 unsigned oldSize = glyphBuffer.size(); |
340 advance(m_currentCharacter + 1, &glyphBuffer); | 332 advance(m_currentCharacter + 1, &glyphBuffer); |
341 float w = 0; | 333 float w = 0; |
342 for (unsigned i = oldSize; i < glyphBuffer.size(); ++i) | 334 for (unsigned i = oldSize; i < glyphBuffer.size(); ++i) |
343 w += glyphBuffer.advanceAt(i).width(); | 335 w += glyphBuffer.advanceAt(i).width(); |
344 width = w; | 336 width = w; |
345 return glyphBuffer.size() > oldSize; | 337 return glyphBuffer.size() > oldSize; |
346 } | 338 } |
347 | 339 |
348 } | 340 } |
OLD | NEW |