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

Commit 9e680206 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Change Typeface redesign flag to readonly

This redesign feature does not support runtime flag flip.
Therefore, need to be fixed flag.

Bug: 361260253
Bug: 377690190
Test: atest CtsWidgetTestCases
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Test: atest minikin_tests
Flag: com.android.text.flags.typeface_redesign_readonly
Change-Id: I19e18636907646db0b8a9b9db097478e2b61d149
parent dca48527
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -163,10 +163,12 @@ flag {
}

flag {
  name: "typeface_redesign"
  name: "typeface_redesign_readonly"
  namespace: "text"
  description: "Decouple variation settings, weight and style information from Typeface class"
  bug: "361260253"
  # This feature does not support runtime flag switch which leads crash in System UI.
  is_fixed_read_only: true
}

flag {
+1 −1
Original line number Diff line number Diff line
@@ -2119,7 +2119,7 @@ public class Paint {
     * @see FontVariationAxis
     */
    public boolean setFontVariationSettings(String fontVariationSettings) {
        final boolean useFontVariationStore = Flags.typefaceRedesign()
        final boolean useFontVariationStore = Flags.typefaceRedesignReadonly()
                && CompatChanges.isChangeEnabled(NEW_FONT_VARIATION_MANAGEMENT);
        if (useFontVariationStore) {
            FontVariationAxis[] axes =
+2 −2
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ public final class PositionedGlyphs {
    @NonNull
    public Font getFont(@IntRange(from = 0) int index) {
        Preconditions.checkArgumentInRange(index, 0, glyphCount() - 1, "index");
        if (Flags.typefaceRedesign()) {
        if (Flags.typefaceRedesignReadonly()) {
            return mFonts.get(nGetFontId(mLayoutPtr, index));
        }
        return mFonts.get(index);
@@ -252,7 +252,7 @@ public final class PositionedGlyphs {
        mXOffset = xOffset;
        mYOffset = yOffset;

        if (Flags.typefaceRedesign()) {
        if (Flags.typefaceRedesignReadonly()) {
            int fontCount = nGetFontCount(layoutPtr);
            mFonts = new ArrayList<>(fontCount);
            for (int i = 0; i < fontCount; ++i) {
+2 −2
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@ inline bool letter_spacing_justification() {
#endif  // __ANDROID__
}

inline bool typeface_redesign() {
inline bool typeface_redesign_readonly() {
#ifdef __ANDROID__
    static bool flag = com_android_text_flags_typeface_redesign();
    static bool flag = com_android_text_flags_typeface_redesign_readonly();
    return flag;
#else
    return true;
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public:
    static void forFontRun(const minikin::Layout& layout, Paint* paint, F& f) {
        float saveSkewX = paint->getSkFont().getSkewX();
        bool savefakeBold = paint->getSkFont().isEmbolden();
        if (text_feature::typeface_redesign()) {
        if (text_feature::typeface_redesign_readonly()) {
            for (uint32_t runIdx = 0; runIdx < layout.getFontRunCount(); ++runIdx) {
                uint32_t start = layout.getFontRunStart(runIdx);
                uint32_t end = layout.getFontRunEnd(runIdx);
Loading