のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

WebKit - FontAndroid.cpp

external/webkit/WebCore/platform/graphics/android/FontAndroid.cpp

//SAMSUNG_THAI_EDITING_FIX >>
FloatRect Font::selectionRectForComplexText(const TextRun& run,
                                const IntPoint& point, int h, int from, int to) const
{
    SkPaint              paint;
    SkPaint::FontMetrics metrics;
    float beforeWidth = 0.0f ;
    float afterWidth = 0.0f ;

    primaryFont()->platformData().setupPaint(&paint);

    size_t length = from ;
    if (length > 0) {
        beforeWidth = paint.measureText(run.characters(), length << 1);
    }

    length = to ;
    if (length > 0) {
        afterWidth = paint.measureText(run.characters(), length << 1);
    }

    
    return FloatRect(point.x() + floorf(beforeWidth),
                     point.y(),
                     roundf(afterWidth) - floorf(beforeWidth),
                     roundf(SkScalarToFloat(h)));
}

#if 0
FloatRect Font::selectionRectForComplexText(const TextRun& run,
                                const IntPoint& point, int h, int, int) const
{
    SkPaint              paint;
    SkScalar             width, left;
    SkPaint::FontMetrics metrics;

    primaryFont()->platformData().setupPaint(&paint);

    width = paint.measureText(run.characters(), run.length() << 1);
    SkScalar spacing = paint.getFontMetrics(&metrics);
    
    return FloatRect(point.x(),
                     point.y(),
                     roundf(SkScalarToFloat(width)),
                     roundf(SkScalarToFloat(spacing)));
}
#endif
//SAMSUNG_THAI_EDITING_FIX <<