Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1044a821 authored by Raph Levien's avatar Raph Levien Committed by Android (Google) Code Review
Browse files

Merge "BiDi support for Minikin"

parents 091d1ea1 9d9ee3d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -866,7 +866,7 @@ public:

#ifdef USE_MINIKIN
        Layout layout;
        MinikinUtils::SetLayoutProperties(&layout, paint, typeface);
        MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface);
        layout.doLayout(textArray + start, count);
        drawGlyphsToSkia(canvas, paint, &layout, x, y);
#else
+2 −0
Original line number Diff line number Diff line
@@ -57,7 +57,9 @@ float MinikinFontSkia::GetHorizontalAdvance(uint32_t glyph_id,
    SkScalar skWidth;
    MinikinFontSkia_SetSkiaPaint(mTypeface, &skPaint, paint);
    skPaint.getTextWidths(&glyph16, sizeof(glyph16), &skWidth, NULL);
#ifdef VERBOSE
    ALOGD("width for typeface %d glyph %d = %f", mTypeface->uniqueID(), glyph_id, skWidth);
#endif
    return skWidth;
}

+5 −4
Original line number Diff line number Diff line
@@ -22,16 +22,17 @@

namespace android {

void MinikinUtils::SetLayoutProperties(Layout* layout, SkPaint* paint,
void MinikinUtils::SetLayoutProperties(Layout* layout, SkPaint* paint, int flags,
    TypefaceImpl* typeface) {
    TypefaceImpl* resolvedFace = TypefaceImpl_resolveDefault(typeface);
    layout->setFontCollection(resolvedFace->fFontCollection);
    FontStyle style = resolvedFace->fStyle;
    char css[256];
    sprintf(css, "font-size: %d; font-weight: %d; font-style: %s",
    sprintf(css, "font-size: %d; font-weight: %d; font-style: %s; -minikin-bidi: %d",
        (int)paint->getTextSize(),
        style.getWeight() * 100,
        style.getItalic() ? "italic" : "normal");
        style.getItalic() ? "italic" : "normal",
        flags);
    layout->setProperties(css);
}

+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ namespace android {

class MinikinUtils {
public:
    static void SetLayoutProperties(Layout* layout, SkPaint* paint,
    static void SetLayoutProperties(Layout* layout, SkPaint* paint, int flags,
        TypefaceImpl* face);
};

+5 −5
Original line number Diff line number Diff line
@@ -503,7 +503,7 @@ public:
#ifdef USE_MINIKIN
        Layout layout;
        TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint);
        MinikinUtils::SetLayoutProperties(&layout, paint, typeface);
        MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface);
        layout.doLayout(textArray + index, count);
        result = layout.getAdvance();
#else
@@ -537,7 +537,7 @@ public:
#ifdef USE_MINIKIN
        Layout layout;
        TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint);
        MinikinUtils::SetLayoutProperties(&layout, paint, typeface);
        MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface);
        layout.doLayout(textArray + start, count);
        width = layout.getAdvance();
#else
@@ -565,7 +565,7 @@ public:
#ifdef USE_MINIKIN
        Layout layout;
        TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint);
        MinikinUtils::SetLayoutProperties(&layout, paint, typeface);
        MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface);
        layout.doLayout(textArray, textLength);
        width = layout.getAdvance();
#else
@@ -600,7 +600,7 @@ public:

#ifdef USE_MINIKIN
        Layout layout;
        MinikinUtils::SetLayoutProperties(&layout, paint, typeface);
        MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface);
        layout.doLayout(text, count);
        layout.getAdvances(widthsArray);
#else
@@ -698,7 +698,7 @@ public:

#ifdef USE_MINIKIN
        Layout layout;
        MinikinUtils::SetLayoutProperties(&layout, paint, typeface);
        MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface);
        layout.doLayout(text + start, count);
        layout.getAdvances(advancesArray);
        totalAdvance = layout.getAdvance();
Loading