Loading core/jni/android/graphics/Canvas.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -879,8 +879,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(textArray + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(textArray, start, count, contextCount, css); drawGlyphsToSkia(canvas, paint, layout, x, y); #else sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint, Loading core/jni/android/graphics/MinikinUtils.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define LOG_TAG "Minikin" #include <cutils/log.h> #include <string> #include "SkPaint.h" #include "minikin/Layout.h" Loading @@ -36,7 +37,7 @@ static int snprintfcat(char* buf, int off, int size, const char* format, ...) { return off + n; } void MinikinUtils::SetLayoutProperties(Layout* layout, const SkPaint* paint, int flags, std::string MinikinUtils::setLayoutProperties(Layout* layout, const SkPaint* paint, int bidiFlags, TypefaceImpl* typeface) { TypefaceImpl* resolvedFace = TypefaceImpl_resolveDefault(typeface); layout->setFontCollection(resolvedFace->fFontCollection); Loading @@ -51,13 +52,14 @@ void MinikinUtils::SetLayoutProperties(Layout* layout, const SkPaint* paint, int MinikinFontSkia::packPaintFlags(paint), style.getWeight() * 100, style.getItalic() ? "italic" : "normal", flags); bidiFlags); SkString langString = paint->getPaintOptionsAndroid().getLanguage().getTag(); off = snprintfcat(css, off, sizeof(css), " lang: %s;", langString.c_str()); SkPaintOptionsAndroid::FontVariant var = paint->getPaintOptionsAndroid().getFontVariant(); const char* varstr = var == SkPaintOptionsAndroid::kElegant_Variant ? "elegant" : "compact"; off = snprintfcat(css, off, sizeof(css), " -minikin-variant: %s;", varstr); layout->setProperties(css); return std::string(css); } float MinikinUtils::xOffsetForTextAlign(SkPaint* paint, const Layout& layout) { Loading core/jni/android/graphics/MinikinUtils.h +2 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ class TypefaceImpl; class MinikinUtils { public: static void SetLayoutProperties(Layout* layout, const SkPaint* paint, int flags, TypefaceImpl* face); static std::string setLayoutProperties(Layout* layout, const SkPaint* paint, int bidiFlags, TypefaceImpl* typeface); static float xOffsetForTextAlign(SkPaint* paint, const Layout& layout); Loading core/jni/android/graphics/Paint.cpp +14 −14 Original line number Diff line number Diff line Loading @@ -520,8 +520,8 @@ public: #ifdef USE_MINIKIN Layout layout; TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint); MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray + index, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, index, count, textLength, css); result = layout.getAdvance(); #else TextLayout::getTextRunAdvances(paint, textArray, index, count, textLength, Loading Loading @@ -554,8 +554,8 @@ public: #ifdef USE_MINIKIN Layout layout; TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint); MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, start, count, textLength, css); width = layout.getAdvance(); #else TextLayout::getTextRunAdvances(paint, textArray, start, count, textLength, Loading @@ -582,8 +582,8 @@ public: #ifdef USE_MINIKIN Layout layout; TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint); MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, textLength); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, 0, textLength, textLength, css); width = layout.getAdvance(); #else TextLayout::getTextRunAdvances(paint, textArray, 0, textLength, textLength, Loading Loading @@ -617,8 +617,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, 0, count, count, css); layout.getAdvances(widthsArray); #else TextLayout::getTextRunAdvances(paint, text, 0, count, count, Loading Loading @@ -715,8 +715,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, start, count, contextCount, css); layout.getAdvances(advancesArray); totalAdvance = layout.getAdvance(); #else Loading Loading @@ -860,8 +860,8 @@ public: jint count, jint bidiFlags, jfloat x, jfloat y, SkPath* path) { #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, 0, count, count, css); size_t nGlyphs = layout.nGlyphs(); uint16_t* glyphs = new uint16_t[nGlyphs]; SkPoint* pos = new SkPoint[nGlyphs]; Loading Loading @@ -992,8 +992,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, &paint, bidiFlags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, &paint, bidiFlags, typeface); layout.doLayout(text, 0, count, count, css); MinikinRect rect; layout.getBounds(&rect); r.fLeft = rect.mLeft; Loading core/jni/android_view_GLES20Canvas.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -702,8 +702,8 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count, jfloat x, jfloat y, int flags, SkPaint* paint, TypefaceImpl* typeface) { #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, 0, count, count, css); x += xOffsetForTextAlign(paint, layout.getAdvance()); renderTextLayout(renderer, &layout, x, y, paint); #else Loading Loading @@ -746,8 +746,8 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text, int flags, SkPaint* paint, TypefaceImpl* typeface) { #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, start, count, contextCount, css); x += xOffsetForTextAlign(paint, layout.getAdvance()); renderTextLayout(renderer, &layout, x, y, paint); #else Loading Loading
core/jni/android/graphics/Canvas.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -879,8 +879,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(textArray + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(textArray, start, count, contextCount, css); drawGlyphsToSkia(canvas, paint, layout, x, y); #else sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint, Loading
core/jni/android/graphics/MinikinUtils.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define LOG_TAG "Minikin" #include <cutils/log.h> #include <string> #include "SkPaint.h" #include "minikin/Layout.h" Loading @@ -36,7 +37,7 @@ static int snprintfcat(char* buf, int off, int size, const char* format, ...) { return off + n; } void MinikinUtils::SetLayoutProperties(Layout* layout, const SkPaint* paint, int flags, std::string MinikinUtils::setLayoutProperties(Layout* layout, const SkPaint* paint, int bidiFlags, TypefaceImpl* typeface) { TypefaceImpl* resolvedFace = TypefaceImpl_resolveDefault(typeface); layout->setFontCollection(resolvedFace->fFontCollection); Loading @@ -51,13 +52,14 @@ void MinikinUtils::SetLayoutProperties(Layout* layout, const SkPaint* paint, int MinikinFontSkia::packPaintFlags(paint), style.getWeight() * 100, style.getItalic() ? "italic" : "normal", flags); bidiFlags); SkString langString = paint->getPaintOptionsAndroid().getLanguage().getTag(); off = snprintfcat(css, off, sizeof(css), " lang: %s;", langString.c_str()); SkPaintOptionsAndroid::FontVariant var = paint->getPaintOptionsAndroid().getFontVariant(); const char* varstr = var == SkPaintOptionsAndroid::kElegant_Variant ? "elegant" : "compact"; off = snprintfcat(css, off, sizeof(css), " -minikin-variant: %s;", varstr); layout->setProperties(css); return std::string(css); } float MinikinUtils::xOffsetForTextAlign(SkPaint* paint, const Layout& layout) { Loading
core/jni/android/graphics/MinikinUtils.h +2 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ class TypefaceImpl; class MinikinUtils { public: static void SetLayoutProperties(Layout* layout, const SkPaint* paint, int flags, TypefaceImpl* face); static std::string setLayoutProperties(Layout* layout, const SkPaint* paint, int bidiFlags, TypefaceImpl* typeface); static float xOffsetForTextAlign(SkPaint* paint, const Layout& layout); Loading
core/jni/android/graphics/Paint.cpp +14 −14 Original line number Diff line number Diff line Loading @@ -520,8 +520,8 @@ public: #ifdef USE_MINIKIN Layout layout; TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint); MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray + index, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, index, count, textLength, css); result = layout.getAdvance(); #else TextLayout::getTextRunAdvances(paint, textArray, index, count, textLength, Loading Loading @@ -554,8 +554,8 @@ public: #ifdef USE_MINIKIN Layout layout; TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint); MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, start, count, textLength, css); width = layout.getAdvance(); #else TextLayout::getTextRunAdvances(paint, textArray, start, count, textLength, Loading @@ -582,8 +582,8 @@ public: #ifdef USE_MINIKIN Layout layout; TypefaceImpl* typeface = GraphicsJNI::getNativeTypeface(env, jpaint); MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, textLength); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(textArray, 0, textLength, textLength, css); width = layout.getAdvance(); #else TextLayout::getTextRunAdvances(paint, textArray, 0, textLength, textLength, Loading Loading @@ -617,8 +617,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, 0, count, count, css); layout.getAdvances(widthsArray); #else TextLayout::getTextRunAdvances(paint, text, 0, count, count, Loading Loading @@ -715,8 +715,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, start, count, contextCount, css); layout.getAdvances(advancesArray); totalAdvance = layout.getAdvance(); #else Loading Loading @@ -860,8 +860,8 @@ public: jint count, jint bidiFlags, jfloat x, jfloat y, SkPath* path) { #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, bidiFlags, typeface); layout.doLayout(text, 0, count, count, css); size_t nGlyphs = layout.nGlyphs(); uint16_t* glyphs = new uint16_t[nGlyphs]; SkPoint* pos = new SkPoint[nGlyphs]; Loading Loading @@ -992,8 +992,8 @@ public: #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, &paint, bidiFlags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, &paint, bidiFlags, typeface); layout.doLayout(text, 0, count, count, css); MinikinRect rect; layout.getBounds(&rect); r.fLeft = rect.mLeft; Loading
core/jni/android_view_GLES20Canvas.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -702,8 +702,8 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count, jfloat x, jfloat y, int flags, SkPaint* paint, TypefaceImpl* typeface) { #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, 0, count, count, css); x += xOffsetForTextAlign(paint, layout.getAdvance()); renderTextLayout(renderer, &layout, x, y, paint); #else Loading Loading @@ -746,8 +746,8 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text, int flags, SkPaint* paint, TypefaceImpl* typeface) { #ifdef USE_MINIKIN Layout layout; MinikinUtils::SetLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text + start, count); std::string css = MinikinUtils::setLayoutProperties(&layout, paint, flags, typeface); layout.doLayout(text, start, count, contextCount, css); x += xOffsetForTextAlign(paint, layout.getAdvance()); renderTextLayout(renderer, &layout, x, y, paint); #else Loading