int CachingWordShaper::offsetForPosition(const Font* font, const TextRun& run, float targetX, bool includePartialGlyphs)
{
    ShapeResultBuffer buffer;
    shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer);

    return buffer.offsetForPosition(run, targetX, includePartialGlyphs);
}
int CachingWordShaper::offsetForPosition(const Font* font, const TextRun& run, float targetX)
{
    Vector<RefPtr<ShapeResult>> results;
    shapeResultsForRun(m_shapeCache, font, run, nullptr, &results);

    return ShapeResult::offsetForPosition(results, run, targetX);
}
float CachingWordShaper::fillGlyphBufferForTextEmphasis(const Font* font,
    const TextRun& run, const GlyphData* emphasisData, GlyphBuffer* glyphBuffer,
    unsigned from, unsigned to)
{
    ShapeResultBuffer buffer;
    shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer);

    return buffer.fillGlyphBufferForTextEmphasis(glyphBuffer, run, emphasisData, from, to);
}
float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run,
    HashSet<const SimpleFontData*>* fallbackFonts,
    GlyphBuffer* glyphBuffer, unsigned from, unsigned to)
{
    ShapeResultBuffer buffer;
    shapeResultsForRun(m_shapeCache, font, run, fallbackFonts, &buffer);

    return buffer.fillGlyphBuffer(glyphBuffer, run, from, to);
}
CharacterRange CachingWordShaper::getCharacterRange(const Font* font,
    const TextRun& run, unsigned from, unsigned to)
{
    ShapeResultBuffer buffer;
    float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
        &buffer);

    return buffer.getCharacterRange(run.direction(), totalWidth, from, to);
}
float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run,
    HashSet<const SimpleFontData*>* fallbackFonts,
    GlyphBuffer* glyphBuffer, unsigned from, unsigned to)
{
    Vector<RefPtr<ShapeResult>> results;
    shapeResultsForRun(m_shapeCache, font, run, fallbackFonts, &results);

    return ShapeResult::fillGlyphBuffer(results, glyphBuffer, run, from, to);
}
float CachingWordShaper::fillGlyphBufferForTextEmphasis(const Font* font,
    const TextRun& run, const GlyphData* emphasisData, GlyphBuffer* glyphBuffer,
    unsigned from, unsigned to)
{
    Vector<RefPtr<ShapeResult>> results;
    shapeResultsForRun(m_shapeCache, font, run, nullptr, &results);

    return ShapeResult::fillGlyphBufferForTextEmphasis(results, glyphBuffer,
        run, emphasisData, from, to);
}
FloatRect CachingWordShaper::selectionRect(const Font* font, const TextRun& run,
    const FloatPoint& point, int height, unsigned from, unsigned to)
{
    Vector<RefPtr<ShapeResult>> results;
    float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
        &results);

    return ShapeResult::selectionRect(results, run.direction(), totalWidth,
        point, height, from, to);
}
Beispiel #9
0
float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run,
    HashSet<const SimpleFontData*>* fallbackFonts,
    GlyphBuffer* glyphBuffer, unsigned from, unsigned to)
{
#ifdef MINIBLINK_NOT_IMPLEMENTED
    Vector<RefPtr<ShapeResult>> results;
    shapeResultsForRun(m_shapeCache, font, run, fallbackFonts, &results);

    return ShapeResult::fillGlyphBuffer(results, glyphBuffer, run, from, to);
#endif // MINIBLINK_NOT_IMPLEMENTED
    notImplemented();
    return 0;
}
Beispiel #10
0
FloatRect CachingWordShaper::selectionRect(const Font* font, const TextRun& run,
    const FloatPoint& point, int height, unsigned from, unsigned to)
{
#ifdef MINIBLINK_NOT_IMPLEMENTED
    Vector<RefPtr<ShapeResult>> results;
    float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
        &results);

    return ShapeResult::selectionRect(results, run.direction(), totalWidth,
        point, height, from, to);
#endif // MINIBLINK_NOT_IMPLEMENTED
    notImplemented();
    return FloatRect();
}
Beispiel #11
0
float CachingWordShaper::fillGlyphBufferForTextEmphasis(const Font* font,
    const TextRun& run, const GlyphData* emphasisData, GlyphBuffer* glyphBuffer,
    unsigned from, unsigned to)
{
#ifdef MINIBLINK_NOT_IMPLEMENTED
    Vector<RefPtr<ShapeResult>> results;
    shapeResultsForRun(m_shapeCache, font, run, nullptr, &results);

    return ShapeResult::fillGlyphBufferForTextEmphasis(results, glyphBuffer,
        run, emphasisData, from, to);
#endif // MINIBLINK_NOT_IMPLEMENTED
    notImplemented();
    return 0;
}
Vector<CharacterRange> CachingWordShaper::individualCharacterRanges(
    const Font* font, const TextRun& run)
{
    ShapeResultBuffer buffer;
    float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
        &buffer);

    auto ranges = buffer.individualCharacterRanges(run.direction(), totalWidth);
    // The shaper can fail to return glyph metrics for all characters (see
    // crbug.com/613915 and crbug.com/615661) so add empty ranges to ensure all
    // characters have an associated range.
    while (ranges.size() < static_cast<unsigned>(run.length()))
        ranges.append(CharacterRange(0, 0));
    return ranges;
}