Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Side by Side Diff: Source/core/svg/SVGFontData.cpp

Issue 181443002: Use glyph-ids for lookups of SVG font kerning-pairs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Vector<...>::append -> Vector<...>::appendVector. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (!toSVGAltGlyphElement(parentRenderObjectElement)->hasValidGl yphElements(altGlyphNames)) 180 if (!toSVGAltGlyphElement(parentRenderObjectElement)->hasValidGl yphElements(altGlyphNames))
181 altGlyphNames.clear(); 181 altGlyphNames.clear();
182 } 182 }
183 } 183 }
184 } 184 }
185 185
186 Vector<SVGGlyph> glyphs; 186 Vector<SVGGlyph> glyphs;
187 size_t altGlyphNamesSize = altGlyphNames.size(); 187 size_t altGlyphNamesSize = altGlyphNames.size();
188 if (altGlyphNamesSize) { 188 if (altGlyphNamesSize) {
189 for (size_t index = 0; index < altGlyphNamesSize; ++index) 189 for (size_t index = 0; index < altGlyphNamesSize; ++index)
190 associatedFontElement->collectGlyphsForGlyphName(altGlyphNames[index ], glyphs); 190 associatedFontElement->collectGlyphsForAltGlyphReference(altGlyphNam es[index], glyphs);
191 191
192 // Assign the unicodeStringLength now that its known. 192 // Assign the unicodeStringLength now that its known.
193 size_t glyphsSize = glyphs.size(); 193 size_t glyphsSize = glyphs.size();
194 for (size_t i = 0; i < glyphsSize; ++i) 194 for (size_t i = 0; i < glyphsSize; ++i)
195 glyphs[i].unicodeStringLength = run.length(); 195 glyphs[i].unicodeStringLength = run.length();
196 196
197 // Do not check alt glyphs for compatibility. Just return the first one. 197 // Do not check alt glyphs for compatibility. Just return the first one.
198 // Later code will fail if we do not do this and the glyph is incompatib le. 198 // Later code will fail if we do not do this and the glyph is incompatib le.
199 if (glyphsSize) { 199 if (glyphsSize) {
200 SVGGlyph& svgGlyph = glyphs[0]; 200 SVGGlyph& svgGlyph = glyphs[0];
201 iterator.setLastGlyphName(svgGlyph.glyphName);
202 glyphData.glyph = svgGlyph.tableEntry; 201 glyphData.glyph = svgGlyph.tableEntry;
203 advanceLength = svgGlyph.unicodeStringLength; 202 advanceLength = svgGlyph.unicodeStringLength;
204 return true; 203 return true;
205 } 204 }
206 } else 205 } else
207 associatedFontElement->collectGlyphsForString(remainingTextInRun, glyphs ); 206 associatedFontElement->collectGlyphsForString(remainingTextInRun, glyphs );
208 207
209 size_t glyphsSize = glyphs.size(); 208 size_t glyphsSize = glyphs.size();
210 for (size_t i = 0; i < glyphsSize; ++i) { 209 for (size_t i = 0; i < glyphsSize; ++i) {
211 SVGGlyph& svgGlyph = glyphs[i]; 210 SVGGlyph& svgGlyph = glyphs[i];
212 if (svgGlyph.isPartOfLigature) 211 if (svgGlyph.isPartOfLigature)
213 continue; 212 continue;
214 if (!isCompatibleGlyph(svgGlyph, isVerticalText, language, arabicForms, currentCharacter, currentCharacter + svgGlyph.unicodeStringLength)) 213 if (!isCompatibleGlyph(svgGlyph, isVerticalText, language, arabicForms, currentCharacter, currentCharacter + svgGlyph.unicodeStringLength))
215 continue; 214 continue;
216 iterator.setLastGlyphName(svgGlyph.glyphName);
217 glyphData.glyph = svgGlyph.tableEntry; 215 glyphData.glyph = svgGlyph.tableEntry;
218 advanceLength = svgGlyph.unicodeStringLength; 216 advanceLength = svgGlyph.unicodeStringLength;
219 return true; 217 return true;
220 } 218 }
221 219
222 iterator.setLastGlyphName(String());
223 return false; 220 return false;
224 } 221 }
225 222
226 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, unsigned offset, unsig ned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData ) const 223 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, unsigned offset, unsig ned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData ) const
227 { 224 {
228 ASSERT(fontData->isCustomFont()); 225 ASSERT(fontData->isCustomFont());
229 ASSERT(fontData->isSVGFont()); 226 ASSERT(fontData->isSVGFont());
230 227
231 SVGFontFaceElement* fontFaceElement = this->svgFontFaceElement(); 228 SVGFontFaceElement* fontFaceElement = this->svgFontFaceElement();
232 ASSERT(fontFaceElement); 229 ASSERT(fontFaceElement);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 mirroredCharacters.append(mirroredChar(character)); 310 mirroredCharacters.append(mirroredChar(character));
314 } 311 }
315 } 312 }
316 313
317 return mirroredCharacters.toString(); 314 return mirroredCharacters.toString();
318 } 315 }
319 316
320 } // namespace WebCore 317 } // namespace WebCore
321 318
322 #endif 319 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextRunRenderingContext.cpp ('k') | Source/core/svg/SVGFontElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698