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

Commit b5ddf041 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

LayoutLib: Update font object when text info changes in paint delegate

Change-Id: I6ff7e1ec4513918256aee99acc5ea298a5fdb8a8
parent 26e30bb7
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ public class Paint_Delegate {
        }

        delegate.mTextSize = textSize;
        delegate.updateFontObject();
    }

    /*package*/ static float getTextScaleX(Paint thisPaint) {
@@ -362,6 +363,7 @@ public class Paint_Delegate {
        }

        delegate.mTextScaleX = scaleX;
        delegate.updateFontObject();
    }

    /*package*/ static float getTextSkewX(Paint thisPaint) {
@@ -384,6 +386,7 @@ public class Paint_Delegate {
        }

        delegate.mTextSkewX = skewX;
        delegate.updateFontObject();
    }

    /*package*/ static float ascent(Paint thisPaint) {
@@ -662,7 +665,9 @@ public class Paint_Delegate {
            return 0;
        }

        return delegate.mTypeface = typeface;
        delegate.mTypeface = typeface;
        delegate.updateFontObject();
        return delegate.mTypeface;
    }

    /*package*/ static int native_setRasterizer(int native_object, int rasterizer) {
@@ -670,7 +675,6 @@ public class Paint_Delegate {
        throw new UnsupportedOperationException();
    }


    /*package*/ static int native_getTextAlign(int native_object) {
        // get the delegate from the native int.
        Paint_Delegate delegate = sManager.getDelegate(native_object);
@@ -810,14 +814,10 @@ public class Paint_Delegate {

    private Paint_Delegate() {
        reset();

        mTypeface = Typeface.sDefaults[0].native_instance;
        updateFontObject();
    }

    private Paint_Delegate(Paint_Delegate paint) {
        set(paint);
        updateFontObject();
    }

    private void set(Paint_Delegate paint) {
@@ -838,6 +838,7 @@ public class Paint_Delegate {
        mShader = paint.mShader;
        mPathEffect = paint.mPathEffect;
        mMaskFilter = paint.mMaskFilter;
        updateFontObject();
    }

    private void reset() {
@@ -847,7 +848,7 @@ public class Paint_Delegate {
        mCap = 0;
        mJoin = 0;
        mTextAlign = 0;
        mTypeface = 0;
        mTypeface = Typeface.sDefaults[0].native_instance;
        mStrokeWidth = 1.f;
        mStrokeMiter = 2.f;
        mTextSize = 20.f;
@@ -858,6 +859,7 @@ public class Paint_Delegate {
        mShader = 0;
        mPathEffect = 0;
        mMaskFilter = 0;
        updateFontObject();
    }

    /**