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

Side by Side Diff: Source/core/rendering/svg/SVGTextRunRenderingContext.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, 9 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
« no previous file with comments | « Source/core/rendering/svg/SVGTextRunRenderingContext.h ('k') | Source/core/svg/SVGFontData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return 0; 66 return 0;
67 } 67 }
68 68
69 static inline RenderSVGResource* activePaintingResourceFromRun(const TextRun& ru n) 69 static inline RenderSVGResource* activePaintingResourceFromRun(const TextRun& ru n)
70 { 70 {
71 if (TextRun::RenderingContext* renderingContext = run.renderingContext()) 71 if (TextRun::RenderingContext* renderingContext = run.renderingContext())
72 return static_cast<SVGTextRunRenderingContext*>(renderingContext)->activ ePaintingResource(); 72 return static_cast<SVGTextRunRenderingContext*>(renderingContext)->activ ePaintingResource();
73 return 0; 73 return 0;
74 } 74 }
75 75
76 float SVGTextRunRenderingContext::floatWidthUsingSVGFont(const Font& font, const TextRun& run, int& charsConsumed, String& glyphName) const 76 float SVGTextRunRenderingContext::floatWidthUsingSVGFont(const Font& font, const TextRun& run, int& charsConsumed, Glyph& glyphId) const
77 { 77 {
78 WidthIterator it(&font, run); 78 WidthIterator it(&font, run);
79 GlyphBuffer glyphBuffer; 79 GlyphBuffer glyphBuffer;
80 charsConsumed += it.advance(run.length(), &glyphBuffer); 80 charsConsumed += it.advance(run.length(), &glyphBuffer);
81 glyphName = it.lastGlyphName(); 81 glyphId = !glyphBuffer.isEmpty() ? glyphBuffer.glyphAt(0) : 0;
82 return it.runWidthSoFar(); 82 return it.runWidthSoFar();
83 } 83 }
84 84
85 void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const T extRun& run, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const 85 void SVGTextRunRenderingContext::drawSVGGlyphs(GraphicsContext* context, const T extRun& run, const SimpleFontData* fontData, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
86 { 86 {
87 SVGFontElement* fontElement = 0; 87 SVGFontElement* fontElement = 0;
88 SVGFontFaceElement* fontFaceElement = 0; 88 SVGFontFaceElement* fontFaceElement = 0;
89 89
90 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(fontDa ta, fontFaceElement, fontElement); 90 const SVGFontData* svgFontData = svgFontAndFontFaceElementForFontData(fontDa ta, fontFaceElement, fontElement);
91 if (!fontElement || !fontFaceElement) 91 if (!fontElement || !fontFaceElement)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Restore original state of the SVG Font glyph table and the current font f allback list, 239 // Restore original state of the SVG Font glyph table and the current font f allback list,
240 // to assure the next lookup of the same glyph won't immediately return the fallback glyph. 240 // to assure the next lookup of the same glyph won't immediately return the fallback glyph.
241 page->setGlyphDataForCharacter(character, glyphData.glyph, originalFontData) ; 241 page->setGlyphDataForCharacter(character, glyphData.glyph, originalFontData) ;
242 ASSERT(fallbackGlyphData.fontData); 242 ASSERT(fallbackGlyphData.fontData);
243 return fallbackGlyphData; 243 return fallbackGlyphData;
244 } 244 }
245 245
246 } 246 }
247 247
248 #endif 248 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextRunRenderingContext.h ('k') | Source/core/svg/SVGFontData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698