Store FontCollection in MinikinPaint
Test: N/A
Bug: 65024629
Change-Id: I38fe305c5444a6f2b6786be2005b1725f01bf961
diff --git a/core/jni/android_text_MeasuredParagraph.cpp b/core/jni/android_text_MeasuredParagraph.cpp
index f0e449d..faa0e12 100644
--- a/core/jni/android_text_MeasuredParagraph.cpp
+++ b/core/jni/android_text_MeasuredParagraph.cpp
@@ -72,8 +72,7 @@
Paint* paint = toPaint(paintPtr);
const Typeface* typeface = Typeface::resolveDefault(paint->getAndroidTypeface());
minikin::MinikinPaint minikinPaint = MinikinUtils::prepareMinikinPaint(paint, typeface);
- toBuilder(builderPtr)->addStyleRun(start, end, std::move(minikinPaint),
- typeface->fFontCollection, isRtl);
+ toBuilder(builderPtr)->addStyleRun(start, end, std::move(minikinPaint), isRtl);
}
// Regular JNI
diff --git a/libs/hwui/hwui/MinikinUtils.cpp b/libs/hwui/hwui/MinikinUtils.cpp
index ba877d3..43f46ef 100644
--- a/libs/hwui/hwui/MinikinUtils.cpp
+++ b/libs/hwui/hwui/MinikinUtils.cpp
@@ -31,7 +31,7 @@
const Typeface* typeface) {
const Typeface* resolvedFace = Typeface::resolveDefault(typeface);
- minikin::MinikinPaint minikinPaint;
+ minikin::MinikinPaint minikinPaint(resolvedFace->fFontCollection);
/* Prepare minikin Paint */
minikinPaint.size =
paint->isLinearText() ? paint->getTextSize() : static_cast<int>(paint->getTextSize());
@@ -53,21 +53,20 @@
size_t count, size_t bufSize, minikin::MeasuredText* mt,
int mtOffset) {
minikin::MinikinPaint minikinPaint = prepareMinikinPaint(paint, typeface);
- const auto& fc = Typeface::resolveDefault(typeface)->fFontCollection;
minikin::Layout layout;
if (mt == nullptr) {
- layout.doLayout(buf, start, count, bufSize, bidiFlags, minikinPaint, fc);
+ layout.doLayout(buf, start, count, bufSize, bidiFlags, minikinPaint);
return layout;
}
if (mt->buildLayout(minikin::U16StringPiece(buf, bufSize),
minikin::Range(start, start + count),
- minikinPaint, fc, bidiFlags, mtOffset, &layout)) {
+ minikinPaint, bidiFlags, mtOffset, &layout)) {
return layout;
}
- layout.doLayout(buf, start, count, bufSize, bidiFlags, minikinPaint, fc);
+ layout.doLayout(buf, start, count, bufSize, bidiFlags, minikinPaint);
return layout;
}
@@ -75,10 +74,8 @@
const Typeface* typeface, const uint16_t* buf, size_t start,
size_t count, size_t bufSize, float* advances) {
minikin::MinikinPaint minikinPaint = prepareMinikinPaint(paint, typeface);
- const Typeface* resolvedTypeface = Typeface::resolveDefault(typeface);
return minikin::Layout::measureText(buf, start, count, bufSize, bidiFlags, minikinPaint,
- resolvedTypeface->fFontCollection, advances,
- nullptr /* extent */);
+ advances, nullptr /* extent */);
}
bool MinikinUtils::hasVariationSelector(const Typeface* typeface, uint32_t codepoint, uint32_t vs) {