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

Unified Diff: Source/core/rendering/svg/SVGTextLayoutEngineSpacing.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h ('k') | Source/core/rendering/svg/SVGTextMetrics.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGTextLayoutEngineSpacing.cpp
diff --git a/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.cpp b/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.cpp
index 282d5bc4eacd332a129f1c80a34e63a6b299c73c..39683386a79e18f7194c3d6f3fbc7cbf18e08e61 100644
--- a/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.cpp
+++ b/Source/core/rendering/svg/SVGTextLayoutEngineSpacing.cpp
@@ -37,15 +37,18 @@ namespace WebCore {
SVGTextLayoutEngineSpacing::SVGTextLayoutEngineSpacing(const Font& font)
: m_font(font)
, m_lastCharacter(0)
+#if ENABLE(SVG_FONTS)
+ , m_lastGlyph(0)
+#endif
{
}
-float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, const SVGTextMetrics::Glyph& currentGlyph)
+float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, Glyph currentGlyph)
{
#if ENABLE(SVG_FONTS)
const SimpleFontData* fontData = m_font.primaryFont();
if (!fontData->isSVGFont()) {
- m_lastGlyph.isValid = false;
+ m_lastGlyph = 0;
return 0;
}
@@ -59,24 +62,24 @@ float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, const
SVGFontElement* svgFont = svgFontFace->associatedFontElement();
if (!svgFont) {
- m_lastGlyph.isValid = false;
+ m_lastGlyph = 0;
return 0;
}
float kerning = 0;
- if (m_lastGlyph.isValid) {
+ if (m_lastGlyph) {
if (isVerticalText)
- kerning = svgFont->verticalKerningForPairOfStringsAndGlyphs(m_lastGlyph.unicodeString, m_lastGlyph.name, currentGlyph.unicodeString, currentGlyph.name);
+ kerning = svgFont->verticalKerningForPairOfGlyphs(m_lastGlyph, currentGlyph);
else
- kerning = svgFont->horizontalKerningForPairOfStringsAndGlyphs(m_lastGlyph.unicodeString, m_lastGlyph.name, currentGlyph.unicodeString, currentGlyph.name);
+ kerning = svgFont->horizontalKerningForPairOfGlyphs(m_lastGlyph, currentGlyph);
+
+ kerning *= m_font.fontDescription().computedSize() / m_font.fontMetrics().unitsPerEm();
}
m_lastGlyph = currentGlyph;
- m_lastGlyph.isValid = true;
- kerning *= m_font.fontDescription().computedSize() / m_font.fontMetrics().unitsPerEm();
return kerning;
#else
- return false;
+ return 0;
#endif
}
« no previous file with comments | « Source/core/rendering/svg/SVGTextLayoutEngineSpacing.h ('k') | Source/core/rendering/svg/SVGTextMetrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698