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

Side by Side Diff: Source/core/rendering/svg/SVGTextMetricsBuilder.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) Research In Motion Limited 2010-2012. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 GlyphBuffer glyphBuffer; 60 GlyphBuffer glyphBuffer;
61 unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1, &glyphBuffer); 61 unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1, &glyphBuffer);
62 if (!metricsLength) { 62 if (!metricsLength) {
63 m_currentMetrics = SVGTextMetrics(); 63 m_currentMetrics = SVGTextMetrics();
64 return; 64 return;
65 } 65 }
66 66
67 float currentWidth = m_simpleWidthIterator->runWidthSoFar() - m_totalWidth; 67 float currentWidth = m_simpleWidthIterator->runWidthSoFar() - m_totalWidth;
68 m_totalWidth = m_simpleWidthIterator->runWidthSoFar(); 68 m_totalWidth = m_simpleWidthIterator->runWidthSoFar();
69 69
70 #if ENABLE(SVG_FONTS) 70 Glyph glyphId = glyphBuffer.glyphAt(0);
71 m_currentMetrics = SVGTextMetrics(m_text, m_textPosition, metricsLength, cur rentWidth, m_simpleWidthIterator->lastGlyphName()); 71 m_currentMetrics = SVGTextMetrics(m_text, m_textPosition, metricsLength, cur rentWidth, glyphId);
72 #else
73 m_currentMetrics = SVGTextMetrics(m_text, m_textPosition, metricsLength, cur rentWidth, emptyString());
74 #endif
75 } 72 }
76 73
77 void SVGTextMetricsBuilder::advanceComplexText() 74 void SVGTextMetricsBuilder::advanceComplexText()
78 { 75 {
79 unsigned metricsLength = currentCharacterStartsSurrogatePair() ? 2 : 1; 76 unsigned metricsLength = currentCharacterStartsSurrogatePair() ? 2 : 1;
80 m_currentMetrics = SVGTextMetrics::measureCharacterRange(m_text, m_textPosit ion, metricsLength); 77 m_currentMetrics = SVGTextMetrics::measureCharacterRange(m_text, m_textPosit ion, metricsLength);
81 m_complexStartToCurrentMetrics = SVGTextMetrics::measureCharacterRange(m_tex t, 0, m_textPosition + metricsLength); 78 m_complexStartToCurrentMetrics = SVGTextMetrics::measureCharacterRange(m_tex t, 0, m_textPosition + metricsLength);
82 ASSERT(m_currentMetrics.length() == metricsLength); 79 ASSERT(m_currentMetrics.length() == metricsLength);
83 80
84 // Frequent case for Arabic text: when measuring a single character the arab ic isolated form is taken 81 // Frequent case for Arabic text: when measuring a single character the arab ic isolated form is taken
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 217 }
221 218
222 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap) 219 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(RenderSVGText* textR oot, RenderSVGInlineText* stopAtLeaf, SVGCharacterDataMap& allCharactersMap)
223 { 220 {
224 ASSERT(textRoot); 221 ASSERT(textRoot);
225 MeasureTextData data(&allCharactersMap); 222 MeasureTextData data(&allCharactersMap);
226 walkTree(textRoot, stopAtLeaf, &data); 223 walkTree(textRoot, stopAtLeaf, &data);
227 } 224 }
228 225
229 } 226 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGTextMetrics.cpp ('k') | Source/core/rendering/svg/SVGTextRunRenderingContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698