#include "core/rendering/svg/SVGTextMetrics.h"
#include "core/rendering/svg/RenderSVGInlineText.h"
-#include "core/rendering/svg/SVGTextRunRenderingContext.h"
namespace blink {
: m_width(0)
, m_height(0)
, m_length(0)
- , m_glyph(0)
{
}
: m_width(0)
, m_height(0)
, m_length(1)
- , m_glyph(0)
{
}
ASSERT(scalingFactor);
const Font& scaledFont = textRenderer->scaledFont();
- 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) / scalingFactor;
+ m_width = scaledFont.width(run) / scalingFactor;
m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor;
- ASSERT(length >= 0);
- m_length = static_cast<unsigned>(length);
+ ASSERT(run.length() >= 0);
+ m_length = static_cast<unsigned>(run.length());
}
TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText* text, unsigned position, unsigned length)
run.setText(text->characters16() + position, length);
}
- if (textRunNeedsRenderingContext(style->font()))
- run.setRenderingContext(SVGTextRunRenderingContext::create(text));
-
// We handle letter & word spacing ourselves.
run.disableSpacing();
return SVGTextMetrics(text, constructTextRun(text, position, length));
}
-SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, unsigned length, float width, Glyph glyphNameGlyphId)
+SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, unsigned length, float width)
{
ASSERT(text);
- bool needsContext = textRunNeedsRenderingContext(text->style()->font());
float scalingFactor = text->scalingFactor();
ASSERT(scalingFactor);
m_width = width / scalingFactor;
m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor;
- m_glyph = needsContext ? glyphNameGlyphId : 0;
m_length = length;
}