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

Unified Diff: Source/core/rendering/svg/SVGTextMetrics.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/SVGTextMetrics.h ('k') | Source/core/rendering/svg/SVGTextMetricsBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGTextMetrics.cpp
diff --git a/Source/core/rendering/svg/SVGTextMetrics.cpp b/Source/core/rendering/svg/SVGTextMetrics.cpp
index 26c82dbec27c168bde69ded737f9409546fb1dbf..e9bacb475efa3bb09d4aff152610f9d86a10aad6 100644
--- a/Source/core/rendering/svg/SVGTextMetrics.cpp
+++ b/Source/core/rendering/svg/SVGTextMetrics.cpp
@@ -30,6 +30,7 @@ SVGTextMetrics::SVGTextMetrics()
: m_width(0)
, m_height(0)
, m_length(0)
+ , m_glyph(0)
{
}
@@ -37,6 +38,7 @@ SVGTextMetrics::SVGTextMetrics(SVGTextMetrics::MetricsType)
: m_width(0)
, m_height(0)
, m_length(1)
+ , m_glyph(0)
{
}
@@ -51,12 +53,9 @@ SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* textRenderer, const TextRun&
int length = 0;
// Calculate width/height using the scaled font, divide this result by the scalingFactor afterwards.
- m_width = scaledFont.width(run, length, m_glyph.name) / scalingFactor;
+ m_width = scaledFont.width(run, length, m_glyph) / scalingFactor;
m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor;
- m_glyph.unicodeString = run.is8Bit() ? String(run.characters8(), length) : String(run.characters16(), length);
- m_glyph.isValid = true;
-
ASSERT(length >= 0);
m_length = static_cast<unsigned>(length);
}
@@ -101,7 +100,7 @@ SVGTextMetrics SVGTextMetrics::measureCharacterRange(RenderSVGInlineText* text,
return SVGTextMetrics(text, constructTextRun(text, position, length));
}
-SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, unsigned length, float width, const String& glyphName)
+SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, unsigned length, float width, Glyph glyphNameGlyphId)
{
ASSERT(text);
@@ -111,11 +110,7 @@ SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, uns
m_width = width / scalingFactor;
m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor;
- if (needsContext) {
- m_glyph.isValid = true;
- m_glyph.unicodeString = text->substring(position, length);
- m_glyph.name = glyphName;
- }
+ m_glyph = needsContext ? glyphNameGlyphId : 0;
m_length = length;
}
« no previous file with comments | « Source/core/rendering/svg/SVGTextMetrics.h ('k') | Source/core/rendering/svg/SVGTextMetricsBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698