static float textWidth(const RenderText& text, unsigned from, unsigned length, float xPosition, const RenderStyle& style) { if (style.font().isFixedPitch() || (!from && length == text.textLength())) return text.width(from, length, style.font(), xPosition, nullptr, nullptr); // FIXME: Add templated UChar/LChar paths. TextRun run = text.is8Bit() ? TextRun(text.characters8() + from, length) : TextRun(text.characters16() + from, length); run.setCharactersLength(text.textLength() - from); ASSERT(run.charactersLength() >= run.length()); run.setXPos(xPosition); return style.font().width(run); }